diff --git a/CHANGELOG.md b/CHANGELOG.md index bd400a87..f2833a56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). All notable c ### Fixed - [#338](https://github.com/Kashoo/synctos/issues/338): The `mustNotBeMissing` and `mustNotBeNull` constraints do not behave as expected +### Security +- [340](https://github.com/Kashoo/synctos/issues/340): Security vulnerability in lodash dev dependency + ### Deprecated - `mustNotBeMissing` constraint - `mustNotBeNull` constraint diff --git a/lib/commander/VERSION b/lib/commander/VERSION index cf869073..ef0f38ab 100644 --- a/lib/commander/VERSION +++ b/lib/commander/VERSION @@ -1 +1 @@ -2.18.0 +2.19.0 diff --git a/lib/commander/index.js b/lib/commander/index.js index 8e296691..bf039c90 100644 --- a/lib/commander/index.js +++ b/lib/commander/index.js @@ -580,9 +580,9 @@ Command.prototype.executeSubCommand = function(argv, args, unknown) { proc.on('close', process.exit.bind(process)); proc.on('error', function(err) { if (err.code === 'ENOENT') { - console.error('%s(1) does not exist, try --help', bin); + console.error('error: %s(1) does not exist, try --help', bin); } else if (err.code === 'EACCES') { - console.error('%s(1) not executable. try chmod or run with root', bin); + console.error('error: %s(1) not executable. try chmod or run with root', bin); } process.exit(1); }); @@ -792,9 +792,7 @@ Command.prototype.opts = function() { */ Command.prototype.missingArgument = function(name) { - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); + console.error("error: missing required argument `%s'", name); process.exit(1); }; @@ -807,13 +805,11 @@ Command.prototype.missingArgument = function(name) { */ Command.prototype.optionMissingArgument = function(option, flag) { - console.error(); if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); + console.error("error: option `%s' argument missing, got `%s'", option.flags, flag); } else { - console.error(" error: option `%s' argument missing", option.flags); + console.error("error: option `%s' argument missing", option.flags); } - console.error(); process.exit(1); }; @@ -826,9 +822,7 @@ Command.prototype.optionMissingArgument = function(option, flag) { Command.prototype.unknownOption = function(flag) { if (this._allowUnknownOption) return; - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); + console.error("error: unknown option `%s'", flag); process.exit(1); }; @@ -840,9 +834,7 @@ Command.prototype.unknownOption = function(flag) { */ Command.prototype.variadicArgNotLast = function(name) { - console.error(); - console.error(" error: variadic arguments must be last `%s'", name); - console.error(); + console.error("error: variadic arguments must be last `%s'", name); process.exit(1); }; @@ -1053,7 +1045,7 @@ Command.prototype.optionHelp = function() { // Append the help information return this.options.map(function(option) { return pad(option.flags, width) + ' ' + option.description + - ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : ''); + ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : ''); }).concat([pad('-h, --help', width) + ' ' + 'output usage information']) .join('\n'); }; @@ -1073,7 +1065,6 @@ Command.prototype.commandHelp = function() { return [ 'Commands:', - '', commands.map(function(cmd) { var desc = cmd[1] ? ' ' + cmd[1] : ''; return (desc ? pad(cmd[0], width) : cmd[0]) + desc; @@ -1124,7 +1115,6 @@ Command.prototype.helpInformation = function() { var options = [ 'Options:', - '', '' + this.optionHelp().replace(/^/gm, ' '), '' ]; diff --git a/lib/indent.js/LICENSE.md b/lib/indent.js/LICENSE similarity index 94% rename from lib/indent.js/LICENSE.md rename to lib/indent.js/LICENSE index 140a0e95..5a61f397 100644 --- a/lib/indent.js/LICENSE.md +++ b/lib/indent.js/LICENSE @@ -1,7 +1,7 @@ The MIT License (MIT) ===================== -Copyright © `2017` `Zeb Zhao` +Copyright © 2018 Zeb Zhao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -22,4 +22,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/indent.js/VERSION b/lib/indent.js/VERSION index d15723fb..42045aca 100644 --- a/lib/indent.js/VERSION +++ b/lib/indent.js/VERSION @@ -1 +1 @@ -0.3.2 +0.3.4 diff --git a/lib/indent.js/indent.js b/lib/indent.js/indent.js index 88aea460..f2f7e805 100644 --- a/lib/indent.js/indent.js +++ b/lib/indent.js/indent.js @@ -10,6 +10,25 @@ var indent = (function (root) { var rulesCache = {}; + function map(array, predicate) { + var i, results = []; + for (i=0; i/], @@ -73,7 +94,7 @@ var indent = (function (root) { $consumeEndMatch: true }, { - $languages: "html", + $languages: "js html", $name: "void-tags", $startPatterns: [ /\<(area|base|br|col|command|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)/i], @@ -135,10 +156,10 @@ var indent = (function (root) { $consumeEndMatch: true }, { - $languages: "html", + $languages: "js html", $name: "tag", $startPatterns: [function (string, rule, state) { - var re = /<([A-Za-z0-9\-]+)/; + var re = /<([A-Za-z][A-Za-z0-9\-\.]*)/; var match = string.match(re); if (match) { state.openingTag = match[1]; @@ -151,7 +172,7 @@ var indent = (function (root) { } }], $endPatterns: [function (string, rule, state) { - var re = new RegExp("", "i"); + var re = new RegExp("<\/" + state.openingTag + ">|\\s\/>", "i"); var match = string.match(re); if (match) { return { @@ -228,16 +249,18 @@ var indent = (function (root) { $consumeEndMatch: true }, { - $languages: "html", + $languages: "js html", $name: "quotes", + $excludeIf: HTML_TAG_RULES, $startPatterns: [/"/], $endPatterns: [/"/, NEW_LINE_REGEX], $ignoreRules: true, $consumeEndMatch: true }, { - $languages: "html", + $languages: "js html", $name: "quotes", + $excludeIf: HTML_TAG_RULES, $startPatterns: [/'/], $endPatterns: [/'/, NEW_LINE_REGEX], $ignoreRules: true, @@ -381,6 +404,7 @@ var indent = (function (root) { { $languages: "js", $name: "=", + $excludeIf: HTML_TAG_RULES, $startPatterns: [/=/], $endPatterns: [/[,;\)\]}]/, NEW_LINE_REGEX] }, @@ -598,10 +622,16 @@ var indent = (function (root) { var lastMatch = lastMatches[lastMatches.length - 1]; var lastRuleInScope = lastMatch ? lastMatch.rule.$name : ''; + var activeRules = map(activeMatches, function (match) { + return match.rule.$name; + }).join('\n'); // Use \n as a special delimiter for rule names for (var rule, r = 0; r < rules.length; r++) { rule = rules[r]; - if (!rule.$lastRule || + if (rule.$excludeIf && some(rule.$excludeIf, function (excludeRule) { + return activeRules.indexOf(excludeRule) != -1; + })) { + } else if (!rule.$lastRule || (lastRuleInScope && rule.$lastRule.indexOf(lastRuleInScope) !== -1) ) { match = searchAny(string, rule.$startPatterns, rule); diff --git a/lib/joi/LICENSE b/lib/joi/LICENSE index d59259f8..f8d65e42 100644 --- a/lib/joi/LICENSE +++ b/lib/joi/LICENSE @@ -2,7 +2,7 @@ Joi === -Copyright (c) 2012-2017, Project contributors +Copyright (c) 2012-2018, Project contributors Copyright (c) 2012-2014, Walmart All rights reserved. diff --git a/lib/joi/VERSION b/lib/joi/VERSION index d6ef9982..6dfe8b12 100644 --- a/lib/joi/VERSION +++ b/lib/joi/VERSION @@ -1 +1 @@ -13.7.0 +14.3.1 diff --git a/lib/joi/joi.bundle.js b/lib/joi/joi.bundle.js index 012c6d4a..ad158f41 100644 --- a/lib/joi/joi.bundle.js +++ b/lib/joi/joi.bundle.js @@ -94,12 +94,12 @@ module.exports = // Load modules -const Assert = __webpack_require__(13); -const Crypto = __webpack_require__(14); -const Path = __webpack_require__(15); -const Util = __webpack_require__(4); +const Assert = __webpack_require__(15); +const Crypto = __webpack_require__(16); +const Path = __webpack_require__(17); -const Escape = __webpack_require__(16); +const DeepEqual = __webpack_require__(18); +const Escape = __webpack_require__(19); // Declare internals @@ -107,9 +107,14 @@ const Escape = __webpack_require__(16); const internals = {}; +// Deep object or array comparison + +exports.deepEqual = DeepEqual; + + // Clone object or array -exports.clone = function (obj, seen) { +exports.clone = function (obj, options = {}, _seen = null) { if (typeof obj !== 'object' || obj === null) { @@ -117,7 +122,7 @@ exports.clone = function (obj, seen) { return obj; } - seen = seen || new Map(); + const seen = _seen || new Map(); const lookup = seen.get(obj); if (lookup) { @@ -126,8 +131,9 @@ exports.clone = function (obj, seen) { let newObj; let cloneDeep = false; + const isArray = Array.isArray(obj); - if (!Array.isArray(obj)) { + if (!isArray) { if (Buffer.isBuffer(obj)) { newObj = Buffer.from(obj); } @@ -158,9 +164,14 @@ exports.clone = function (obj, seen) { seen.set(obj, newObj); if (cloneDeep) { - const keys = Object.getOwnPropertyNames(obj); + const keys = internals.keys(obj, options); for (let i = 0; i < keys.length; ++i) { const key = keys[i]; + + if (isArray && key === 'length') { + continue; + } + const descriptor = Object.getOwnPropertyDescriptor(obj, key); if (descriptor && (descriptor.get || @@ -169,20 +180,33 @@ exports.clone = function (obj, seen) { Object.defineProperty(newObj, key, descriptor); } else { - newObj[key] = exports.clone(obj[key], seen); + Object.defineProperty(newObj, key, { + enumerable: descriptor ? descriptor.enumerable : true, + writable: true, + configurable: true, + value: exports.clone(obj[key], options, seen) + }); } } + + if (isArray) { + newObj.length = obj.length; + } } return newObj; }; +internals.keys = function (obj, options = {}) { + + return options.symbols ? Reflect.ownKeys(obj) : Object.getOwnPropertyNames(obj); +}; + + // Merge all the properties of source into target, source wins in conflict, and by default null and undefined from source are applied -/*eslint-disable */ exports.merge = function (target, source, isNullOverride /* = true */, isMergeArrays /* = true */) { - /*eslint-enable */ exports.assert(target && typeof target === 'object', 'Invalid target value: must be an object'); exports.assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object'); @@ -204,10 +228,12 @@ exports.merge = function (target, source, isNullOverride /* = true */, isMergeAr return target; } - const keys = Object.keys(source); + const keys = internals.keys(source); for (let i = 0; i < keys.length; ++i) { const key = keys[i]; - if (key === '__proto__') { + if (key === '__proto__' || + !Object.prototype.propertyIsEnumerable.call(source, key)) { + continue; } @@ -267,7 +293,7 @@ exports.applyToDefaults = function (defaults, options, isNullOverride) { // Clone an object except for the listed keys which are shallow copied -exports.cloneWithShallow = function (source, keys) { +exports.cloneWithShallow = function (source, keys, options) { if (!source || typeof source !== 'object') { @@ -276,20 +302,22 @@ exports.cloneWithShallow = function (source, keys) { } const storage = internals.store(source, keys); // Move shallow copy items to storage - const copy = exports.clone(source); // Deep copy the rest - internals.restore(copy, source, storage); // Shallow copy the stored items and restore + const copy = exports.clone(source, options); // Deep copy the rest + internals.restore(copy, source, storage); // Shallow copy the stored items and restore return copy; }; internals.store = function (source, keys) { - const storage = {}; + const storage = new Map(); for (let i = 0; i < keys.length; ++i) { const key = keys[i]; const value = exports.reach(source, key); - if (value !== undefined) { - storage[key] = value; + if (typeof value === 'object' || + typeof value === 'function') { + + storage.set(key, value); internals.reachSet(source, key, undefined); } } @@ -300,18 +328,16 @@ internals.store = function (source, keys) { internals.restore = function (copy, source, storage) { - const keys = Object.keys(storage); - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - internals.reachSet(copy, key, storage[key]); - internals.reachSet(source, key, storage[key]); + for (const [key, value] of storage) { + internals.reachSet(copy, key, value); + internals.reachSet(source, key, value); } }; internals.reachSet = function (obj, key, value) { - const path = key.split('.'); + const path = Array.isArray(key) ? key : key.split('.'); let ref = obj; for (let i = 0; i < path.length; ++i) { const segment = path[i]; @@ -342,206 +368,56 @@ exports.applyToDefaultsWithShallow = function (defaults, options, keys) { return copy; } - const storage = internals.store(options, keys); // Move shallow copy items to storage - exports.merge(copy, options, false, false); // Deep copy the rest - internals.restore(copy, options, storage); // Shallow copy the stored items and restore + const storage = internals.store(options, keys); // Move shallow copy items to storage + exports.merge(copy, options, false, false); // Deep copy the rest + internals.restore(copy, options, storage); // Shallow copy the stored items and restore return copy; }; -// Deep object or array comparison - -exports.deepEqual = function (obj, ref, options, seen) { - - if (obj === ref) { // Copied from Deep-eql, copyright(c) 2013 Jake Luer, jake@alogicalparadox.com, MIT Licensed, https://github.com/chaijs/deep-eql - return obj !== 0 || 1 / obj === 1 / ref; // -0 / +0 - } - - options = options || { prototype: true }; - - const type = typeof obj; - - if (type !== typeof ref) { - return false; - } - - if (type !== 'object' || - obj === null || - ref === null) { - - return obj !== obj && ref !== ref; // NaN - } - - seen = seen || []; - if (seen.indexOf(obj) !== -1) { - return true; // If previous comparison failed, it would have stopped execution - } - - seen.push(obj); - - if (Array.isArray(obj)) { - if (!Array.isArray(ref)) { - return false; - } - - if (!options.part && obj.length !== ref.length) { - return false; - } - - for (let i = 0; i < obj.length; ++i) { - if (options.part) { - let found = false; - for (let j = 0; j < ref.length; ++j) { - if (exports.deepEqual(obj[i], ref[j], options)) { - found = true; - break; - } - } - - return found; - } - - if (!exports.deepEqual(obj[i], ref[i], options)) { - return false; - } - } - - return true; - } - - if (Buffer.isBuffer(obj)) { - if (!Buffer.isBuffer(ref)) { - return false; - } - - if (obj.length !== ref.length) { - return false; - } - - for (let i = 0; i < obj.length; ++i) { - if (obj[i] !== ref[i]) { - return false; - } - } - - return true; - } - - if (obj instanceof Date) { - return (ref instanceof Date && obj.getTime() === ref.getTime()); - } - - if (obj instanceof RegExp) { - return (ref instanceof RegExp && obj.toString() === ref.toString()); - } - - if (options.prototype) { - if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) { - return false; - } - } +// Find the common unique items in two arrays - const keys = Object.getOwnPropertyNames(obj); +exports.intersect = function (array1, array2, justFirst) { - if (!options.part && keys.length !== Object.getOwnPropertyNames(ref).length) { - return false; - } + if (!array1 || + !array2) { - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - const descriptor = Object.getOwnPropertyDescriptor(obj, key); - if (descriptor.get) { - if (!exports.deepEqual(descriptor, Object.getOwnPropertyDescriptor(ref, key), options, seen)) { - return false; - } - } - else if (!exports.deepEqual(obj[key], ref[key], options, seen)) { - return false; - } + return (justFirst ? null : []); } - return true; -}; - - -// Remove duplicate items from array - -exports.unique = (array, key) => { - - let result; - if (key) { - result = []; - const index = new Set(); - array.forEach((item) => { + const common = []; + const hash = (Array.isArray(array1) ? new Set(array1) : array1); + const found = new Set(); + for (const value of array2) { + if (internals.has(hash, value) && + !found.has(value)) { - const identifier = item[key]; - if (!index.has(identifier)) { - index.add(identifier); - result.push(item); + if (justFirst) { + return value; } - }); - } - else { - result = Array.from(new Set(array)); - } - - return result; -}; - - -// Convert array into object - -exports.mapToObject = function (array, key) { - - if (!array) { - return null; - } - const obj = {}; - for (let i = 0; i < array.length; ++i) { - if (key) { - if (array[i][key]) { - obj[array[i][key]] = true; - } - } - else { - obj[array[i]] = true; + common.push(value); + found.add(value); } } - return obj; + return (justFirst ? null : common); }; -// Find the common unique items in two arrays - -exports.intersect = function (array1, array2, justFirst) { - - if (!array1 || !array2) { - return []; - } - - const common = []; - const hash = (Array.isArray(array1) ? exports.mapToObject(array1) : array1); - const found = {}; - for (let i = 0; i < array2.length; ++i) { - if (hash[array2[i]] && !found[array2[i]]) { - if (justFirst) { - return array2[i]; - } +internals.has = function (ref, key) { - common.push(array2[i]); - found[array2[i]] = true; - } + if (typeof ref.has === 'function') { + return ref.has(key); } - return (justFirst ? null : common); + return ref[key] !== undefined; }; // Test if the reference contains the values -exports.contain = function (ref, values, options) { +exports.contain = function (ref, values, options = {}) { // options: { deep, once, only, part, symbols } /* string -> string(s) @@ -557,14 +433,13 @@ exports.contain = function (ref, values, options) { !Array.isArray(values)) { valuePairs = values; - values = Object.keys(values); + const symbols = Object.getOwnPropertySymbols(values).filter(Object.prototype.propertyIsEnumerable.bind(values)); + values = [...Object.keys(values), ...symbols]; } else { values = [].concat(values); } - options = options || {}; // deep, once, only, part - exports.assert(typeof ref === 'string' || typeof ref === 'object', 'Reference must be string or an object'); exports.assert(values.length, 'Values array cannot be empty'); @@ -578,7 +453,7 @@ exports.contain = function (ref, values, options) { compareFlags = { prototype: hasOnly ? options.only : hasPart ? !options.part : false, - part: hasOnly ? !options.only : hasPart ? options.part : true + part: hasOnly ? !options.only : hasPart ? options.part : false }; } else { @@ -610,10 +485,17 @@ exports.contain = function (ref, values, options) { misses = !!leftovers; } else if (Array.isArray(ref)) { + const onlyOnce = !!(options.only && options.once); + if (onlyOnce && ref.length !== values.length) { + return false; + } + for (let i = 0; i < ref.length; ++i) { let matched = false; for (let j = 0; j < values.length && matched === false; ++j) { - matched = compare(values[j], ref[i], compareFlags) && j; + if (!onlyOnce || matches[j] === 0) { + matched = compare(values[j], ref[i], compareFlags) && j; + } } if (matched !== false) { @@ -625,7 +507,7 @@ exports.contain = function (ref, values, options) { } } else { - const keys = Object.getOwnPropertyNames(ref); + const keys = internals.keys(ref, options); for (let i = 0; i < keys.length; ++i) { const key = keys[i]; const pos = values.indexOf(key); @@ -644,6 +526,12 @@ exports.contain = function (ref, values, options) { } } + if (options.only) { + if (misses || !options.once) { + return !misses; + } + } + let result = false; for (let i = 0; i < matches.length; ++i) { result = result || !!matches[i]; @@ -654,12 +542,6 @@ exports.contain = function (ref, values, options) { } } - if (options.only && - misses) { - - return false; - } - return result; }; @@ -699,13 +581,21 @@ exports.reach = function (obj, chain, options) { options = { separator: options }; } - const path = chain.split(options.separator || '.'); + const isChainArray = Array.isArray(chain); + + exports.assert(!isChainArray || !options.separator, 'Separator option no valid for array-based chain'); + + const path = isChainArray ? chain : chain.split(options.separator || '.'); let ref = obj; for (let i = 0; i < path.length; ++i) { let key = path[i]; - if (key[0] === '-' && Array.isArray(ref)) { - key = key.slice(1, key.length); - key = ref.length - key; + + if (Array.isArray(ref)) { + const number = Number(key); + + if (Number.isInteger(number) && number < 0) { + key = ref.length + number; + } } if (!ref || @@ -735,79 +625,6 @@ exports.reachTemplate = function (obj, template, options) { }; -exports.formatStack = function (stack) { - - const trace = []; - for (let i = 0; i < stack.length; ++i) { - const item = stack[i]; - trace.push([item.getFileName(), item.getLineNumber(), item.getColumnNumber(), item.getFunctionName(), item.isConstructor()]); - } - - return trace; -}; - - -exports.formatTrace = function (trace) { - - const display = []; - - for (let i = 0; i < trace.length; ++i) { - const row = trace[i]; - display.push((row[4] ? 'new ' : '') + row[3] + ' (' + row[0] + ':' + row[1] + ':' + row[2] + ')'); - } - - return display; -}; - - -exports.callStack = function (slice) { - - // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - - const v8 = Error.prepareStackTrace; - Error.prepareStackTrace = function (_, stack) { - - return stack; - }; - - const capture = {}; - Error.captureStackTrace(capture, this); - const stack = capture.stack; - - Error.prepareStackTrace = v8; - - const trace = exports.formatStack(stack); - - return trace.slice(1 + slice); -}; - - -exports.displayStack = function (slice) { - - const trace = exports.callStack(slice === undefined ? 1 : slice + 1); - - return exports.formatTrace(trace); -}; - - -exports.abortThrow = false; - - -exports.abort = function (message, hideStack) { - - if ("production" === 'test' || exports.abortThrow === true) { - throw new Error(message || 'Unknown error'); - } - - let stack = ''; - if (!hideStack) { - stack = exports.displayStack(1).join('\n\t'); - } - console.log('ABORT: ' + message + '\n\t' + stack); - process.exit(1); -}; - - exports.assert = function (condition, ...args) { if (condition) { @@ -870,35 +687,6 @@ exports.escapeRegex = function (string) { }; -// Base64url (RFC 4648) encode - -exports.base64urlEncode = function (value, encoding) { - - exports.assert(typeof value === 'string' || Buffer.isBuffer(value), 'value must be string or buffer'); - const buf = (Buffer.isBuffer(value) ? value : Buffer.from(value, encoding || 'binary')); - return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); -}; - - -// Base64url (RFC 4648) decode - -exports.base64urlDecode = function (value, encoding) { - - if (typeof value !== 'string') { - - throw new Error('Value not a string'); - } - - if (!/^[\w\-]*$/.test(value)) { - - throw new Error('Invalid character'); - } - - const buf = Buffer.from(value, 'base64'); - return (encoding === 'buffer' ? buf : buf.toString(encoding || 'binary')); -}; - - // Escape attribute value for use in HTTP header exports.escapeHeaderAttribute = function (attribute) { @@ -917,12 +705,6 @@ exports.escapeHtml = function (string) { }; -exports.escapeJavaScript = function (string) { - - return Escape.escapeJavaScript(string); -}; - - exports.escapeJson = function (string) { return Escape.escapeJson(string); @@ -940,7 +722,7 @@ exports.once = function (method) { if (!once) { once = true; - method.apply(null, args); + method(...args); } }; @@ -949,59 +731,9 @@ exports.once = function (method) { }; -exports.isInteger = Number.isSafeInteger; - - exports.ignore = function () { }; -exports.inherits = Util.inherits; - - -exports.format = Util.format; - - -exports.transform = function (source, transform, options) { - - exports.assert(source === null || source === undefined || typeof source === 'object' || Array.isArray(source), 'Invalid source object: must be null, undefined, an object, or an array'); - const separator = (typeof options === 'object' && options !== null) ? (options.separator || '.') : '.'; - - if (Array.isArray(source)) { - const results = []; - for (let i = 0; i < source.length; ++i) { - results.push(exports.transform(source[i], transform, options)); - } - return results; - } - - const result = {}; - const keys = Object.keys(transform); - - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - const path = key.split(separator); - const sourcePath = transform[key]; - - exports.assert(typeof sourcePath === 'string', 'All mappings must be "." delineated strings'); - - let segment; - let res = result; - - while (path.length > 1) { - segment = path.shift(); - if (!res[segment]) { - res[segment] = {}; - } - res = res[segment]; - } - segment = path.shift(); - res[segment] = exports.reach(source, sourcePath, options); - } - - return result; -}; - - exports.uniqueFilename = function (path, extension) { if (extension) { @@ -1028,12 +760,6 @@ exports.stringify = function (...args) { }; -exports.shallow = function (source) { - - return Object.assign({}, source); -}; - - exports.wait = function (timeout) { return new Promise((resolve) => setTimeout(resolve, timeout)); @@ -1058,15 +784,20 @@ exports.block = function () { const Hoek = __webpack_require__(0); const Settings = __webpack_require__(7); const Ref = __webpack_require__(2); -const Errors = __webpack_require__(5); -let Alternatives = null; // Delay-loaded to prevent circular dependencies +const Errors = __webpack_require__(4); +const State = __webpack_require__(5); +const Symbols = __webpack_require__(8); + +// Delay-loaded to prevent circular dependencies +let Alternatives = null; let Cast = null; +let Schemas = null; // Declare internals const internals = { - Set: __webpack_require__(8) + Set: __webpack_require__(9) }; @@ -1149,8 +880,10 @@ module.exports = internals.Any = class { checkOptions(options) { - const Schemas = __webpack_require__(18); + Schemas = Schemas || __webpack_require__(21); + const result = Schemas.options.validate(options); + if (result.error) { throw new Error(result.error.details[0].message); } @@ -1212,16 +945,30 @@ module.exports = internals.Any = class { obj._settings = obj._settings ? Settings.concat(obj._settings, schema._settings) : schema._settings; obj._valids.merge(schema._valids, schema._invalids); obj._invalids.merge(schema._invalids, schema._valids); - obj._tests = obj._tests.concat(schema._tests); - obj._refs = obj._refs.concat(schema._refs); - Hoek.merge(obj._flags, schema._flags); + obj._tests.push(...schema._tests); + obj._refs.push(...schema._refs); + if (obj._flags.empty && schema._flags.empty) { + obj._flags.empty = obj._flags.empty.concat(schema._flags.empty); + const flags = Object.assign({}, schema._flags); + delete flags.empty; + Hoek.merge(obj._flags, flags); + } + else if (schema._flags.empty) { + obj._flags.empty = schema._flags.empty; + const flags = Object.assign({}, schema._flags); + delete flags.empty; + Hoek.merge(obj._flags, flags); + } + else { + Hoek.merge(obj._flags, schema._flags); + } obj._description = schema._description || obj._description; obj._unit = schema._unit || obj._unit; - obj._notes = obj._notes.concat(schema._notes); - obj._tags = obj._tags.concat(schema._tags); - obj._examples = obj._examples.concat(schema._examples); - obj._meta = obj._meta.concat(schema._meta); + obj._notes.push(...schema._notes); + obj._tags.push(...schema._tags); + obj._examples.push(...schema._examples); + obj._meta.push(...schema._meta); const inners = Object.keys(schema._inner); const isObject = obj._type === 'object'; @@ -1271,6 +1018,14 @@ module.exports = internals.Any = class { return obj; } + _testUnique(name, arg, func, options) { + + const obj = this.clone(); + obj._tests = obj._tests.filter((test) => test.name !== name); + obj._tests.push({ func, name, arg, options }); + return obj; + } + options(options) { Hoek.assert(!options.context, 'Cannot override context'); @@ -1303,12 +1058,20 @@ module.exports = internals.Any = class { return obj; } - error(err) { + error(err, options = { self: false }) { Hoek.assert(err && (err instanceof Error || typeof err === 'function'), 'Must provide a valid Error object or a function'); + const unknownKeys = Object.keys(options).filter((k) => !['self'].includes(k)); + Hoek.assert(unknownKeys.length === 0, `Options ${unknownKeys} are unknown`); + const obj = this.clone(); obj._flags.error = err; + + if (options.self) { + obj._flags.selfError = true; + } + return obj; } @@ -1323,6 +1086,7 @@ module.exports = internals.Any = class { obj._invalids.remove(value); obj._valids.add(value, obj._refs); } + return obj; } @@ -1394,7 +1158,7 @@ module.exports = internals.Any = class { return obj; } - applyFunctionToChildren(children, fn, args, root) { + applyFunctionToChildren(children, fn, args = [], root) { children = [].concat(children); @@ -1409,7 +1173,7 @@ module.exports = internals.Any = class { throw new Error('unknown key(s) ' + extraChildren.join(', ')); } - return this[fn].apply(this, args); + return this[fn](...args); } default(value, description) { @@ -1443,6 +1207,7 @@ module.exports = internals.Any = class { else { obj._flags.empty = Cast.schema(this._currentJoi, schema); } + return obj; } @@ -1454,12 +1219,13 @@ module.exports = internals.Any = class { const then = options.hasOwnProperty('then') ? this.concat(Cast.schema(this._currentJoi, options.then)) : undefined; const otherwise = options.hasOwnProperty('otherwise') ? this.concat(Cast.schema(this._currentJoi, options.otherwise)) : undefined; - Alternatives = Alternatives || __webpack_require__(9); + Alternatives = Alternatives || __webpack_require__(10); const alternativeOptions = { then, otherwise }; if (Object.prototype.hasOwnProperty.call(options, 'is')) { alternativeOptions.is = options.is; } + const obj = Alternatives.when(condition, alternativeOptions); obj._flags.presence = 'ignore'; obj._baseType = this; @@ -1503,13 +1269,40 @@ module.exports = internals.Any = class { return obj; } - example(...args) { + example(...examples) { + + Hoek.assert(examples.length > 0, 'Missing examples'); + + const processed = []; + for (let i = 0; i < examples.length; ++i) { + const example = [].concat(examples[i]); + Hoek.assert(example.length <= 2, `Bad example format at index ${i}`); + + const value = example[0]; + let options = example[1]; + if (options !== undefined) { + Hoek.assert(options && typeof options === 'object', `Options for example at index ${i} must be an object`); + const unknownOptions = Object.keys(options).filter((option) => !['parent', 'context'].includes(option)); + Hoek.assert(unknownOptions.length === 0, `Unknown example options ${unknownOptions} at index ${i}`); + } + else { + options = {}; + } - Hoek.assert(args.length === 1, 'Missing example'); - const value = args[0]; + const localState = new State('', [], options.parent || null); + const result = this._validate(value, localState, Settings.concat(internals.defaults, options.context ? { context: options.context } : null)); + Hoek.assert(!result.errors, `Bad example at index ${i}:`, result.errors && Errors.process(result.errors, value)); + + const ex = { value }; + if (Object.keys(options).length) { + ex.options = options; + } + + processed.push(ex); + } const obj = this.clone(); - obj._examples.push(value); + obj._examples = processed; return obj; } @@ -1537,77 +1330,29 @@ module.exports = internals.Any = class { // Setup state and settings - state = state || { key: '', path: [], parent: null, reference }; + state = state || new State('', [], null, reference); if (this._settings) { - options = Settings.concat(options, this._settings); - } - - let errors = []; - const finish = () => { - - let finalValue; - - if (value !== undefined) { - finalValue = this._flags.raw ? originalValue : value; - } - else if (options.noDefaults) { - finalValue = value; - } - else if (Ref.isRef(this._flags.default)) { - finalValue = this._flags.default(state.parent, options); - } - else if (typeof this._flags.default === 'function' && - !(this._flags.func && !this._flags.default.description)) { - - let args; - - if (state.parent !== null && - this._flags.default.length > 0) { - - args = [Hoek.clone(state.parent), options]; - } - - const defaultValue = internals._try(this._flags.default, args); - finalValue = defaultValue.value; - if (defaultValue.error) { - errors.push(this.createError('any.default', { error: defaultValue.error }, state, options)); - } + const isDefaultOptions = options === internals.defaults; + if (isDefaultOptions && this._settings[Symbols.settingsCache]) { + options = this._settings[Symbols.settingsCache]; } else { - finalValue = Hoek.clone(this._flags.default); - } - - if (errors.length && typeof this._flags.error === 'function') { - const change = this._flags.error.call(this, errors); - - if (typeof change === 'string') { - errors = [this.createOverrideError('override', { reason: errors }, state, options, change)]; - } - else { - errors = [].concat(change) - .map((err) => { - - return err instanceof Error ? - err : - this.createOverrideError(err.type || 'override', err.context, state, options, err.message, err.template); - }); + options = Settings.concat(options, this._settings); + if (isDefaultOptions) { + this._settings[Symbols.settingsCache] = options; } } + } - return { - value: this._flags.strip ? undefined : finalValue, - finalValue, - errors: errors.length ? errors : null - }; - }; + let errors = []; if (this._coerce) { - const coerced = this._coerce.call(this, value, state, options); + const coerced = this._coerce(value, state, options); if (coerced.errors) { value = coerced.value; errors = errors.concat(coerced.errors); - return finish(); // Coerced error always aborts early + return this._finalizeValue(value, originalValue, errors, state, options); // Coerced error always aborts early } value = coerced.value; @@ -1627,7 +1372,7 @@ module.exports = internals.Any = class { value = {}; } else { - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } } } @@ -1635,40 +1380,44 @@ module.exports = internals.Any = class { value === undefined) { errors.push(this.createError('any.required', null, state, options)); - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } else if (presence === 'forbidden') { if (value === undefined) { - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } errors.push(this.createError('any.unknown', null, state, options)); - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } // Check allowed and denied values using the original value - if (this._valids.has(value, state, options, this._flags.insensitive)) { - return finish(); + let match = this._valids.get(value, state, options, this._flags.insensitive); + if (match) { + if (options.convert) { + value = match.value; + } + + return this._finalizeValue(value, originalValue, errors, state, options); } if (this._invalids.has(value, state, options, this._flags.insensitive)) { errors.push(this.createError(value === '' ? 'any.empty' : 'any.invalid', { value, invalids: this._invalids.values({ stripUndefined: true }) }, state, options)); - if (options.abortEarly || - value === undefined) { // No reason to keep validating missing value + if (options.abortEarly) { - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } } // Convert value and validate type if (this._base) { - const base = this._base.call(this, value, state, options); + const base = this._base(value, state, options); if (base.errors) { value = base.value; errors = errors.concat(base.errors); - return finish(); // Base error always aborts early + return this._finalizeValue(value, originalValue, errors, state, options); // Base error always aborts early } if (base.value !== value) { @@ -1676,14 +1425,16 @@ module.exports = internals.Any = class { // Check allowed and denied values using the converted value - if (this._valids.has(value, state, options, this._flags.insensitive)) { - return finish(); + match = this._valids.get(value, state, options, this._flags.insensitive); + if (match) { + value = match.value; + return this._finalizeValue(value, originalValue, errors, state, options); } if (this._invalids.has(value, state, options, this._flags.insensitive)) { errors.push(this.createError(value === '' ? 'any.empty' : 'any.invalid', { value, invalids: this._invalids.values({ stripUndefined: true }) }, state, options)); if (options.abortEarly) { - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } } } @@ -1694,7 +1445,7 @@ module.exports = internals.Any = class { if (this._flags.allowOnly) { errors.push(this.createError('any.allowOnly', { value, valids: this._valids.values({ stripUndefined: true }) }, state, options)); if (options.abortEarly) { - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } } @@ -1706,7 +1457,7 @@ module.exports = internals.Any = class { if (ret instanceof Errors.Err) { errors.push(ret); if (options.abortEarly) { - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); } } else { @@ -1714,7 +1465,71 @@ module.exports = internals.Any = class { } } - return finish(); + return this._finalizeValue(value, originalValue, errors, state, options); + } + + _finalizeValue(value, originalValue, errors, state, options) { + + let finalValue; + + if (value !== undefined) { + finalValue = this._flags.raw ? originalValue : value; + } + else if (options.noDefaults) { + finalValue = value; + } + else if (Ref.isRef(this._flags.default)) { + finalValue = this._flags.default(state.parent, options); + } + else if (typeof this._flags.default === 'function' && + !(this._flags.func && !this._flags.default.description)) { + + let args; + + if (state.parent !== null && + this._flags.default.length > 0) { + + args = [Hoek.clone(state.parent), options]; + } + + const defaultValue = internals._try(this._flags.default, args); + finalValue = defaultValue.value; + if (defaultValue.error) { + errors.push(this.createError('any.default', { error: defaultValue.error }, state, options)); + } + } + else { + finalValue = Hoek.clone(this._flags.default); + } + + if (errors.length && + typeof this._flags.error === 'function' && + ( + !this._flags.selfError || + errors.some((e) => state.path.length === e.path.length) + ) + ) { + const change = this._flags.error.call(this, errors); + + if (typeof change === 'string') { + errors = [this.createOverrideError('override', { reason: errors }, state, options, change)]; + } + else { + errors = [].concat(change) + .map((err) => { + + return err instanceof Error ? + err : + this.createOverrideError(err.type || 'override', err.context, state, options, err.message, err.template); + }); + } + } + + return { + value: this._flags.strip ? undefined : finalValue, + finalValue, + errors: errors.length ? errors : null + }; } _validateWithOptions(value, options, callback) { @@ -1923,13 +1738,13 @@ internals.Any.prototype.disallow = internals.Any.prototype.not = internals.Any.p internals.Any.prototype.exist = internals.Any.prototype.required; -internals._try = function (fn, args) { +internals._try = function (fn, args = []) { let err; let result; try { - result = fn.apply(null, args); + result = fn(...args); } catch (e) { err = e; @@ -2075,12 +1890,6 @@ exports.ref = function (id) { /***/ }), /* 4 */ -/***/ (function(module, exports) { - -module.exports = require("util"); - -/***/ }), -/* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2089,7 +1898,7 @@ module.exports = require("util"); // Load modules const Hoek = __webpack_require__(0); -const Language = __webpack_require__(17); +const Language = __webpack_require__(20); // Declare internals @@ -2188,10 +1997,11 @@ exports.Err = class { if (wrapArrays) { return childrenString.slice(1, -1); } + return childrenString; } - const hasKey = /\{\{\!?label\}\}/.test(format); + const hasKey = /{{!?label}}/.test(format); const skipKey = format.length > 2 && format[0] === '!' && format[1] === '!'; if (skipKey) { @@ -2208,12 +2018,16 @@ exports.Err = class { } } - return format.replace(/\{\{(\!?)([^}]+)\}\}/g, ($0, isSecure, name) => { + const message = format.replace(/{{(!?)([^}]+)}}/g, ($0, isSecure, name) => { const value = Hoek.reach(this.context, name); const normalized = internals.stringify(value, wrapArrays); return (isSecure && this.options.escapeHtml ? Hoek.escapeHtml(normalized) : normalized); }); + + this.toString = () => message; // Persist result of last toString call, it won't change + + return message; } }; @@ -2227,7 +2041,7 @@ exports.create = function (type, context, state, options, flags, message, templa exports.process = function (errors, object) { - if (!errors || !errors.length) { + if (!errors) { return null; } @@ -2236,7 +2050,7 @@ exports.process = function (errors, object) { let message = ''; const details = []; - const processErrors = function (localErrors, parent) { + const processErrors = function (localErrors, parent, overrideMessage) { for (let i = 0; i < localErrors.length; ++i) { const item = localErrors[i]; @@ -2246,7 +2060,9 @@ exports.process = function (errors, object) { } if (item.flags.error && typeof item.flags.error !== 'function') { - return item.flags.error; + if (!item.flags.selfError || !item.context.reason) { + return item.flags.error; + } } let itemMessage; @@ -2257,15 +2073,15 @@ exports.process = function (errors, object) { // Do not push intermediate errors, we're only interested in leafs - if (item.context.reason && item.context.reason.length) { - const override = processErrors(item.context.reason, item.path); + if (item.context.reason) { + const override = processErrors(item.context.reason, item.path, item.type === 'override' ? item.message : null); if (override) { return override; } } else { details.push({ - message: itemMessage || item.toString(), + message: overrideMessage || itemMessage || item.toString(), path: item.path, type: item.type, context: item.context @@ -2341,6 +2157,7 @@ internals.serializer = function () { if (annotations.errors[i]) { annotated.push(`_$idx$_${annotations.errors[i].sort().join(', ')}_$end$_`); } + annotated.push(value[i]); } @@ -2424,10 +2241,10 @@ internals.annotate = function (stripColorCodes) { } const replacers = { - key: /_\$key\$_([, \d]+)_\$end\$_\"/g, - missing: /\"_\$miss\$_([^\|]+)\|(\d+)_\$end\$_\"\: \"__missing__\"/g, - arrayIndex: /\s*\"_\$idx\$_([, \d]+)_\$end\$_\",?\n(.*)/g, - specials: /"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)\]"/g + key: /_\$key\$_([, \d]+)_\$end\$_"/g, + missing: /"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g, + arrayIndex: /\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g, + specials: /"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g }; let message = internals.safeStringify(obj, 2) @@ -2449,6 +2266,24 @@ internals.annotate = function (stripColorCodes) { }; +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = class { + constructor(key, path, parent, reference) { + + this.key = key; + this.path = path; + this.parent = parent; + this.reference = reference; + } +}; + + /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { @@ -2461,8 +2296,8 @@ internals.annotate = function (stripColorCodes) { const Hoek = __webpack_require__(0); const Any = __webpack_require__(1); const Cast = __webpack_require__(3); -const Errors = __webpack_require__(5); -const Lazy = __webpack_require__(19); +const Errors = __webpack_require__(4); +const Lazy = __webpack_require__(22); const Ref = __webpack_require__(2); const Settings = __webpack_require__(7); @@ -2470,16 +2305,16 @@ const Settings = __webpack_require__(7); // Declare internals const internals = { - alternatives: __webpack_require__(9), - array: __webpack_require__(20), - boolean: __webpack_require__(21), - binary: __webpack_require__(22), - date: __webpack_require__(10), - func: __webpack_require__(23), - number: __webpack_require__(25), - object: __webpack_require__(11), - string: __webpack_require__(26), - symbol: __webpack_require__(32) + alternatives: __webpack_require__(10), + array: __webpack_require__(23), + boolean: __webpack_require__(24), + binary: __webpack_require__(25), + date: __webpack_require__(11), + func: __webpack_require__(26), + number: __webpack_require__(28), + object: __webpack_require__(12), + string: __webpack_require__(29), + symbol: __webpack_require__(35) }; internals.callWithDefaults = function (schema, args) { @@ -2502,6 +2337,7 @@ internals.root = function () { const root = any.clone(); Any.prototype._currentJoi = root; root._currentJoi = root; + root._binds = new Set(['any', 'alternatives', 'alt', 'array', 'boolean', 'binary', 'date', 'func', 'number', 'object', 'string', 'symbol', 'validate', 'describe', 'compile', 'assert', 'attempt', 'lazy', 'defaults', 'extend', 'allow', 'valid', 'only', 'equal', 'invalid', 'disallow', 'not', 'required', 'exist', 'optional', 'forbidden', 'strip', 'when', 'empty', 'default']); root.any = function (...args) { @@ -2597,14 +2433,14 @@ internals.root = function () { } const options = count === 2 ? args[1] : undefined; - const schema = root.compile(args[0]); + const schema = this.compile(args[0]); return schema._validateWithOptions(value, options, callback); }; root.describe = function (...args) { - const schema = args.length ? root.compile(args[0]) : any; + const schema = args.length ? this.compile(args[0]) : any; return schema.describe(); }; @@ -2617,24 +2453,26 @@ internals.root = function () { if (err.hasOwnProperty('path')) { err.message = err.message + '(' + err.path + ')'; } + throw err; } }; root.assert = function (value, schema, message) { - root.attempt(value, schema, message); + this.attempt(value, schema, message); }; root.attempt = function (value, schema, message) { - const result = root.validate(value, schema); + const result = this.validate(value, schema); const error = result.error; if (error) { if (!message) { if (typeof error.annotate === 'function') { error.message = error.annotate(); } + throw error; } @@ -2642,6 +2480,7 @@ internals.root = function () { if (typeof error.annotate === 'function') { error.message = `${message} ${error.annotate()}`; } + throw error; } @@ -2681,9 +2520,9 @@ internals.root = function () { return reach(schema, schemaPath); }; - root.lazy = function (fn) { + root.lazy = function (...args) { - return Lazy.set(fn); + return internals.callWithDefaults.call(this, Lazy, args); }; root.defaults = function (fn) { @@ -2712,6 +2551,18 @@ internals.root = function () { return joi; }; + root.bind = function () { + + const joi = Object.create(this); + + joi._binds.forEach((bind) => { + + joi[bind] = joi[bind].bind(joi); + }); + + return joi; + }; + root.extend = function (...args) { const extensions = Hoek.flatten(args); @@ -2721,6 +2572,8 @@ internals.root = function () { const joi = Object.create(this.any()); Object.assign(joi, this); + joi._currentJoi = joi; + joi._binds = new Set(joi._binds); for (let i = 0; i < extensions.length; ++i) { let extension = extensions[i]; @@ -2776,6 +2629,7 @@ internals.root = function () { return { value: ret }; }; } + if (extension.pre) { type.prototype._base = function (value, state, options) { @@ -2868,6 +2722,8 @@ internals.root = function () { return internals.callWithDefaults.call(this, instance, extArgs); }; + + joi._binds.add(extension.name); } return joi; @@ -2894,7 +2750,7 @@ internals.root = function () { root.extensionsSchema = internals.array.items([internals.object, internals.func.arity(1)]).strict(); - root.version = __webpack_require__(33).version; + root.version = __webpack_require__(36).version; return root; }; @@ -2914,6 +2770,8 @@ module.exports = internals.root(); const Hoek = __webpack_require__(0); +const Symbols = __webpack_require__(8); + // Declare internals @@ -2928,17 +2786,16 @@ exports.concat = function (target, source) { const obj = Object.assign({}, target); - const sKeys = Object.keys(source); - for (let i = 0; i < sKeys.length; ++i) { - const key = sKeys[i]; - if (key !== 'language' || - !obj.hasOwnProperty(key)) { + const language = source.language; - obj[key] = source[key]; - } - else { - obj[key] = Hoek.applyToDefaults(obj[key], source[key]); - } + Object.assign(obj, source); + + if (language && target && target.language) { + obj.language = Hoek.applyToDefaults(target.language, language); + } + + if (obj[Symbols.settingsCache]) { + delete obj[Symbols.settingsCache]; } return obj; @@ -2952,6 +2809,18 @@ exports.concat = function (target, source) { "use strict"; +module.exports = { + settingsCache: Symbol('settingsCache') +}; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + const Ref = __webpack_require__(2); @@ -2969,6 +2838,7 @@ internals.extendedCheckForValue = function (value, insensitive) { return item instanceof Date && value.getTime() === item.getTime(); }; } + if (Buffer.isBuffer(value)) { return (item) => { @@ -3036,13 +2906,18 @@ module.exports = class InternalSet { has(value, state, options, insensitive) { + return !!this.get(value, state, options, insensitive); + } + + get(value, state, options, insensitive) { + if (!this._set.size) { return false; } const hasValue = this._set.has(value); if (hasValue) { - return hasValue; + return { value }; } const extendedCheck = internals.extendedCheckForValue(value, insensitive); @@ -3050,9 +2925,10 @@ module.exports = class InternalSet { if (state && this._hasRef) { for (let item of this._set) { if (Ref.isRef(item)) { - item = item(state.reference || state.parent, options); - if (value === item || (Array.isArray(item) && item.includes(value))) { - return true; + item = [].concat(item(state.reference || state.parent, options)); + const found = item.indexOf(value); + if (found >= 0) { + return { value: item[found] }; } } } @@ -3082,15 +2958,21 @@ module.exports = class InternalSet { item = item(state.reference || state.parent, options); if (Array.isArray(item)) { - if (item.find(isReallyEqual)) { - return true; + const found = item.findIndex(isReallyEqual); + if (found >= 0) { + return { + value: item[found] + }; } + continue; } } if (isReallyEqual(item)) { - return true; + return { + value: item + }; } } @@ -3131,7 +3013,7 @@ module.exports = class InternalSet { /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3167,7 +3049,7 @@ internals.Alternatives = class extends Any { _base(value, state, options) { - let errors = []; + const errors = []; const il = this._inner.matches.length; const baseType = this._baseType; @@ -3199,7 +3081,7 @@ internals.Alternatives = class extends Any { return result; } - errors = errors.concat(result.errors); + errors.push(...result.errors); } if (errors.length) { @@ -3219,8 +3101,9 @@ internals.Alternatives = class extends Any { for (let i = 0; i < schemas.length; ++i) { const cast = Cast.schema(this._currentJoi, schemas[i]); if (cast._refs.length) { - obj._refs = obj._refs.concat(cast._refs); + obj._refs.push(...cast._refs); } + obj._inner.matches.push({ schema: cast }); } @@ -3239,6 +3122,7 @@ internals.Alternatives = class extends Any { else { Hoek.assert(options.hasOwnProperty('is'), 'Missing "is" directive'); } + Hoek.assert(options.then !== undefined || options.otherwise !== undefined, 'options must have at least one of "then" or "otherwise"'); const obj = this.clone(); @@ -3269,19 +3153,42 @@ internals.Alternatives = class extends Any { if (!schemaCondition) { Ref.push(obj._refs, item.ref); - obj._refs = obj._refs.concat(item.is._refs); + obj._refs.push(...item.is._refs); + } + + if (item.then && item.then._refs.length) { + obj._refs.push(...item.then._refs); + } + + if (item.otherwise && item.otherwise._refs.length) { + obj._refs.push(...item.otherwise._refs); } - if (item.then && item.then._refs) { - obj._refs = obj._refs.concat(item.then._refs); - } + obj._inner.matches.push(item); + + return obj; + } + + label(name) { + + const obj = super.label(name); + obj._inner.matches = obj._inner.matches.map((match) => { - if (item.otherwise && item.otherwise._refs) { - obj._refs = obj._refs.concat(item.otherwise._refs); - } + if (match.schema) { + return { schema: match.schema.label(name) }; + } - obj._inner.matches.push(item); + match = Object.assign({}, match); + if (match.then) { + match.then = match.then.label(name); + } + + if (match.otherwise) { + match.otherwise = match.otherwise.label(name); + } + return match; + }); return obj; } @@ -3331,7 +3238,7 @@ module.exports = new internals.Alternatives(); /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3378,7 +3285,7 @@ internals.Date = class extends Any { result.errors = null; } else if (!options.convert) { - result.errors = this.createError('date.strict', null, state, options); + result.errors = this.createError('date.strict', { value }, state, options); } else { let type; @@ -3392,7 +3299,7 @@ internals.Date = class extends Any { type = 'base'; } - result.errors = this.createError(`date.${type}`, null, state, options); + result.errors = this.createError(`date.${type}`, { value }, state, options); } return result; @@ -3407,17 +3314,19 @@ internals.Date = class extends Any { if (typeof value === 'string' || (typeof value === 'number' && !isNaN(value) && isFinite(value))) { - if (typeof value === 'string' && + const isIsoDate = format && internals.isIsoDate(format); + if (!isIsoDate && + typeof value === 'string' && /^[+-]?\d+(\.\d+)?$/.test(value)) { value = parseFloat(value); } let date; - if (format && internals.isIsoDate(format)) { - date = format.test(value) ? new Date(value) : internals.invalidDate; + if (isIsoDate) { + date = format.test(value) ? new Date(value.toString()) : internals.invalidDate; } - else if (timestamp && multiplier) { + else if (timestamp) { date = /^\s*$/.test(value) ? internals.invalidDate : new Date(value * multiplier); } else { @@ -3485,10 +3394,11 @@ internals.compare = function (type, compare) { compareTo = Date.now(); } else if (isRef) { - compareTo = internals.Date.toDate(date(state.reference || state.parent, options)); + const refValue = date(state.reference || state.parent, options); + compareTo = internals.Date.toDate(refValue); if (!compareTo) { - return this.createError('date.ref', { ref: date.key }, state, options); + return this.createError('date.ref', { ref: date, value: refValue }, state, options); } compareTo = compareTo.getTime(); @@ -3501,7 +3411,7 @@ internals.compare = function (type, compare) { return value; } - return this.createError('date.' + type, { limit: new Date(compareTo) }, state, options); + return this.createError('date.' + type, { limit: new Date(compareTo), value }, state, options); }); }; }; @@ -3517,7 +3427,7 @@ module.exports = new internals.Date(); /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3526,10 +3436,11 @@ module.exports = new internals.Date(); // Load modules const Hoek = __webpack_require__(0); -const Topo = __webpack_require__(24); +const Topo = __webpack_require__(27); const Any = __webpack_require__(1); -const Errors = __webpack_require__(5); +const Errors = __webpack_require__(4); const Cast = __webpack_require__(3); +const State = __webpack_require__(5); // Declare internals @@ -3577,7 +3488,7 @@ internals.Object = class extends Any { typeof value !== type || Array.isArray(value)) { - errors.push(this.createError(type + '.base', null, state, options)); + errors.push(this.createError(type + '.base', { value }, state, options)); return finish(); } @@ -3731,7 +3642,7 @@ internals.Object = class extends Any { unprocessed.delete(key); - const localState = { key, path: state.path.concat(key), parent: target, reference: state.reference }; + const localState = new State(key, [...state.path, key], target, state.reference); const result = child.schema._validate(item, localState, options); if (result.errors) { errors.push(this.createError('object.child', { key, child: child.schema._getLabel(key), reason: result.errors }, localState, options)); @@ -3761,12 +3672,7 @@ internals.Object = class extends Any { if (unprocessed.size && this._inner.patterns.length) { for (const key of unprocessed) { - const localState = { - key, - path: state.path.concat(key), - parent: target, - reference: state.reference - }; + const localState = new State(key, [...state.path, key], target, state.reference); const item = target[key]; for (let i = 0; i < this._inner.patterns.length; ++i) { @@ -3820,9 +3726,9 @@ internals.Object = class extends Any { if ((this._flags.allowUnknown !== undefined ? !this._flags.allowUnknown : !options.allowUnknown)) { for (const unprocessedKey of unprocessed) { - errors.push(this.createError('object.allowUnknown', { child: unprocessedKey }, { + errors.push(this.createError('object.allowUnknown', { child: unprocessedKey, value: target[unprocessedKey] }, { key: unprocessedKey, - path: state.path.concat(unprocessedKey) + path: [...state.path, unprocessedKey] }, options, {})); } } @@ -3832,7 +3738,10 @@ internals.Object = class extends Any { for (let i = 0; i < this._inner.dependencies.length; ++i) { const dep = this._inner.dependencies[i]; - const err = internals[dep.type].call(this, dep.key !== null && target[dep.key], dep.peers, target, { key: dep.key, path: dep.key === null ? state.path : state.path.concat(dep.key) }, options); + const hasKey = dep.key !== null; + const splitKey = hasKey && dep.key.split('.'); + const localState = hasKey ? new State(splitKey[splitKey.length - 1], [...state.path, ...splitKey]) : new State(null, state.path); + const err = internals[dep.type].call(this, dep.key, hasKey && Hoek.reach(target, dep.key, { functions: true }), dep.peers, target, localState, options); if (err instanceof Errors.Err) { errors.push(err); if (options.abortEarly) { @@ -3889,6 +3798,7 @@ internals.Object = class extends Any { else { castErr.path = key; } + throw castErr; } } @@ -3930,7 +3840,7 @@ internals.Object = class extends Any { return value; } - return this.createError('object.length', { limit }, state, options); + return this.createError('object.length', { limit, value }, state, options); }); } @@ -3944,7 +3854,7 @@ internals.Object = class extends Any { return value; } - return this.createError('object.min', { limit }, state, options); + return this.createError('object.min', { limit, value }, state, options); }); } @@ -3958,7 +3868,7 @@ internals.Object = class extends Any { return value; } - return this.createError('object.max', { limit }, state, options); + return this.createError('object.max', { limit, value }, state, options); }); } @@ -3969,7 +3879,7 @@ internals.Object = class extends Any { Hoek.assert(schema !== undefined, 'Invalid rule'); if (isRegExp) { - pattern = new RegExp(pattern.source, pattern.ignoreCase ? 'i' : undefined); // Future version should break this and forbid unsupported regex flags + Hoek.assert(!pattern.flags.includes('g') && !pattern.flags.includes('y'), 'pattern should not use global or sticky mode'); } try { @@ -3977,7 +3887,7 @@ internals.Object = class extends Any { } catch (castErr) { if (castErr.hasOwnProperty('path')) { - castErr.message = castErr.message + '(' + castErr.path + ')'; + castErr.message = `${castErr.message}(${castErr.path})`; } throw castErr; @@ -3990,6 +3900,7 @@ internals.Object = class extends Any { else { obj._inner.patterns.push({ schema: pattern, rule: schema }); } + return obj; } @@ -4025,6 +3936,11 @@ internals.Object = class extends Any { return this._dependency('xor', null, peers); } + oxor(...peers) { + + return this._dependency('oxor', null, peers); + } + or(...peers) { peers = Hoek.flatten(peers); @@ -4083,7 +3999,7 @@ internals.Object = class extends Any { return obj; } - applyFunctionToChildren(children, fn, args, root) { + applyFunctionToChildren(children, fn, args = [], root) { children = [].concat(children); Hoek.assert(children.length > 0, 'expected at least one children'); @@ -4092,7 +4008,7 @@ internals.Object = class extends Any { let obj; if ('' in groupedChildren) { - obj = this[fn].apply(this, args); + obj = this[fn](...args); delete groupedChildren['']; } else { @@ -4196,13 +4112,14 @@ internals.Object = class extends Any { ref = Cast.ref(ref); Hoek.assert(ref.isContext || ref.depth > 1, 'Cannot use assertions for root level references - use direct key rules instead'); message = message || 'pass the assertion test'; + Hoek.assert(typeof message === 'string', 'Message must be a string'); try { schema = Cast.schema(this._currentJoi, schema); } catch (castErr) { if (castErr.hasOwnProperty('path')) { - castErr.message = castErr.message + '(' + castErr.path + ')'; + castErr.message = `${castErr.message}(${castErr.path})`; } throw castErr; @@ -4218,9 +4135,7 @@ internals.Object = class extends Any { return value; } - const localState = Hoek.merge({}, state); - localState.key = key; - localState.path = ref.path; + const localState = new State(key, ref.path, state.parent, state.reference); return this.createError('object.assert', { ref: path, message }, localState, options); }); } @@ -4239,7 +4154,7 @@ internals.Object = class extends Any { return value; } - return this.createError('object.type', { type: typeData.name }, state, options); + return this.createError('object.type', { type: typeData.name, value }, state, options); }); } }; @@ -4290,8 +4205,8 @@ internals.keysToLabels = function (schema, keys) { const findLabel = function (key) { - const matchingChild = children.find((child) => child.key === key); - return matchingChild ? matchingChild.schema._getLabel(key) : key; + const matchingChild = schema._currentJoi.reach(schema, key); + return matchingChild ? matchingChild._getLabel(key) : key; }; if (Array.isArray(keys)) { @@ -4302,68 +4217,64 @@ internals.keysToLabels = function (schema, keys) { }; -internals.with = function (value, peers, parent, state, options) { +internals.with = function (key, value, peers, parent, state, options) { if (value === undefined) { - return value; + return; } for (let i = 0; i < peers.length; ++i) { + const peer = peers[i]; - if (!Object.prototype.hasOwnProperty.call(parent, peer) || - parent[peer] === undefined) { + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist === undefined) { return this.createError('object.with', { - main: state.key, - mainWithLabel: internals.keysToLabels(this, state.key), + main: key, + mainWithLabel: internals.keysToLabels(this, key), peer, peerWithLabel: internals.keysToLabels(this, peer) }, state, options); } } - - return value; }; -internals.without = function (value, peers, parent, state, options) { +internals.without = function (key, value, peers, parent, state, options) { if (value === undefined) { - return value; + return; } for (let i = 0; i < peers.length; ++i) { const peer = peers[i]; - if (Object.prototype.hasOwnProperty.call(parent, peer) && - parent[peer] !== undefined) { + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist !== undefined) { return this.createError('object.without', { - main: state.key, - mainWithLabel: internals.keysToLabels(this, state.key), + main: key, + mainWithLabel: internals.keysToLabels(this, key), peer, peerWithLabel: internals.keysToLabels(this, peer) }, state, options); } } - - return value; }; -internals.xor = function (value, peers, parent, state, options) { +internals.xor = function (key, value, peers, parent, state, options) { const present = []; for (let i = 0; i < peers.length; ++i) { const peer = peers[i]; - if (Object.prototype.hasOwnProperty.call(parent, peer) && - parent[peer] !== undefined) { - + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist !== undefined) { present.push(peer); } } if (present.length === 1) { - return value; + return; } const context = { peers, peersWithLabels: internals.keysToLabels(this, peers) }; @@ -4372,17 +4283,45 @@ internals.xor = function (value, peers, parent, state, options) { return this.createError('object.missing', context, state, options); } + context.present = present; + context.presentWithLabels = internals.keysToLabels(this, present); + return this.createError('object.xor', context, state, options); }; -internals.or = function (value, peers, parent, state, options) { +internals.oxor = function (key, value, peers, parent, state, options) { + const present = []; for (let i = 0; i < peers.length; ++i) { const peer = peers[i]; - if (Object.prototype.hasOwnProperty.call(parent, peer) && - parent[peer] !== undefined) { - return value; + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist !== undefined) { + present.push(peer); + } + } + + if (!present.length || + present.length === 1) { + + return; + } + + const context = { peers, peersWithLabels: internals.keysToLabels(this, peers) }; + context.present = present; + context.presentWithLabels = internals.keysToLabels(this, present); + + return this.createError('object.oxor', context, state, options); +}; + + +internals.or = function (key, value, peers, parent, state, options) { + + for (let i = 0; i < peers.length; ++i) { + const peer = peers[i]; + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist !== undefined) { + return; } } @@ -4393,15 +4332,15 @@ internals.or = function (value, peers, parent, state, options) { }; -internals.and = function (value, peers, parent, state, options) { +internals.and = function (key, value, peers, parent, state, options) { const missing = []; const present = []; const count = peers.length; for (let i = 0; i < count; ++i) { const peer = peers[i]; - if (!Object.prototype.hasOwnProperty.call(parent, peer) || - parent[peer] === undefined) { + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist === undefined) { missing.push(peer); } @@ -4424,20 +4363,20 @@ internals.and = function (value, peers, parent, state, options) { }; -internals.nand = function (value, peers, parent, state, options) { +internals.nand = function (key, value, peers, parent, state, options) { const present = []; for (let i = 0; i < peers.length; ++i) { const peer = peers[i]; - if (Object.prototype.hasOwnProperty.call(parent, peer) && - parent[peer] !== undefined) { + const keysExist = Hoek.reach(parent, peer, { functions: true }); + if (keysExist !== undefined) { present.push(peer); } } - const values = Hoek.clone(peers); - const main = values.splice(0, 1)[0]; + const main = peers[0]; + const values = peers.slice(1); const allPresent = (present.length === peers.length); return allPresent ? this.createError('object.nand', { main, @@ -4452,7 +4391,7 @@ module.exports = new internals.Object(); /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4678,57 +4617,361 @@ module.exports = internals.rfc3986; /***/ }), -/* 13 */ +/* 14 */ +/***/ (function(module, exports) { + +module.exports = require("util"); + +/***/ }), +/* 15 */ /***/ (function(module, exports) { module.exports = require("assert"); /***/ }), -/* 14 */ +/* 16 */ /***/ (function(module, exports) { module.exports = require("crypto"); /***/ }), -/* 15 */ +/* 17 */ /***/ (function(module, exports) { module.exports = require("path"); /***/ }), -/* 16 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +// Load modules + + // Declare internals -const internals = {}; +const internals = { + arrayType: Symbol('array'), + bufferType: Symbol('buffer'), + dateType: Symbol('date'), + errorType: Symbol('error'), + genericType: Symbol('generic'), + mapType: Symbol('map'), + regexType: Symbol('regex'), + setType: Symbol('set'), + weakMapType: Symbol('weak-map'), + weakSetType: Symbol('weak-set'), + mismatched: Symbol('mismatched') +}; -exports.escapeJavaScript = function (input) { +internals.typeMap = { + '[object Array]': internals.arrayType, + '[object Date]': internals.dateType, + '[object Error]': internals.errorType, + '[object Map]': internals.mapType, + '[object RegExp]': internals.regexType, + '[object Set]': internals.setType, + '[object WeakMap]': internals.weakMapType, + '[object WeakSet]': internals.weakSetType +}; - if (!input) { - return ''; + +internals.SeenEntry = class { + + constructor(obj, ref) { + + this.obj = obj; + this.ref = ref; } - let escaped = ''; + isSame(obj, ref) { - for (let i = 0; i < input.length; ++i) { + return this.obj === obj && this.ref === ref; + } +}; - const charCode = input.charCodeAt(i); - if (internals.isSafe(charCode)) { - escaped += input[i]; +internals.getInternalType = function (obj) { + + const { typeMap, bufferType, genericType } = internals; + + if (obj instanceof Buffer) { + return bufferType; + } + + const objName = Object.prototype.toString.call(obj); + return typeMap[objName] || genericType; +}; + + +internals.getSharedType = function (obj, ref, checkPrototype) { + + if (checkPrototype) { + if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) { + return internals.mismatched; + } + + return internals.getInternalType(obj); + } + + const type = internals.getInternalType(obj); + if (type !== internals.getInternalType(ref)) { + return internals.mismatched; + } + + return type; +}; + + +internals.valueOf = function (obj) { + + const objValueOf = obj.valueOf; + if (objValueOf === undefined) { + return obj; + } + + try { + return objValueOf.call(obj); + } + catch (err) { + return err; + } +}; + + +internals.hasOwnEnumerableProperty = function (obj, key) { + + return Object.prototype.propertyIsEnumerable.call(obj, key); +}; + + +internals.isSetSimpleEqual = function (obj, ref) { + + for (const entry of obj) { + if (!ref.has(entry)) { + return false; + } + } + + return true; +}; + + +internals.isDeepEqualObj = function (instanceType, obj, ref, options, seen) { + + const { isDeepEqual, valueOf, hasOwnEnumerableProperty } = internals; + const { keys, getOwnPropertySymbols } = Object; + + if (instanceType === internals.arrayType) { + if (options.part) { + // Check if any index match any other index + + for (let i = 0; i < obj.length; ++i) { + const objValue = obj[i]; + for (let j = 0; j < ref.length; ++j) { + if (isDeepEqual(objValue, ref[j], options, seen)) { + return true; + } + } + } } else { - escaped += internals.escapeJavaScriptChar(charCode); + if (obj.length !== ref.length) { + return false; + } + + for (let i = 0; i < obj.length; ++i) { + if (!isDeepEqual(obj[i], ref[i], options, seen)) { + return false; + } + } + + return true; + } + } + else if (instanceType === internals.setType) { + if (obj.size !== ref.size) { + return false; + } + + if (!internals.isSetSimpleEqual(obj, ref)) { + + // Check for deep equality + + const ref2 = new Set(ref); + for (const objEntry of obj) { + if (ref2.delete(objEntry)) { + continue; + } + + let found = false; + for (const refEntry of ref2) { + if (isDeepEqual(objEntry, refEntry, options, seen)) { + ref2.delete(refEntry); + found = true; + break; + } + } + + if (!found) { + return false; + } + } + } + } + else if (instanceType === internals.mapType) { + if (obj.size !== ref.size) { + return false; + } + + for (const [key, value] of obj) { + if (value === undefined && !ref.has(key)) { + return false; + } + + if (!isDeepEqual(value, ref.get(key), options, seen)) { + return false; + } + } + } + else if (instanceType === internals.errorType) { + // Always check name and message + + if (obj.name !== ref.name || obj.message !== ref.message) { + return false; + } + } + + // Check .valueOf() + + const valueOfObj = valueOf(obj); + const valueOfRef = valueOf(ref); + if (!(obj === valueOfObj && ref === valueOfRef) && + !isDeepEqual(valueOfObj, valueOfRef, options, seen)) { + return false; + } + + // Check properties + + const objKeys = keys(obj); + if (!options.part && objKeys.length !== keys(ref).length) { + return false; + } + + for (let i = 0; i < objKeys.length; ++i) { + const key = objKeys[i]; + + if (!hasOwnEnumerableProperty(ref, key)) { + return false; + } + + if (!isDeepEqual(obj[key], ref[key], options, seen)) { + return false; } } - return escaped; -}; + // Check symbols + + if (options.symbols) { + const objSymbols = getOwnPropertySymbols(obj); + const refSymbols = new Set(getOwnPropertySymbols(ref)); + + for (let i = 0; i < objSymbols.length; ++i) { + const key = objSymbols[i]; + + if (hasOwnEnumerableProperty(obj, key)) { + if (!hasOwnEnumerableProperty(ref, key)) { + return false; + } + + if (!isDeepEqual(obj[key], ref[key], options, seen)) { + return false; + } + } + else if (hasOwnEnumerableProperty(ref, key)) { + return false; + } + + refSymbols.delete(key); + } + + for (const key of refSymbols) { + if (hasOwnEnumerableProperty(ref, key)) { + return false; + } + } + } + + return true; +}; + + +internals.isDeepEqual = function (obj, ref, options, seen) { + + if (obj === ref) { // Copied from Deep-eql, copyright(c) 2013 Jake Luer, jake@alogicalparadox.com, MIT Licensed, https://github.com/chaijs/deep-eql + return obj !== 0 || 1 / obj === 1 / ref; + } + + const type = typeof obj; + + if (type !== typeof ref) { + return false; + } + + if (type !== 'object' || + obj === null || + ref === null) { + + return obj !== obj && ref !== ref; // NaN + } + + const instanceType = internals.getSharedType(obj, ref, !!options.prototype); + switch (instanceType) { + case internals.bufferType: + return Buffer.prototype.equals.call(obj, ref); + case internals.regexType: + return obj.toString() === ref.toString(); + case internals.mismatched: + return false; + } + + for (let i = seen.length - 1; i >= 0; --i) { + if (seen[i].isSame(obj, ref)) { + return true; // If previous comparison failed, it would have stopped execution + } + } + + seen.push(new internals.SeenEntry(obj, ref)); + try { + return !!internals.isDeepEqualObj(instanceType, obj, ref, options, seen); + } + finally { + seen.pop(); + } +}; + + +module.exports = function (obj, ref, options) { + + options = options || { prototype: true }; + + return !!internals.isDeepEqual(obj, ref, options, []); +}; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +// Declare internals + +const internals = {}; exports.escapeHtml = function (input) { @@ -4775,31 +5018,24 @@ exports.escapeJson = function (input) { if (charCode === lessThan) { return '\\u003c'; } - else if (charCode === greaterThan) { + + if (charCode === greaterThan) { return '\\u003e'; } - else if (charCode === andSymbol) { + + if (charCode === andSymbol) { return '\\u0026'; } - else if (charCode === lineSeperator) { + + if (charCode === lineSeperator) { return '\\u2028'; } + return '\\u2029'; }); }; -internals.escapeJavaScriptChar = function (charCode) { - - if (charCode >= 256) { - return '\\u' + internals.padLeft('' + charCode, 4); - } - - const hexValue = Buffer.from(String.fromCharCode(charCode), 'ascii').toString('hex'); - return '\\x' + internals.padLeft(hexValue, 2); -}; - - internals.escapeHtmlChar = function (charCode) { const namedEscape = internals.namedHtml[charCode]; @@ -4812,17 +5048,7 @@ internals.escapeHtmlChar = function (charCode) { } const hexValue = Buffer.from(String.fromCharCode(charCode), 'ascii').toString('hex'); - return '&#x' + internals.padLeft(hexValue, 2) + ';'; -}; - - -internals.padLeft = function (str, len) { - - while (str.length < len) { - str = '0' + str; - } - - return str; + return `&#x${hexValue};`; }; @@ -4871,7 +5097,7 @@ internals.safeCharCodes = (function () { /***/ }), -/* 17 */ +/* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4914,6 +5140,8 @@ exports.errors = { includesRequiredBoth: 'does not contain {{knownMisses}} and {{unknownMisses}} other required value(s)', excludes: 'at position {{pos}} contains an excluded value', excludesSingle: 'single value of "{{!label}}" contains an excluded value', + hasKnown: 'does not contain at least one required match for type "{{!patternLabel}}"', + hasUnknown: 'does not contain at least one required match', min: 'must contain at least {{limit}} items', max: 'must contain less than or equal to {{limit}} items', length: 'must contain {{limit}} items', @@ -4934,7 +5162,6 @@ exports.errors = { }, date: { base: 'must be a number of milliseconds or valid date string', - format: 'must be a string with one of the following formats {{format}}', strict: 'must be a valid date', min: 'must be larger than or equal to "{{limit}}"', max: 'must be less than or equal to "{{limit}}"', @@ -4970,7 +5197,7 @@ exports.errors = { without: '!!"{{mainWithLabel}}" conflict with forbidden peer "{{peerWithLabel}}"', missing: 'must contain at least one of {{peersWithLabels}}', xor: 'contains a conflict between exclusive peers {{peersWithLabels}}', - or: 'must contain at least one of {{peersWithLabels}}', + oxor: 'contains a conflict between optional exclusive peers {{peersWithLabels}}', and: 'contains {{presentWithLabels}} without its required peers {{missingWithLabels}}', nand: '!!"{{mainWithLabel}}" must not exist simultaneously with {{peersWithLabels}}', assert: '!!"{{ref}}" validation failed because "{{ref}}" failed to {{message}}', @@ -4987,11 +5214,11 @@ exports.errors = { }, number: { base: 'must be a number', + unsafe: 'must be a safe number', min: 'must be larger than or equal to {{limit}}', max: 'must be less than or equal to {{limit}}', less: 'must be less than {{limit}}', greater: 'must be greater than {{limit}}', - float: 'must be a float or double', integer: 'must be an integer', negative: 'must be a negative number', positive: 'must be a positive number', @@ -5043,7 +5270,7 @@ exports.errors = { /***/ }), -/* 18 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5075,7 +5302,7 @@ exports.options = Joi.object({ /***/ }), -/* 19 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5098,34 +5325,63 @@ internals.Lazy = class extends Any { super(); this._type = 'lazy'; + this._flags.once = true; + this._cache = null; } - _base(value, state, options) { + _init(fn, options) { - const result = { value }; - const lazy = this._flags.lazy; + return this.set(fn, options); + } - if (!lazy) { - result.errors = this.createError('lazy.base', null, state, options); - return result; + _base(value, state, options) { + + let schema; + if (this._cache) { + schema = this._cache; } + else { + const result = { value }; + const lazy = this._flags.lazy; + + if (!lazy) { + result.errors = this.createError('lazy.base', null, state, options); + return result; + } - const schema = lazy(); + schema = lazy(); - if (!(schema instanceof Any)) { - result.errors = this.createError('lazy.schema', null, state, options); - return result; + if (!(schema instanceof Any)) { + result.errors = this.createError('lazy.schema', { schema }, state, options); + return result; + } + + if (this._flags.once) { + this._cache = schema; + } } return schema._validate(value, state, options); } - set(fn) { + set(fn, options) { Hoek.assert(typeof fn === 'function', 'You must provide a function as first argument'); + Hoek.assert(options === undefined || (options && typeof options === 'object' && !Array.isArray(options)), `Options must be an object`); + + if (options) { + const unknownOptions = Object.keys(options).filter((key) => !['once'].includes(key)); + Hoek.assert(unknownOptions.length === 0, `Options contain unknown keys: ${unknownOptions}`); + Hoek.assert(options.once === undefined || typeof options.once === 'boolean', 'Option "once" must be a boolean'); + } const obj = this.clone(); obj._flags.lazy = fn; + + if (options && options.once !== obj._flags.once) { + obj._flags.once = options.once; + } + return obj; } @@ -5135,7 +5391,7 @@ module.exports = new internals.Lazy(); /***/ }), -/* 20 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5143,10 +5399,12 @@ module.exports = new internals.Lazy(); // Load modules +const Hoek = __webpack_require__(0); + const Any = __webpack_require__(1); const Cast = __webpack_require__(3); const Ref = __webpack_require__(2); -const Hoek = __webpack_require__(0); +const State = __webpack_require__(5); // Declare internals @@ -5214,7 +5472,7 @@ internals.Array = class extends Any { result.value = result.value.slice(0); } - result.errors = this._checkItems.call(this, result.value, wasArray, state, options); + result.errors = this._checkItems(result.value, wasArray, state, options); if (result.errors && wasArray && options.convert && this._flags.single) { @@ -5222,7 +5480,7 @@ internals.Array = class extends Any { const previousErrors = result.errors; result.value = [result.value]; - result.errors = this._checkItems.call(this, result.value, wasArray, state, options); + result.errors = this._checkItems(result.value, wasArray, state, options); if (result.errors) { @@ -5243,7 +5501,7 @@ internals.Array = class extends Any { const requireds = this._inner.requireds.slice(); const ordereds = this._inner.ordereds.slice(); - const inclusions = this._inner.inclusions.concat(requireds); + const inclusions = [...this._inner.inclusions, ...requireds]; let il = items.length; for (let i = 0; i < il; ++i) { @@ -5251,8 +5509,8 @@ internals.Array = class extends Any { const item = items[i]; let isValid = false; const key = wasArray ? i : state.key; - const path = wasArray ? state.path.concat(i) : state.path; - const localState = { key, path, parent: state.parent, reference: state.reference }; + const path = wasArray ? [...state.path, i] : state.path; + const localState = new State(key, path, state.parent, state.reference); let res; // Sparse @@ -5322,6 +5580,7 @@ internals.Array = class extends Any { return errors; } } + continue; } else if (!this._inner.items.length) { @@ -5329,6 +5588,7 @@ internals.Array = class extends Any { if (options.abortEarly) { return errors; } + continue; } } @@ -5364,9 +5624,7 @@ internals.Array = class extends Any { // Inclusions - const stripUnknown = options.stripUnknown - ? (options.stripUnknown === true ? true : !!options.stripUnknown.arrays) - : false; + const stripUnknown = options.stripUnknown && !!options.stripUnknown.arrays || false; jl = inclusions.length; for (let j = 0; j < jl; ++j) { @@ -5393,6 +5651,7 @@ internals.Array = class extends Any { else { items[i] = res.value; } + isValid = true; break; } @@ -5440,11 +5699,11 @@ internals.Array = class extends Any { } if (requireds.length) { - this._fillMissedErrors.call(this, errors, requireds, state, options); + this._fillMissedErrors(errors, requireds, state, options); } if (ordereds.length) { - this._fillOrderedErrors.call(this, errors, ordereds, state, options); + this._fillOrderedErrors(errors, ordereds, state, options); } return errors.length ? errors : null; @@ -5470,6 +5729,15 @@ internals.Array = class extends Any { } } + if (description.rules) { + for (let i = 0; i < description.rules.length; ++i) { + const rule = description.rules[i]; + if (rule.name === 'has') { + rule.arg = rule.arg.describe(); + } + } + } + return description; } @@ -5489,7 +5757,8 @@ internals.Array = class extends Any { else { castErr.path = index; } - castErr.message = castErr.message + '(' + castErr.path + ')'; + + castErr.message = `${castErr.message}(${castErr.path})`; throw castErr; } @@ -5525,9 +5794,11 @@ internals.Array = class extends Any { else { castErr.path = index; } - castErr.message = castErr.message + '(' + castErr.path + ')'; + + castErr.message = `${castErr.message}(${castErr.path})`; throw castErr; } + obj._inner.ordereds.push(type); }); @@ -5540,14 +5811,14 @@ internals.Array = class extends Any { Hoek.assert((Number.isSafeInteger(limit) && limit >= 0) || isRef, 'limit must be a positive integer or reference'); - return this._test('min', limit, function (value, state, options) { + return this._testUnique('min', limit, function (value, state, options) { let compareTo; if (isRef) { compareTo = limit(state.reference || state.parent, options); if (!(Number.isSafeInteger(compareTo) && compareTo >= 0)) { - return this.createError('array.ref', { ref: limit.key }, state, options); + return this.createError('array.ref', { ref: limit, value: compareTo }, state, options); } } else { @@ -5568,7 +5839,7 @@ internals.Array = class extends Any { Hoek.assert((Number.isSafeInteger(limit) && limit >= 0) || isRef, 'limit must be a positive integer or reference'); - return this._test('max', limit, function (value, state, options) { + return this._testUnique('max', limit, function (value, state, options) { let compareTo; if (isRef) { @@ -5596,7 +5867,7 @@ internals.Array = class extends Any { Hoek.assert((Number.isSafeInteger(limit) && limit >= 0) || isRef, 'limit must be a positive integer or reference'); - return this._test('length', limit, function (value, state, options) { + return this._testUnique('length', limit, function (value, state, options) { let compareTo; if (isRef) { @@ -5618,6 +5889,40 @@ internals.Array = class extends Any { }); } + has(schema) { + + try { + schema = Cast.schema(this._currentJoi, schema); + } + catch (castErr) { + if (castErr.hasOwnProperty('path')) { + castErr.message = `${castErr.message}(${castErr.path})`; + } + + throw castErr; + } + + return this._test('has', schema, function (value, state, options) { + + const isValid = value.some((item, idx) => { + + const localState = new State(idx, [...state.path, idx], state.key, state.reference); + return !schema._validate(item, localState, options).errors; + }); + + if (isValid) { + return value; + } + + const patternLabel = schema._getLabel(); + if (patternLabel) { + return this.createError('array.hasKnown', { patternLabel }, state, options); + } + + return this.createError('array.hasUnknown', null, state, options); + }); + } + unique(comparator, configs) { Hoek.assert(comparator === undefined || @@ -5666,13 +5971,7 @@ internals.Array = class extends Any { let current; while (!(current = entries.next()).done) { if (compare(current.value[0], item)) { - const localState = { - key: state.key, - path: state.path.concat(i), - parent: state.parent, - reference: state.reference - }; - + const localState = new State(state.key, [...state.path, i], state.parent, state.reference); const context = { pos: i, value: value[i], @@ -5692,12 +5991,7 @@ internals.Array = class extends Any { } else { if ((!ignoreUndefined || item !== undefined) && records[item] !== undefined) { - const localState = { - key: state.key, - path: state.path.concat(i), - parent: state.parent, - reference: state.reference - }; + const localState = new State(state.key, [...state.path, i], state.parent, state.reference); const context = { pos: i, @@ -5788,7 +6082,7 @@ internals.Array = class extends Any { } if (requiredOrdereds.length) { - this._fillMissedErrors.call(this, errors, requiredOrdereds, state, options); + this._fillMissedErrors(errors, requiredOrdereds, state, options); } } @@ -5811,7 +6105,7 @@ module.exports = new internals.Array(); /***/ }), -/* 21 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5826,7 +6120,7 @@ const Hoek = __webpack_require__(0); // Declare internals const internals = { - Set: __webpack_require__(8) + Set: __webpack_require__(9) }; @@ -5859,7 +6153,7 @@ internals.Boolean = class extends Any { : (this._inner.falsySet.has(value, null, null, this._flags.insensitive) ? false : value)); } - result.errors = (typeof result.value === 'boolean') ? null : this.createError('boolean.base', null, state, options); + result.errors = (typeof result.value === 'boolean') ? null : this.createError('boolean.base', { value }, state, options); return result; } @@ -5873,6 +6167,7 @@ internals.Boolean = class extends Any { Hoek.assert(value !== undefined, 'Cannot call truthy with undefined'); obj._inner.truthySet.add(value); } + return obj; } @@ -5886,6 +6181,7 @@ internals.Boolean = class extends Any { Hoek.assert(value !== undefined, 'Cannot call falsy with undefined'); obj._inner.falsySet.add(value); } + return obj; } @@ -5905,8 +6201,8 @@ internals.Boolean = class extends Any { describe() { const description = super.describe(); - description.truthy = [true].concat(this._inner.truthySet.values()); - description.falsy = [false].concat(this._inner.falsySet.values()); + description.truthy = [true, ...this._inner.truthySet.values()]; + description.falsy = [false, ...this._inner.falsySet.values()]; return description; } }; @@ -5916,7 +6212,7 @@ module.exports = new internals.Boolean(); /***/ }), -/* 22 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6023,7 +6319,7 @@ module.exports = new internals.Binary(); /***/ }), -/* 23 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6032,7 +6328,7 @@ module.exports = new internals.Binary(); // Load modules const Hoek = __webpack_require__(0); -const ObjectType = __webpack_require__(11); +const ObjectType = __webpack_require__(12); const Ref = __webpack_require__(2); @@ -6099,7 +6395,7 @@ internals.Func = class extends ObjectType.constructor { return value; } - return this.createError('function.ref', null, state, options); + return this.createError('function.ref', { value }, state, options); }); } @@ -6111,7 +6407,7 @@ internals.Func = class extends ObjectType.constructor { return value; } - return this.createError('function.class', null, state, options); + return this.createError('function.class', { value }, state, options); }); } }; @@ -6120,7 +6416,7 @@ module.exports = new internals.Func(); /***/ }), -/* 24 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6136,226 +6432,226 @@ const Hoek = __webpack_require__(0); const internals = {}; -exports = module.exports = internals.Topo = function () { - - this._items = []; - this.nodes = []; -}; +module.exports = class Topo { + constructor() { -internals.Topo.prototype.add = function (nodes, options) { + this._items = []; + this.nodes = []; + } - options = options || {}; + add(nodes, options) { - // Validate rules + options = options || {}; - const before = [].concat(options.before || []); - const after = [].concat(options.after || []); - const group = options.group || '?'; - const sort = options.sort || 0; // Used for merging only + // Validate rules - Hoek.assert(before.indexOf(group) === -1, 'Item cannot come before itself:', group); - Hoek.assert(before.indexOf('?') === -1, 'Item cannot come before unassociated items'); - Hoek.assert(after.indexOf(group) === -1, 'Item cannot come after itself:', group); - Hoek.assert(after.indexOf('?') === -1, 'Item cannot come after unassociated items'); + const before = [].concat(options.before || []); + const after = [].concat(options.after || []); + const group = options.group || '?'; + const sort = options.sort || 0; // Used for merging only - ([].concat(nodes)).forEach((node, i) => { + Hoek.assert(!before.includes(group), `Item cannot come before itself: ${group}`); + Hoek.assert(!before.includes('?'), 'Item cannot come before unassociated items'); + Hoek.assert(!after.includes(group), `Item cannot come after itself: ${group}`); + Hoek.assert(!after.includes('?'), 'Item cannot come after unassociated items'); - const item = { - seq: this._items.length, - sort, - before, - after, - group, - node - }; + ([].concat(nodes)).forEach((node, i) => { - this._items.push(item); - }); + const item = { + seq: this._items.length, + sort, + before, + after, + group, + node + }; - // Insert event + this._items.push(item); + }); - const error = this._sort(); - Hoek.assert(!error, 'item', (group !== '?' ? 'added into group ' + group : ''), 'created a dependencies error'); + // Insert event - return this.nodes; -}; + const error = this._sort(); + Hoek.assert(!error, 'item', (group !== '?' ? `added into group ${group}` : ''), 'created a dependencies error'); + return this.nodes; + } -internals.Topo.prototype.merge = function (others) { + merge(others) { - others = [].concat(others); - for (let i = 0; i < others.length; ++i) { - const other = others[i]; - if (other) { - for (let j = 0; j < other._items.length; ++j) { - const item = Hoek.shallow(other._items[j]); - this._items.push(item); + others = [].concat(others); + for (let i = 0; i < others.length; ++i) { + const other = others[i]; + if (other) { + for (let j = 0; j < other._items.length; ++j) { + const item = Object.assign({}, other._items[j]); // Shallow cloned + this._items.push(item); + } } } - } - - // Sort items - - this._items.sort(internals.mergeSort); - for (let i = 0; i < this._items.length; ++i) { - this._items[i].seq = i; - } - - const error = this._sort(); - Hoek.assert(!error, 'merge created a dependencies error'); - - return this.nodes; -}; + // Sort items -internals.mergeSort = function (a, b) { + this._items.sort(internals.mergeSort); + for (let i = 0; i < this._items.length; ++i) { + this._items[i].seq = i; + } - return a.sort === b.sort ? 0 : (a.sort < b.sort ? -1 : 1); -}; + const error = this._sort(); + Hoek.assert(!error, 'merge created a dependencies error'); + return this.nodes; + } -internals.Topo.prototype._sort = function () { + _sort() { - // Construct graph + // Construct graph - const graph = {}; - const graphAfters = Object.create(null); // A prototype can bungle lookups w/ false positives - const groups = Object.create(null); + const graph = {}; + const graphAfters = Object.create(null); // A prototype can bungle lookups w/ false positives + const groups = Object.create(null); - for (let i = 0; i < this._items.length; ++i) { - const item = this._items[i]; - const seq = item.seq; // Unique across all items - const group = item.group; + for (let i = 0; i < this._items.length; ++i) { + const item = this._items[i]; + const seq = item.seq; // Unique across all items + const group = item.group; - // Determine Groups + // Determine Groups - groups[group] = groups[group] || []; - groups[group].push(seq); + groups[group] = groups[group] || []; + groups[group].push(seq); - // Build intermediary graph using 'before' + // Build intermediary graph using 'before' - graph[seq] = item.before; + graph[seq] = item.before; - // Build second intermediary graph with 'after' + // Build second intermediary graph with 'after' - const after = item.after; - for (let j = 0; j < after.length; ++j) { - graphAfters[after[j]] = (graphAfters[after[j]] || []).concat(seq); + const after = item.after; + for (let j = 0; j < after.length; ++j) { + graphAfters[after[j]] = (graphAfters[after[j]] || []).concat(seq); + } } - } - // Expand intermediary graph + // Expand intermediary graph - let graphNodes = Object.keys(graph); - for (let i = 0; i < graphNodes.length; ++i) { - const node = graphNodes[i]; - const expandedGroups = []; + let graphNodes = Object.keys(graph); + for (let i = 0; i < graphNodes.length; ++i) { + const node = graphNodes[i]; + const expandedGroups = []; - const graphNodeItems = Object.keys(graph[node]); - for (let j = 0; j < graphNodeItems.length; ++j) { - const group = graph[node][graphNodeItems[j]]; - groups[group] = groups[group] || []; + const graphNodeItems = Object.keys(graph[node]); + for (let j = 0; j < graphNodeItems.length; ++j) { + const group = graph[node][graphNodeItems[j]]; + groups[group] = groups[group] || []; - for (let k = 0; k < groups[group].length; ++k) { - expandedGroups.push(groups[group][k]); + for (let k = 0; k < groups[group].length; ++k) { + expandedGroups.push(groups[group][k]); + } } + + graph[node] = expandedGroups; } - graph[node] = expandedGroups; - } - // Merge intermediary graph using graphAfters into final graph + // Merge intermediary graph using graphAfters into final graph - const afterNodes = Object.keys(graphAfters); - for (let i = 0; i < afterNodes.length; ++i) { - const group = afterNodes[i]; + const afterNodes = Object.keys(graphAfters); + for (let i = 0; i < afterNodes.length; ++i) { + const group = afterNodes[i]; - if (groups[group]) { - for (let j = 0; j < groups[group].length; ++j) { - const node = groups[group][j]; - graph[node] = graph[node].concat(graphAfters[group]); + if (groups[group]) { + for (let j = 0; j < groups[group].length; ++j) { + const node = groups[group][j]; + graph[node] = graph[node].concat(graphAfters[group]); + } } } - } - // Compile ancestors + // Compile ancestors - let children; - const ancestors = {}; - graphNodes = Object.keys(graph); - for (let i = 0; i < graphNodes.length; ++i) { - const node = graphNodes[i]; - children = graph[node]; + let children; + const ancestors = {}; + graphNodes = Object.keys(graph); + for (let i = 0; i < graphNodes.length; ++i) { + const node = graphNodes[i]; + children = graph[node]; - for (let j = 0; j < children.length; ++j) { - ancestors[children[j]] = (ancestors[children[j]] || []).concat(node); + for (let j = 0; j < children.length; ++j) { + ancestors[children[j]] = (ancestors[children[j]] || []).concat(node); + } } - } - // Topo sort + // Topo sort - const visited = {}; - const sorted = []; + const visited = {}; + const sorted = []; - for (let i = 0; i < this._items.length; ++i) { // Really looping thru item.seq values out of order - let next = i; + for (let i = 0; i < this._items.length; ++i) { // Really looping thru item.seq values out of order + let next = i; - if (ancestors[i]) { - next = null; - for (let j = 0; j < this._items.length; ++j) { // As above, these are item.seq values - if (visited[j] === true) { - continue; - } + if (ancestors[i]) { + next = null; + for (let j = 0; j < this._items.length; ++j) { // As above, these are item.seq values + if (visited[j] === true) { + continue; + } - if (!ancestors[j]) { - ancestors[j] = []; - } + if (!ancestors[j]) { + ancestors[j] = []; + } - const shouldSeeCount = ancestors[j].length; - let seenCount = 0; - for (let k = 0; k < shouldSeeCount; ++k) { - if (visited[ancestors[j][k]]) { - ++seenCount; + const shouldSeeCount = ancestors[j].length; + let seenCount = 0; + for (let k = 0; k < shouldSeeCount; ++k) { + if (visited[ancestors[j][k]]) { + ++seenCount; + } } - } - if (seenCount === shouldSeeCount) { - next = j; - break; + if (seenCount === shouldSeeCount) { + next = j; + break; + } } } + + if (next !== null) { + visited[next] = true; + sorted.push(next); + } } - if (next !== null) { - visited[next] = true; - sorted.push(next); + if (sorted.length !== this._items.length) { + return new Error('Invalid dependencies'); } - } - if (sorted.length !== this._items.length) { - return new Error('Invalid dependencies'); - } + const seqIndex = {}; + for (let i = 0; i < this._items.length; ++i) { + const item = this._items[i]; + seqIndex[item.seq] = item; + } - const seqIndex = {}; - for (let i = 0; i < this._items.length; ++i) { - const item = this._items[i]; - seqIndex[item.seq] = item; - } + const sortedNodes = []; + this._items = sorted.map((value) => { + + const sortedItem = seqIndex[value]; + sortedNodes.push(sortedItem.node); + return sortedItem; + }); - const sortedNodes = []; - this._items = sorted.map((value) => { + this.nodes = sortedNodes; + } +}; - const sortedItem = seqIndex[value]; - sortedNodes.push(sortedItem.node); - return sortedItem; - }); +internals.mergeSort = (a, b) => { - this.nodes = sortedNodes; + return a.sort === b.sort ? 0 : (a.sort < b.sort ? -1 : 1); }; /***/ }), -/* 25 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6371,7 +6667,28 @@ const Hoek = __webpack_require__(0); // Declare internals const internals = { - precisionRx: /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/ + precisionRx: /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/, + normalizeExponent(str) { + + return str + .replace(/\.?0+e/, 'e') + .replace(/e\+/, 'e') + .replace(/^\+/, '') + .replace(/^(-?)0+([1-9])/, '$1$2'); + }, + normalizeDecimal(str) { + + str = str + .replace(/^\+/, '') + .replace(/\.0+$/, '') + .replace(/^(-?)0+([1-9])/, '$1$2'); + + if (str.includes('.') && str.endsWith('0')) { + str = str.replace(/0+$/, ''); + } + + return str; + } }; @@ -6381,6 +6698,7 @@ internals.Number = class extends Any { super(); this._type = 'number'; + this._flags.unsafe = false; this._invalids.add(Infinity); this._invalids.add(-Infinity); } @@ -6395,8 +6713,27 @@ internals.Number = class extends Any { if (typeof value === 'string' && options.convert) { - const number = parseFloat(value); - result.value = (isNaN(number) || !isFinite(value)) ? NaN : number; + const matches = value.match(/^\s*[+-]?\d+(?:\.\d+)?(?:e([+-]?\d+))?\s*$/i); + if (matches) { + + value = value.trim(); + result.value = parseFloat(value); + + if (!this._flags.unsafe) { + if (value.includes('e')) { + if (internals.normalizeExponent(`${result.value / Math.pow(10, matches[1])}e${matches[1]}`) !== internals.normalizeExponent(value)) { + result.errors = this.createError('number.unsafe', { value }, state, options); + return result; + } + } + else { + if (result.value.toString() !== internals.normalizeDecimal(value)) { + result.errors = this.createError('number.unsafe', { value }, state, options); + return result; + } + } + } + } } const isNumber = typeof result.value === 'number' && !isNaN(result.value); @@ -6408,7 +6745,16 @@ internals.Number = class extends Any { result.value = Math.round(result.value * precision) / precision; } - result.errors = isNumber ? null : this.createError('number.base', { value }, state, options); + if (isNumber) { + if (!this._flags.unsafe && + (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER)) { + result.errors = this.createError('number.unsafe', { value }, state, options); + } + } + else { + result.errors = this.createError('number.base', { value }, state, options); + } + return result; } @@ -6441,10 +6787,23 @@ internals.Number = class extends Any { return this._test('integer', undefined, function (value, state, options) { - return Number.isSafeInteger(value) ? value : this.createError('number.integer', { value }, state, options); + return Math.trunc(value) - value === 0 ? value : this.createError('number.integer', { value }, state, options); }); } + unsafe(enabled = true) { + + Hoek.assert(typeof enabled === 'boolean', 'enabled must be a boolean'); + + if (this._flags.unsafe === enabled) { + return this; + } + + const obj = this.clone(); + obj._flags.unsafe = enabled; + return obj; + } + negative() { return this._test('negative', undefined, function (value, state, options) { @@ -6547,7 +6906,7 @@ module.exports = new internals.Number(); /***/ }), -/* 26 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6555,14 +6914,15 @@ module.exports = new internals.Number(); // Load modules -const Net = __webpack_require__(27); +const Net = __webpack_require__(30); const Hoek = __webpack_require__(0); -let Isemail; // Loaded on demand const Any = __webpack_require__(1); const Ref = __webpack_require__(2); -const JoiDate = __webpack_require__(10); -const Uri = __webpack_require__(28); -const Ip = __webpack_require__(29); +const JoiDate = __webpack_require__(11); +const Uri = __webpack_require__(31); +const Ip = __webpack_require__(32); + +let Isemail; // Loaded on demand // Declare internals @@ -6671,10 +7031,9 @@ internals.String = class extends Any { regex(pattern, patternOptions) { Hoek.assert(pattern instanceof RegExp, 'pattern must be a RegExp'); + Hoek.assert(!pattern.flags.includes('g') && !pattern.flags.includes('y'), 'pattern should not use global or sticky mode'); - const patternObject = { - pattern: new RegExp(pattern.source, pattern.ignoreCase ? 'i' : undefined) // Future version should break this and forbid unsupported regex flags - }; + const patternObject = { pattern }; if (typeof patternOptions === 'string') { patternObject.name = patternOptions; @@ -6751,7 +7110,7 @@ internals.String = class extends Any { return this._test('email', isEmailOptions, function (value, state, options) { - Isemail = Isemail || __webpack_require__(30); + Isemail = Isemail || __webpack_require__(33); try { const result = Isemail.validate(value, isEmailOptions); @@ -6805,7 +7164,7 @@ internals.String = class extends Any { } // Make sure we have a set of versions - versions = Hoek.unique(versions); + versions = Array.from(new Set(versions)); regex = Ip.createIpRegex(versions, ipOptions.cidr); } @@ -6979,6 +7338,7 @@ internals.String = class extends Any { if (byteAligned && value.length % 2 !== 0) { return this.createError('string.hexAlign', { value }, state, options); } + return value; } @@ -7023,7 +7383,7 @@ internals.String = class extends Any { dataUri(dataUriOptions = {}) { - const regex = /^data:[\w\/\+]+;((charset=[\w-]+|base64),)?(.*)$/; + const regex = /^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/; // Determine if padding is required. const paddingRequired = dataUriOptions.paddingRequired === false ? @@ -7211,7 +7571,7 @@ internals.compare = function (type, compare) { compareTo = limit(state.reference || state.parent, options); if (!Number.isSafeInteger(compareTo)) { - return this.createError('string.ref', { ref: limit.key }, state, options); + return this.createError('string.ref', { ref: limit, value: compareTo }, state, options); } } else { @@ -7256,13 +7616,13 @@ module.exports = new internals.String(); /***/ }), -/* 27 */ +/* 30 */ /***/ (function(module, exports) { module.exports = require("net"); /***/ }), -/* 28 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7270,7 +7630,7 @@ module.exports = require("net"); // Load Modules -const RFC3986 = __webpack_require__(12); +const RFC3986 = __webpack_require__(13); // Declare internals @@ -7315,7 +7675,7 @@ module.exports = internals.Uri; /***/ }), -/* 29 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7323,7 +7683,7 @@ module.exports = internals.Uri; // Load modules -const RFC3986 = __webpack_require__(12); +const RFC3986 = __webpack_require__(13); // Declare internals @@ -7376,7 +7736,7 @@ module.exports = internals.Ip; /***/ }), -/* 30 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7384,8 +7744,8 @@ module.exports = internals.Ip; // Load modules -const Punycode = __webpack_require__(31); -const Util = __webpack_require__(4); +const Punycode = __webpack_require__(34); +const Util = __webpack_require__(14); // Declare internals @@ -7480,7 +7840,8 @@ const internals = { errFWSCRLFEnd: 149, errCRNoLF: 150, errUnknownTLD: 160, - errDomainTooShort: 161 + errDomainTooShort: 161, + errDotAfterDomainLiteral: 162 }, components: { @@ -7563,22 +7924,40 @@ internals.nulNormalize = function (email) { internals.normalize = function (email) { - // $lab:coverage:off$ - if (!internals.normalizeSupportsNul && email.indexOf('\0') >= 0) { - return internals.nulNormalize(email); - } - // $lab:coverage:on$ - return email.normalize('NFC'); }; +// $lab:coverage:off$ +if (!internals.normalizeSupportsNul) { + internals.normalize = function (email) { + + if (email.indexOf('\0') >= 0) { + return internals.nulNormalize(email); + } + + return email.normalize('NFC'); + }; +} +// $lab:coverage:on$ + + internals.checkIpV6 = function (items) { return items.every((value) => internals.regex.ipV6.test(value)); }; +internals.isIterable = Array.isArray; + + +/* $lab:coverage:off$ */ +if (typeof Symbol !== 'undefined') { + internals.isIterable = (value) => Array.isArray(value) || (!!value && typeof value === 'object' && typeof value[Symbol.iterator] === 'function'); +} +/* $lab:coverage:on$ */ + + // Node 10 introduced isSet and isMap, which are useful for cross-context type // checking. // $lab:coverage:off$ @@ -7644,6 +8023,7 @@ internals.includesMapped = function (iterable, iteratee, value) { return true; } } + return false; }; @@ -7677,6 +8057,30 @@ internals.validDomain = function (tldAtom, options) { }; +/** + * Check whether the domain atoms has an address literal part followed by a + * normal domain atom part. For example, [127.0.0.1].com. + * + * @param {string[]} domainAtoms The parsed domain atoms. + * @returns {boolean} Whether there exists both a normal domain atom and an + * address literal. + */ +internals.hasDomainLiteralThenAtom = function (domainAtoms) { + + let hasDomainLiteral = false; + for (let i = 0; i < domainAtoms.length; ++i) { + if (domainAtoms[i][0] === '[') { + hasDomainLiteral = true; + } + else if (hasDomainLiteral) { + return true; + } + } + + return false; +}; + + /** * Check that an email address conforms to RFCs 5321, 5322, 6530 and others * @@ -7701,6 +8105,11 @@ internals.validDomain = function (tldAtom, options) { exports.validate = internals.validate = function (email, options, callback) { options = options || {}; + + if (typeof email !== 'string') { + throw new TypeError('expected string email'); + } + email = internals.normalize(email); // The callback function is deprecated. @@ -7749,10 +8158,23 @@ exports.validate = internals.validate = function (email, options, callback) { throw new TypeError('expected positive integer minDomainAtoms'); } + // Normalize the set of excluded diagnoses. + if (options.excludeDiagnoses) { + if (!internals.isIterable(options.excludeDiagnoses)) { + throw new TypeError('expected iterable excludeDiagnoses'); + } + + // This won't catch cross-realm Sets pre-Node 10, but it will cast the + // value to an in-realm Set representation. + if (!internals.isSet(options.excludeDiagnoses)) { + options.excludeDiagnoses = new Set(options.excludeDiagnoses); + } + } + let maxResult = internals.diagnoses.valid; const updateResult = (value) => { - if (value > maxResult) { + if (value > maxResult && (!options.excludeDiagnoses || !options.excludeDiagnoses.has(value))) { maxResult = value; } }; @@ -8050,7 +8472,7 @@ exports.validate = internals.validate = function (email, options, callback) { // Next dot-atom element case '.': - const punycodeLength = Punycode.encode(atomData.domains[elementCount]).length; + const punycodeLength = Punycode.toASCII(atomData.domains[elementCount]).length; if (elementLength === 0) { // Another dot, already? Fatal error. updateResult(elementCount === 0 ? internals.diagnoses.errDotStart : internals.diagnoses.errConsecutiveDots); @@ -8082,8 +8504,12 @@ exports.validate = internals.validate = function (email, options, callback) { // Domain literal case '[': - if (parseData.domain.length === 0) { - // Domain literal must be the only component + if (atomData.domains[elementCount].length === 0) { + if (parseData.domain.length) { + // Domain literal interspersed with domain refs. + updateResult(internals.diagnoses.errDotAfterDomainLiteral); + } + assertEnd = true; elementLength += Buffer.byteLength(token, 'utf8'); context.stack.push(context.now); @@ -8546,6 +8972,7 @@ exports.validate = internals.validate = function (email, options, callback) { throw new Error('quoted pair logic invoked in an invalid context: ' + context.now); // $lab:coverage:on$ } + break; // Comment @@ -8701,7 +9128,7 @@ exports.validate = internals.validate = function (email, options, callback) { // Check for errors if (maxResult < internals.categories.rfc5322) { - const punycodeLength = Punycode.encode(parseData.domain).length; + const punycodeLength = Punycode.toASCII(parseData.domain).length; // Fatal errors if (context.now === internals.components.contextQuotedString) { updateResult(internals.diagnoses.errUnclosedQuotedString); @@ -8757,9 +9184,12 @@ exports.validate = internals.validate = function (email, options, callback) { // labels 63 octets or less updateResult(internals.diagnoses.rfc5322LabelTooLong); } - else if (options.minDomainAtoms && atomData.domains.length < options.minDomainAtoms) { + else if (options.minDomainAtoms && atomData.domains.length < options.minDomainAtoms && (atomData.domains.length !== 1 || atomData.domains[0][0] !== '[')) { updateResult(internals.diagnoses.errDomainTooShort); } + else if (internals.hasDomainLiteralThenAtom(atomData.domains)) { + updateResult(internals.diagnoses.errDotAfterDomainLiteral); + } else if (options.tldWhitelist || options.tldBlacklist) { const tldAtom = atomData.domains[elementCount]; @@ -8812,13 +9242,13 @@ exports.normalize = internals.normalize; /***/ }), -/* 31 */ +/* 34 */ /***/ (function(module, exports) { module.exports = require("punycode"); /***/ }), -/* 32 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8826,7 +9256,7 @@ module.exports = require("punycode"); // Load modules -const Util = __webpack_require__(4); +const Util = __webpack_require__(14); const Any = __webpack_require__(1); const Hoek = __webpack_require__(0); @@ -8871,14 +9301,14 @@ internals.Symbol = class extends Any { if (this._flags.allowOnly) { return { value, - errors: (typeof value === 'symbol') ? null : this.createError('symbol.map', { map: this._inner.map }, state, options) + errors: (typeof value === 'symbol') ? null : this.createError('symbol.map', { value, map: this._inner.map }, state, options) }; } } return { value, - errors: (typeof value === 'symbol') ? null : this.createError('symbol.base', null, state, options) + errors: (typeof value === 'symbol') ? null : this.createError('symbol.base', { value }, state, options) }; } @@ -8918,10 +9348,10 @@ module.exports = new internals.Symbol(); /***/ }), -/* 33 */ +/* 36 */ /***/ (function(module) { -module.exports = {"name":"joi","description":"Object schema validation","version":"13.7.0","homepage":"https://github.com/hapijs/joi","repository":"git://github.com/hapijs/joi","main":"lib/index.js","keywords":["hapi","schema","validation"],"engines":{"node":">=8.9.0"},"dependencies":{"hoek":"5.x.x","isemail":"3.x.x","topo":"3.x.x"},"devDependencies":{"code":"5.x.x","hapitoc":"1.x.x","lab":"15.x.x","webpack":"^4.16.5","webpack-cli":"^3.1.0"},"scripts":{"build":"webpack","test":"lab -t 100 -a code -L","test-debug":"lab -a code","test-cov-html":"lab -r html -o coverage.html -a code","toc":"hapitoc","version":"npm run toc && git add API.md README.md"},"license":"BSD-3-Clause"}; +module.exports = {"name":"joi","description":"Object schema validation","version":"14.3.1","homepage":"https://github.com/hapijs/joi","repository":"git://github.com/hapijs/joi","main":"lib/index.js","keywords":["hapi","schema","validation"],"dependencies":{"hoek":"6.x.x","isemail":"3.x.x","topo":"3.x.x"},"devDependencies":{"code":"5.x.x","hapitoc":"1.x.x","lab":"18.x.x","webpack":"^4.16.5","webpack-cli":"^3.1.0"},"scripts":{"build":"webpack","test":"lab -t 100 -a code -L","test-debug":"lab -a code","test-cov-html":"lab -r html -o coverage.html -a code","toc":"hapitoc && node docs/check-errors-list.js","version":"npm run toc && git add API.md README.md"},"license":"BSD-3-Clause"}; /***/ }) -/******/ ]); \ No newline at end of file +/******/ ]); diff --git a/package-lock.json b/package-lock.json index c047e745..59fe76b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,12 +14,12 @@ } }, "@babel/generator": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.1.2.tgz", - "integrity": "sha512-70A9HWLS/1RHk3Ck8tNHKxOoKQuSKocYgwDN85Pyl/RBduss6AKxUR7RIZ/lzduQMSYfWEM4DDBu6A+XGbkFig==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.2.tgz", + "integrity": "sha512-f3QCuPppXxtZOEm5GWPra/uYUjmNQlu9pbAD8D/9jze4pTY83rTtB1igTBSwvkeNlC5gR24zFFkz+2WHLFQhqQ==", "dev": true, "requires": { - "@babel/types": "^7.1.2", + "@babel/types": "^7.3.2", "jsesc": "^2.5.1", "lodash": "^4.17.10", "source-map": "^0.5.0", @@ -67,43 +67,60 @@ } }, "@babel/parser": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.1.2.tgz", - "integrity": "sha512-x5HFsW+E/nQalGMw7hu+fvPqnBeBaIr0lWJ2SG0PPL2j+Pm9lYvCrsZJGIgauPIENx0v10INIyFjmSNUD/gSqQ==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.2.tgz", + "integrity": "sha512-QzNUC2RO1gadg+fs21fi0Uu0OuGNzRKEmgCxoLNzbCdoprLwjfmZwzUrpUNfJPaVRwBpDY47A17yYEGWyRelnQ==", "dev": true }, "@babel/template": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", - "integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz", + "integrity": "sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.1.2", - "@babel/types": "^7.1.2" + "@babel/parser": "^7.2.2", + "@babel/types": "^7.2.2" } }, "@babel/traverse": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.0.tgz", - "integrity": "sha512-bwgln0FsMoxm3pLOgrrnGaXk18sSM9JNf1/nHC/FksmNGFbYnPWY4GYCfLxyP1KRmfsxqkRpfoa6xr6VuuSxdw==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz", + "integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.0.0", + "@babel/generator": "^7.2.2", "@babel/helper-function-name": "^7.1.0", "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "debug": "^3.1.0", + "@babel/parser": "^7.2.3", + "@babel/types": "^7.2.2", + "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.10" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } } }, "@babel/types": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.1.2.tgz", - "integrity": "sha512-pb1I05sZEKiSlMUV9UReaqsCPUpgbHHHu2n1piRm7JkuBkm6QxcaIzKu6FMnMtCbih/cEYTR+RGYYC96Yk9HAg==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.2.tgz", + "integrity": "sha512-3Y6H8xlUlpbGR+XvawiH0UXehqydTmNmEpozWcXymqwcrwYAl5KMvKtQ+TF6f6E08V6Jur7v/ykdDSF+WDEIXQ==", "dev": true, "requires": { "esutils": "^2.0.2", @@ -111,19 +128,6 @@ "to-fast-properties": "^2.0.0" } }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, - "optional": true, - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -133,72 +137,18 @@ "color-convert": "^1.9.0" } }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "optional": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "async": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", - "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", - "dev": true, - "optional": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true, - "optional": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true, - "optional": true - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", - "dev": true, - "optional": true - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", @@ -215,20 +165,6 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true, - "optional": true - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true, - "optional": true - }, "chai": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", @@ -244,9 +180,9 @@ } }, "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -270,13 +206,6 @@ "glob": "^7.1.1" } }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true, - "optional": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -292,22 +221,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "colors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", - "dev": true, - "optional": true - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", @@ -320,54 +233,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "optional": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "console-browserify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", @@ -383,23 +248,6 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "cycle": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", - "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=", - "dev": true, - "optional": true - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "date-now": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", @@ -424,12 +272,6 @@ "type-detect": "^4.0.0" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -453,17 +295,17 @@ "dev": true }, "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", "dev": true } } }, "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", "dev": true }, "domhandler": { @@ -485,30 +327,12 @@ "domelementtype": "1" } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "entities": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", "dev": true }, - "es6-promise": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", - "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", - "dev": true, - "optional": true - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -527,106 +351,6 @@ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true, - "optional": true - }, - "extract-zip": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", - "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", - "dev": true, - "optional": true, - "requires": { - "concat-stream": "1.6.2", - "debug": "2.6.9", - "mkdirp": "0.5.1", - "yauzl": "2.4.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "optional": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "eyes": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", - "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=", - "dev": true, - "optional": true - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true, - "optional": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true, - "optional": true - }, - "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "dev": true, - "optional": true, - "requires": { - "pend": "~1.2.0" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true, - "optional": true - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "dev": true, - "optional": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "fs-extra": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", - "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -634,9 +358,9 @@ "dev": true }, "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, "get-func-name": { @@ -645,16 +369,6 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -670,59 +384,23 @@ } }, "globals": { - "version": "11.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", - "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "version": "11.10.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.10.0.tgz", + "integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==", "dev": true }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true, - "optional": true - }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true, - "optional": true - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "dev": true, - "optional": true, - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "hasha": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", - "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", - "dev": true, - "optional": true, - "requires": { - "is-stream": "^1.0.1", - "pinkie-promise": "^2.0.0" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -742,18 +420,6 @@ "readable-stream": "1.1" } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -770,49 +436,22 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true, - "optional": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true, - "optional": true - }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true, - "optional": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, "istanbul-lib-coverage": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", - "integrity": "sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", + "integrity": "sha512-dKWuzRGCs4G+67VfW9pBFFz2Jpi4vSp/k7zBcJ888ofV5Mi1g5CUML5GvMvV6u9Cjybftu+E8Cgp+k0dI1E5lw==", "dev": true }, "istanbul-lib-instrument": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.0.0.tgz", - "integrity": "sha512-eQY9vN9elYjdgN9Iv6NS/00bptm02EBBk70lRMaVjeA6QYocQgenVrSgC28TJurdnZa80AGO3ASdFN+w/njGiQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz", + "integrity": "sha512-ooVllVGT38HIk8MxDj/OIHXSYvH+1tq/Vb38s8ixt9GoJadXska4WkGY+0wkmtYCZNYtaARniH/DixUGGLZ0uA==", "dev": true, "requires": { "@babel/generator": "^7.0.0", @@ -820,7 +459,7 @@ "@babel/template": "^7.0.0", "@babel/traverse": "^7.0.0", "@babel/types": "^7.0.0", - "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", "semver": "^5.5.0" } }, @@ -830,23 +469,16 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true - }, "jsesc": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", - "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, "jshint": { - "version": "2.9.6", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.6.tgz", - "integrity": "sha512-KO9SIAKTlJQOM4lE64GQUtGBRpTOuvbrRrSZw3AhUxMNG266nX9hK2cKA4SBhXOj0irJGyNyGSLT62HGOVDEOA==", + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.10.1.tgz", + "integrity": "sha512-9GpPfKeffYBl7oBDX2lHPG16j0AM7D2bn3aLy9DaWTr6CWa0i/7UGhX8WLZ7V14QQnnr4hXbjauTLYg06F+HYw==", "dev": true, "requires": { "cli": "~1.0.0", @@ -855,95 +487,16 @@ "htmlparser2": "3.8.x", "lodash": "~4.17.10", "minimatch": "~3.0.2", - "phantom": "~4.0.1", - "phantomjs-prebuilt": "~2.1.7", "shelljs": "0.3.x", - "strip-json-comments": "1.0.x", - "unicode-5.2.0": "^0.7.5" - } - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true, - "optional": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true, - "optional": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true, - "optional": true - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "kew": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=", - "dev": true, - "optional": true - }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "dev": true, - "optional": true, - "requires": { - "graceful-fs": "^4.1.9" + "strip-json-comments": "1.0.x" } }, "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", - "dev": true - }, - "mime-db": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, - "mime-types": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", - "dev": true, - "requires": { - "mime-db": "~1.35.0" - } - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -988,9 +541,9 @@ } }, "mock-require": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.2.tgz", - "integrity": "sha512-aD/Y1ZFHqw5pHg3HVQ50dLbfaAAcytS6sqLuhP51Dk3TSPdFb2VkSAa3mjrHifLIlGAtwQHJHINafAyqAne7vA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.3.tgz", + "integrity": "sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg==", "dev": true, "requires": { "get-caller-file": "^1.0.2", @@ -1013,53 +566,37 @@ } }, "nyc": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-13.1.0.tgz", - "integrity": "sha512-3GyY6TpQ58z9Frpv4GMExE1SV2tAgYqC7HSy2omEhNiCT3mhT9NyiOvIE8zkbuJVFzmvvNTnE4h/7/wQae7xLg==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-13.2.0.tgz", + "integrity": "sha512-gQBlOqvfpYt9b2PZ7qElrHWt8x4y8ApNfbMBoDPdl3sY4/4RJwCxDGTSqhA9RnaguZjS5nW7taW8oToe86JLgQ==", "dev": true, "requires": { "archy": "^1.0.0", "arrify": "^1.0.1", - "caching-transform": "^2.0.0", + "caching-transform": "^3.0.1", "convert-source-map": "^1.6.0", - "debug-log": "^1.0.1", "find-cache-dir": "^2.0.0", "find-up": "^3.0.0", "foreground-child": "^1.5.6", "glob": "^7.1.3", - "istanbul-lib-coverage": "^2.0.1", - "istanbul-lib-hook": "^2.0.1", - "istanbul-lib-instrument": "^3.0.0", - "istanbul-lib-report": "^2.0.2", - "istanbul-lib-source-maps": "^2.0.1", - "istanbul-reports": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", + "istanbul-lib-hook": "^2.0.3", + "istanbul-lib-instrument": "^3.0.1", + "istanbul-lib-report": "^2.0.4", + "istanbul-lib-source-maps": "^3.0.2", + "istanbul-reports": "^2.1.0", "make-dir": "^1.3.0", "merge-source-map": "^1.1.0", "resolve-from": "^4.0.0", - "rimraf": "^2.6.2", + "rimraf": "^2.6.3", "signal-exit": "^3.0.2", "spawn-wrap": "^1.4.2", - "test-exclude": "^5.0.0", + "test-exclude": "^5.1.0", "uuid": "^3.3.2", - "yargs": "11.1.0", - "yargs-parser": "^9.0.2" + "yargs": "^12.0.5", + "yargs-parser": "^11.1.1" }, "dependencies": { - "align-text": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - } - }, - "amdefine": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, "ansi-regex": { "version": "3.0.0", "bundled": true, @@ -1084,9 +621,12 @@ "dev": true }, "async": { - "version": "1.5.2", + "version": "2.6.1", "bundled": true, - "dev": true + "dev": true, + "requires": { + "lodash": "^4.17.10" + } }, "balanced-match": { "version": "1.0.0", @@ -1108,49 +648,29 @@ "dev": true }, "caching-transform": { - "version": "2.0.0", + "version": "3.0.1", "bundled": true, "dev": true, "requires": { - "make-dir": "^1.0.0", - "md5-hex": "^2.0.0", - "package-hash": "^2.0.0", - "write-file-atomic": "^2.0.0" + "hasha": "^3.0.0", + "make-dir": "^1.3.0", + "package-hash": "^3.0.0", + "write-file-atomic": "^2.3.0" } }, "camelcase": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true - }, - "center-align": { - "version": "0.1.3", + "version": "5.0.0", "bundled": true, - "dev": true, - "optional": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - } + "dev": true }, "cliui": { - "version": "2.1.0", + "version": "4.1.0", "bundled": true, "dev": true, - "optional": true, "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "bundled": true, - "dev": true, - "optional": true - } + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" } }, "code-point-at": { @@ -1158,6 +678,12 @@ "bundled": true, "dev": true }, + "commander": { + "version": "2.17.1", + "bundled": true, + "dev": true, + "optional": true + }, "commondir": { "version": "1.0.1", "bundled": true, @@ -1186,18 +712,13 @@ } }, "debug": { - "version": "3.1.0", + "version": "4.1.1", "bundled": true, "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "debug-log": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, "decamelize": { "version": "1.2.0", "bundled": true, @@ -1211,6 +732,14 @@ "strip-bom": "^3.0.0" } }, + "end-of-stream": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "error-ex": { "version": "1.3.2", "bundled": true, @@ -1225,12 +754,12 @@ "dev": true }, "execa": { - "version": "0.7.0", + "version": "1.0.0", "bundled": true, "dev": true, "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", @@ -1239,11 +768,13 @@ }, "dependencies": { "cross-spawn": { - "version": "5.1.0", + "version": "6.0.5", "bundled": true, "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -1288,9 +819,12 @@ "dev": true }, "get-stream": { - "version": "3.0.0", + "version": "4.1.0", "bundled": true, - "dev": true + "dev": true, + "requires": { + "pump": "^3.0.0" + } }, "glob": { "version": "7.1.3", @@ -1306,28 +840,25 @@ } }, "graceful-fs": { - "version": "4.1.11", + "version": "4.1.15", "bundled": true, "dev": true }, "handlebars": { - "version": "4.0.11", + "version": "4.0.12", "bundled": true, "dev": true, "requires": { - "async": "^1.4.0", + "async": "^2.5.0", "optimist": "^0.6.1", - "source-map": "^0.4.4", - "uglify-js": "^2.6" + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" }, "dependencies": { "source-map": { - "version": "0.4.4", + "version": "0.6.1", "bundled": true, - "dev": true, - "requires": { - "amdefine": ">=0.0.4" - } + "dev": true } } }, @@ -1336,6 +867,14 @@ "bundled": true, "dev": true }, + "hasha": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "is-stream": "^1.0.1" + } + }, "hosted-git-info": { "version": "2.7.1", "bundled": true, @@ -1361,7 +900,7 @@ "dev": true }, "invert-kv": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "dev": true }, @@ -1370,11 +909,6 @@ "bundled": true, "dev": true }, - "is-buffer": { - "version": "1.1.6", - "bundled": true, - "dev": true - }, "is-builtin-module": { "version": "1.0.0", "bundled": true, @@ -1399,12 +933,12 @@ "dev": true }, "istanbul-lib-coverage": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true, "dev": true }, "istanbul-lib-hook": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true, "dev": true, "requires": { @@ -1412,22 +946,32 @@ } }, "istanbul-lib-report": { - "version": "2.0.2", + "version": "2.0.4", "bundled": true, "dev": true, "requires": { - "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-coverage": "^2.0.3", "make-dir": "^1.3.0", - "supports-color": "^5.4.0" + "supports-color": "^6.0.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "bundled": true, + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "istanbul-lib-source-maps": { - "version": "2.0.1", + "version": "3.0.2", "bundled": true, "dev": true, "requires": { - "debug": "^3.1.0", - "istanbul-lib-coverage": "^2.0.1", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.3", "make-dir": "^1.3.0", "rimraf": "^2.6.2", "source-map": "^0.6.1" @@ -1441,7 +985,7 @@ } }, "istanbul-reports": { - "version": "2.0.1", + "version": "2.1.0", "bundled": true, "dev": true, "requires": { @@ -1453,26 +997,12 @@ "bundled": true, "dev": true }, - "kind-of": { - "version": "3.2.2", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lazy-cache": { - "version": "1.0.4", - "bundled": true, - "dev": true, - "optional": true - }, "lcid": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true, "dev": true, "requires": { - "invert-kv": "^1.0.0" + "invert-kv": "^2.0.0" } }, "load-json-file": { @@ -1495,18 +1025,18 @@ "path-exists": "^3.0.0" } }, - "lodash.flattendeep": { - "version": "4.4.0", + "lodash": { + "version": "4.17.11", "bundled": true, "dev": true }, - "longest": { - "version": "1.0.1", + "lodash.flattendeep": { + "version": "4.4.0", "bundled": true, "dev": true }, "lru-cache": { - "version": "4.1.3", + "version": "4.1.5", "bundled": true, "dev": true, "requires": { @@ -1522,25 +1052,22 @@ "pify": "^3.0.0" } }, - "md5-hex": { - "version": "2.0.0", + "map-age-cleaner": { + "version": "0.1.3", "bundled": true, "dev": true, "requires": { - "md5-o-matic": "^0.1.1" + "p-defer": "^1.0.0" } }, - "md5-o-matic": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, "mem": { - "version": "1.1.0", + "version": "4.0.0", "bundled": true, "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^1.1.0" } }, "merge-source-map": { @@ -1592,7 +1119,12 @@ } }, "ms": { - "version": "2.0.0", + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "nice-try": { + "version": "1.0.5", "bundled": true, "dev": true }, @@ -1643,22 +1175,32 @@ "dev": true }, "os-locale": { - "version": "2.1.0", + "version": "3.1.0", "bundled": true, "dev": true, "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" } }, + "p-defer": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, "p-finally": { "version": "1.0.0", "bundled": true, "dev": true }, + "p-is-promise": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, "p-limit": { - "version": "2.0.0", + "version": "2.1.0", "bundled": true, "dev": true, "requires": { @@ -1679,13 +1221,13 @@ "dev": true }, "package-hash": { - "version": "2.0.0", + "version": "3.0.0", "bundled": true, "dev": true, "requires": { - "graceful-fs": "^4.1.11", + "graceful-fs": "^4.1.15", + "hasha": "^3.0.0", "lodash.flattendeep": "^4.4.0", - "md5-hex": "^2.0.0", "release-zalgo": "^1.0.0" } }, @@ -1739,6 +1281,15 @@ "bundled": true, "dev": true }, + "pump": { + "version": "3.0.0", + "bundled": true, + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "read-pkg": { "version": "3.0.0", "bundled": true, @@ -1766,11 +1317,6 @@ "es6-error": "^4.0.1" } }, - "repeat-string": { - "version": "1.6.1", - "bundled": true, - "dev": true - }, "require-directory": { "version": "2.1.1", "bundled": true, @@ -1786,21 +1332,12 @@ "bundled": true, "dev": true }, - "right-align": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "align-text": "^0.1.1" - } - }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "dev": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { @@ -1809,7 +1346,7 @@ "dev": true }, "semver": { - "version": "5.5.0", + "version": "5.6.0", "bundled": true, "dev": true }, @@ -1836,12 +1373,6 @@ "bundled": true, "dev": true }, - "source-map": { - "version": "0.5.7", - "bundled": true, - "dev": true, - "optional": true - }, "spawn-wrap": { "version": "1.4.2", "bundled": true, @@ -1856,7 +1387,7 @@ } }, "spdx-correct": { - "version": "3.0.0", + "version": "3.1.0", "bundled": true, "dev": true, "requires": { @@ -1865,7 +1396,7 @@ } }, "spdx-exceptions": { - "version": "2.1.0", + "version": "2.2.0", "bundled": true, "dev": true }, @@ -1879,7 +1410,7 @@ } }, "spdx-license-ids": { - "version": "3.0.0", + "version": "3.0.3", "bundled": true, "dev": true }, @@ -1910,16 +1441,8 @@ "bundled": true, "dev": true }, - "supports-color": { - "version": "5.4.0", - "bundled": true, - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, "test-exclude": { - "version": "5.0.0", + "version": "5.1.0", "bundled": true, "dev": true, "requires": { @@ -1930,43 +1453,30 @@ } }, "uglify-js": { - "version": "2.8.29", + "version": "3.4.9", "bundled": true, "dev": true, "optional": true, "requires": { - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" + "commander": "~2.17.1", + "source-map": "~0.6.1" }, "dependencies": { - "yargs": { - "version": "3.10.0", + "source-map": { + "version": "0.6.1", "bundled": true, "dev": true, - "optional": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } + "optional": true } } }, - "uglify-to-browserify": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, "uuid": { "version": "3.3.2", "bundled": true, "dev": true }, "validate-npm-package-license": { - "version": "3.0.3", + "version": "3.0.4", "bundled": true, "dev": true, "requires": { @@ -1987,12 +1497,6 @@ "bundled": true, "dev": true }, - "window-size": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "optional": true - }, "wordwrap": { "version": "0.0.3", "bundled": true, @@ -2046,7 +1550,7 @@ "dev": true }, "write-file-atomic": { - "version": "2.3.0", + "version": "2.4.2", "bundled": true, "dev": true, "requires": { @@ -2056,7 +1560,7 @@ } }, "y18n": { - "version": "3.2.1", + "version": "4.0.0", "bundled": true, "dev": true }, @@ -2066,98 +1570,35 @@ "dev": true }, "yargs": { - "version": "11.1.0", + "version": "12.0.5", "bundled": true, "dev": true, "requires": { "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "os-locale": "^3.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - }, - "dependencies": { - "cliui": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "bundled": true, - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "bundled": true, - "dev": true - } + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" } }, "yargs-parser": { - "version": "9.0.2", + "version": "11.1.1", "bundled": true, "dev": true, "requires": { - "camelcase": "^4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true, - "dev": true - } + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true, - "optional": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2179,102 +1620,6 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true, - "optional": true - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true, - "optional": true - }, - "phantom": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/phantom/-/phantom-4.0.12.tgz", - "integrity": "sha512-Tz82XhtPmwCk1FFPmecy7yRGZG2btpzY2KI9fcoPT7zT9det0CcMyfBFPp1S8DqzsnQnm8ZYEfdy528mwVtksA==", - "dev": true, - "optional": true, - "requires": { - "phantomjs-prebuilt": "^2.1.16", - "split": "^1.0.1", - "winston": "^2.4.0" - } - }, - "phantomjs-prebuilt": { - "version": "2.1.16", - "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz", - "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=", - "dev": true, - "optional": true, - "requires": { - "es6-promise": "^4.0.3", - "extract-zip": "^1.6.5", - "fs-extra": "^1.0.0", - "hasha": "^2.2.0", - "kew": "^0.7.0", - "progress": "^1.1.8", - "request": "^2.81.0", - "request-progress": "^2.0.1", - "which": "^1.2.10" - } - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true, - "optional": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "optional": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true, - "optional": true - }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", - "dev": true, - "optional": true - }, - "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", - "dev": true, - "optional": true - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true, - "optional": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true, - "optional": true - }, "readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -2293,61 +1638,10 @@ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", "dev": true }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "request-progress": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", - "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", - "dev": true, - "optional": true, - "requires": { - "throttleit": "^1.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", - "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, "shelljs": { @@ -2362,41 +1656,6 @@ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, - "split": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", - "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", - "dev": true, - "optional": true, - "requires": { - "through": "2" - } - }, - "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", - "dev": true, - "optional": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", - "dev": true, - "optional": true - }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", @@ -2418,145 +1677,29 @@ "has-flag": "^3.0.0" } }, - "throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", - "dev": true, - "optional": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true, - "optional": true - }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "optional": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true - }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true, - "optional": true - }, - "unicode-5.2.0": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/unicode-5.2.0/-/unicode-5.2.0-0.7.5.tgz", - "integrity": "sha512-KVGLW1Bri30x00yv4HNM8kBxoqFXr0Sbo55735nvrlsx4PYBZol3UtoWgO492fSwmsetzPEZzy73rbU8OGXJcA==", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true, - "optional": true - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true, - "optional": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "optional": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "winston": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.3.tgz", - "integrity": "sha512-GYKuysPz2pxYAVJD2NPsDLP5Z79SDEzPm9/j4tCjkF/n89iBNGBMJcR+dMUqxgPNgoSs6fVygPi+Vl2oxIpBuw==", - "dev": true, - "optional": true, - "requires": { - "async": "~1.0.0", - "colors": "1.0.x", - "cycle": "1.0.x", - "eyes": "0.1.x", - "isstream": "0.1.x", - "stack-trace": "0.0.x" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true - }, - "yauzl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", - "dev": true, - "optional": true, - "requires": { - "fd-slicer": "~1.0.1" - } } } } diff --git a/package.json b/package.json index 60776abb..ff5044cf 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,11 @@ "dependencies": {}, "devDependencies": { "chai": "^4.2.0", - "jshint": "^2.9.6", + "jshint": "^2.10.1", + "lodash": "^4.17.11", "mocha": "^5.2.0", - "mock-require": "^3.0.2", - "nyc": "^13.1.0" + "mock-require": "^3.0.3", + "nyc": "^13.2.0" }, "scripts": { "clean": "rm -rf build .nyc_output",