update node modules
This commit is contained in:
112
node_modules/ajv/dist/ajv.bundle.js
generated
vendored
112
node_modules/ajv/dist/ajv.bundle.js
generated
vendored
@@ -414,7 +414,7 @@ function compile(schema, root, localRefs, baseId) {
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode);
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
||||
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
||||
var validate;
|
||||
try {
|
||||
@@ -1076,8 +1076,6 @@ module.exports = {
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
cleanUpCode: cleanUpCode,
|
||||
finalCleanUpCode: finalCleanUpCode,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
schemaUnknownRules: schemaUnknownRules,
|
||||
@@ -1099,7 +1097,7 @@ function copy(o, to) {
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, negate) {
|
||||
function checkDataType(dataType, data, strictNumbers, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
@@ -1112,15 +1110,18 @@ function checkDataType(dataType, data, negate) {
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data + ')';
|
||||
AND + data + EQUAL + data +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data) {
|
||||
function checkDataTypes(dataTypes, data, strictNumbers) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, true);
|
||||
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
@@ -1133,7 +1134,7 @@ function checkDataTypes(dataTypes, data) {
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
@@ -1199,42 +1200,6 @@ function varReplace(str, dataVar, expr) {
|
||||
}
|
||||
|
||||
|
||||
var EMPTY_ELSE = /else\s*{\s*}/g
|
||||
, EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
|
||||
, EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
|
||||
function cleanUpCode(out) {
|
||||
return out.replace(EMPTY_ELSE, '')
|
||||
.replace(EMPTY_IF_NO_ELSE, '')
|
||||
.replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
|
||||
}
|
||||
|
||||
|
||||
var ERRORS_REGEXP = /[^v.]errors/g
|
||||
, REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
|
||||
, REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
|
||||
, RETURN_VALID = 'return errors === 0;'
|
||||
, RETURN_TRUE = 'validate.errors = null; return true;'
|
||||
, RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
|
||||
, RETURN_DATA_ASYNC = 'return data;'
|
||||
, ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
|
||||
, REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
|
||||
|
||||
function finalCleanUpCode(out, async) {
|
||||
var matches = out.match(ERRORS_REGEXP);
|
||||
if (matches && matches.length == 2) {
|
||||
out = async
|
||||
? out.replace(REMOVE_ERRORS_ASYNC, '')
|
||||
.replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
|
||||
: out.replace(REMOVE_ERRORS, '')
|
||||
.replace(RETURN_VALID, RETURN_TRUE);
|
||||
}
|
||||
|
||||
matches = out.match(ROOTDATA_REGEXP);
|
||||
if (!matches || matches.length !== 3) return out;
|
||||
return out.replace(REMOVE_ROOTDATA, '');
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return !schema;
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
@@ -1313,7 +1278,7 @@ function getData($data, lvl, paths) {
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/' \+ '/g, '');
|
||||
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
|
||||
}
|
||||
|
||||
|
||||
@@ -1377,7 +1342,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -1393,7 +1358,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
|
||||
module.exports = {
|
||||
$id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js',
|
||||
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
||||
definitions: {
|
||||
simpleTypes: metaSchema.definitions.simpleTypes
|
||||
},
|
||||
@@ -1453,6 +1418,12 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
$op = $isMax ? '<' : '>',
|
||||
$notOp = $isMax ? '>' : '<',
|
||||
$errorKeyword = undefined;
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
@@ -1605,6 +1576,9 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxItems' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
@@ -1684,6 +1658,9 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxLength' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
@@ -1768,6 +1745,9 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
@@ -1868,7 +1848,6 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -1939,7 +1918,6 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
@@ -2102,7 +2080,6 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -2356,6 +2333,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
$propertyDeps = {},
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
for ($property in $schema) {
|
||||
if ($property == '__proto__') continue;
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
@@ -2502,7 +2480,6 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -2823,7 +2800,6 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
@@ -3006,7 +2982,6 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -3029,6 +3004,9 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
out += 'var division' + ($lvl) + ';if (';
|
||||
if ($isData) {
|
||||
out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
|
||||
@@ -3348,9 +3326,9 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$dataProperties = 'dataProperties' + $lvl;
|
||||
var $schemaKeys = Object.keys($schema || {}),
|
||||
var $schemaKeys = Object.keys($schema || {}).filter(notProto),
|
||||
$pProperties = it.schema.patternProperties || {},
|
||||
$pPropertyKeys = Object.keys($pProperties),
|
||||
$pPropertyKeys = Object.keys($pProperties).filter(notProto),
|
||||
$aProperties = it.schema.additionalProperties,
|
||||
$someProperties = $schemaKeys.length || $pPropertyKeys.length,
|
||||
$noAdditional = $aProperties === false,
|
||||
@@ -3360,7 +3338,13 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$ownProperties = it.opts.ownProperties,
|
||||
$currentBaseId = it.baseId;
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}
|
||||
|
||||
function notProto(p) {
|
||||
return p !== '__proto__';
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
|
||||
if ($ownProperties) {
|
||||
out += ' var ' + ($dataProperties) + ' = undefined;';
|
||||
@@ -3655,7 +3639,6 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -3739,7 +3722,6 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -4173,7 +4155,7 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
|
||||
var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
|
||||
out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
|
||||
out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
|
||||
if ($typeIsArray) {
|
||||
out += ' if (typeof item == \'string\') item = \'"\' + item; ';
|
||||
}
|
||||
@@ -4381,7 +4363,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
var $schemaPath = it.schemaPath + '.type',
|
||||
$errSchemaPath = it.errSchemaPath + '/type',
|
||||
$method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
|
||||
out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
|
||||
if ($coerceToTypes) {
|
||||
var $dataType = 'dataType' + $lvl,
|
||||
$coerced = 'coerced' + $lvl;
|
||||
@@ -4534,7 +4516,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
$rulesGroup = arr2[i2 += 1];
|
||||
if ($shouldUseGroup($rulesGroup)) {
|
||||
if ($rulesGroup.type) {
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
|
||||
}
|
||||
if (it.opts.useDefaults) {
|
||||
if ($rulesGroup.type == 'object' && it.schema.properties) {
|
||||
@@ -4702,10 +4684,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
if ($top) {
|
||||
out = it.util.finalCleanUpCode(out, $async);
|
||||
}
|
||||
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
var rules = $rulesGroup.rules;
|
||||
@@ -4774,7 +4752,7 @@ function addKeyword(keyword, definition) {
|
||||
metaSchema = {
|
||||
anyOf: [
|
||||
metaSchema,
|
||||
{ '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
{ '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -4876,7 +4854,7 @@ function validateKeyword(definition, throwError) {
|
||||
},{"./definition_schema":12,"./dotjs/custom":22}],40:[function(require,module,exports){
|
||||
module.exports={
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#",
|
||||
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
||||
"description": "Meta-schema for $data reference (JSON Schema extension proposal)",
|
||||
"type": "object",
|
||||
"required": [ "$data" ],
|
||||
|
4
node_modules/ajv/dist/ajv.min.js
generated
vendored
4
node_modules/ajv/dist/ajv.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/ajv/dist/ajv.min.js.map
generated
vendored
2
node_modules/ajv/dist/ajv.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user