mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update node modules
This commit is contained in:
14
node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
14
node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
@@ -52,7 +52,8 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -65,7 +66,13 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
|
||||
out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; ';
|
||||
if ($schema === undefined) {
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaValueExcl;
|
||||
$isData = $isDataExcl;
|
||||
}
|
||||
} else {
|
||||
var $exclIsNumber = typeof $schemaExcl == 'number',
|
||||
$opStr = $op;
|
||||
@@ -132,7 +139,8 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
5
node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
5
node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
@@ -34,7 +34,7 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
if ($keyword == 'maxItems') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'less';
|
||||
out += 'fewer';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
@@ -59,7 +59,8 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
3
node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
@@ -64,7 +64,8 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
5
node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
5
node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
@@ -34,7 +34,7 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
if ($keyword == 'maxProperties') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'less';
|
||||
out += 'fewer';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
@@ -59,7 +59,8 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
3
node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
@@ -52,7 +52,8 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
|
14
node_modules/ajv/lib/dotjs/comment.js
generated
vendored
Normal file
14
node_modules/ajv/lib/dotjs/comment.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
module.exports = function generate_comment(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $comment = it.util.toQuotedString($schema);
|
||||
if (it.opts.$comment === true) {
|
||||
out += ' console.log(' + ($comment) + ');';
|
||||
} else if (typeof it.opts.$comment == 'function') {
|
||||
out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';
|
||||
}
|
||||
return out;
|
||||
}
|
5
node_modules/ajv/lib/dotjs/const.js
generated
vendored
5
node_modules/ajv/lib/dotjs/const.js
generated
vendored
@@ -25,7 +25,7 @@ module.exports = function generate_const(it, $keyword, $ruleType) {
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be equal to constant\' ';
|
||||
}
|
||||
@@ -38,7 +38,8 @@ module.exports = function generate_const(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/contains.js
generated
vendored
3
node_modules/ajv/lib/dotjs/contains.js
generated
vendored
@@ -60,7 +60,8 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
10
node_modules/ajv/lib/dotjs/custom.js
generated
vendored
10
node_modules/ajv/lib/dotjs/custom.js
generated
vendored
@@ -99,13 +99,13 @@ module.exports = function generate_custom(it, $keyword, $ruleType) {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + ($valid) + ' = ';
|
||||
if ($asyncKeyword) {
|
||||
out += '' + (it.yieldAwait);
|
||||
out += 'await ';
|
||||
}
|
||||
out += '' + (def_callRuleValidate) + '; ';
|
||||
} else {
|
||||
if ($asyncKeyword) {
|
||||
$ruleErrs = 'customErrors' + $lvl;
|
||||
out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
|
||||
out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
|
||||
} else {
|
||||
out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';
|
||||
}
|
||||
@@ -153,7 +153,8 @@ module.exports = function generate_custom(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -199,7 +200,8 @@ module.exports = function generate_custom(it, $keyword, $ruleType) {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
3
node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
@@ -80,7 +80,8 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/enum.js
generated
vendored
3
node_modules/ajv/lib/dotjs/enum.js
generated
vendored
@@ -48,7 +48,8 @@ module.exports = function generate_enum(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
7
node_modules/ajv/lib/dotjs/format.js
generated
vendored
7
node_modules/ajv/lib/dotjs/format.js
generated
vendored
@@ -46,7 +46,7 @@ module.exports = function generate_format(it, $keyword, $ruleType) {
|
||||
}
|
||||
out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? ';
|
||||
if (it.async) {
|
||||
out += ' (async' + ($lvl) + ' ? ' + (it.yieldAwait) + ' ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';
|
||||
out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';
|
||||
} else {
|
||||
out += ' ' + ($format) + '(' + ($data) + ') ';
|
||||
}
|
||||
@@ -84,7 +84,7 @@ module.exports = function generate_format(it, $keyword, $ruleType) {
|
||||
if ($async) {
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { ';
|
||||
out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { ';
|
||||
} else {
|
||||
out += ' if (! ';
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
@@ -132,7 +132,8 @@ module.exports = function generate_format(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
104
node_modules/ajv/lib/dotjs/if.js
generated
vendored
Normal file
104
node_modules/ajv/lib/dotjs/if.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $thenSch = it.schema['then'],
|
||||
$elseSch = it.schema['else'],
|
||||
$thenPresent = $thenSch !== undefined && it.util.schemaHasRules($thenSch, it.RULES.all),
|
||||
$elsePresent = $elseSch !== undefined && it.util.schemaHasRules($elseSch, it.RULES.all),
|
||||
$currentBaseId = $it.baseId;
|
||||
if ($thenPresent || $elsePresent) {
|
||||
var $ifClause;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
$it.createErrors = true;
|
||||
out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
if ($thenPresent) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$it.schema = it.schema['then'];
|
||||
$it.schemaPath = it.schemaPath + '.then';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/then';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
if ($thenPresent && $elsePresent) {
|
||||
$ifClause = 'ifClause' + $lvl;
|
||||
out += ' var ' + ($ifClause) + ' = \'then\'; ';
|
||||
} else {
|
||||
$ifClause = '\'then\'';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($elsePresent) {
|
||||
out += ' else { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if (!' + ($nextValid) + ') { ';
|
||||
}
|
||||
if ($elsePresent) {
|
||||
$it.schema = it.schema['else'];
|
||||
$it.schemaPath = it.schemaPath + '.else';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/else';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
if ($thenPresent && $elsePresent) {
|
||||
$ifClause = 'ifClause' + $lvl;
|
||||
out += ' var ' + ($ifClause) + ' = \'else\'; ';
|
||||
} else {
|
||||
$ifClause = '\'else\'';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
33
node_modules/ajv/lib/dotjs/index.js
generated
vendored
Normal file
33
node_modules/ajv/lib/dotjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
//all requires must be explicit because browserify won't work with dynamic requires
|
||||
module.exports = {
|
||||
'$ref': require('./ref'),
|
||||
allOf: require('./allOf'),
|
||||
anyOf: require('./anyOf'),
|
||||
'$comment': require('./comment'),
|
||||
const: require('./const'),
|
||||
contains: require('./contains'),
|
||||
dependencies: require('./dependencies'),
|
||||
'enum': require('./enum'),
|
||||
format: require('./format'),
|
||||
'if': require('./if'),
|
||||
items: require('./items'),
|
||||
maximum: require('./_limit'),
|
||||
minimum: require('./_limit'),
|
||||
maxItems: require('./_limitItems'),
|
||||
minItems: require('./_limitItems'),
|
||||
maxLength: require('./_limitLength'),
|
||||
minLength: require('./_limitLength'),
|
||||
maxProperties: require('./_limitProperties'),
|
||||
minProperties: require('./_limitProperties'),
|
||||
multipleOf: require('./multipleOf'),
|
||||
not: require('./not'),
|
||||
oneOf: require('./oneOf'),
|
||||
pattern: require('./pattern'),
|
||||
properties: require('./properties'),
|
||||
propertyNames: require('./propertyNames'),
|
||||
required: require('./required'),
|
||||
uniqueItems: require('./uniqueItems'),
|
||||
validate: require('./validate')
|
||||
};
|
3
node_modules/ajv/lib/dotjs/items.js
generated
vendored
3
node_modules/ajv/lib/dotjs/items.js
generated
vendored
@@ -43,7 +43,8 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
3
node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
@@ -59,7 +59,8 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/not.js
generated
vendored
3
node_modules/ajv/lib/dotjs/not.js
generated
vendored
@@ -47,7 +47,8 @@ module.exports = function generate_not(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
15
node_modules/ajv/lib/dotjs/oneOf.js
generated
vendored
15
node_modules/ajv/lib/dotjs/oneOf.js
generated
vendored
@@ -14,8 +14,10 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;';
|
||||
var $currentBaseId = $it.baseId;
|
||||
var $currentBaseId = $it.baseId,
|
||||
$prevValid = 'prevValid' + $lvl,
|
||||
$passingSchemas = 'passingSchemas' + $lvl;
|
||||
out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var arr1 = $schema;
|
||||
@@ -34,16 +36,16 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
|
||||
out += ' var ' + ($nextValid) + ' = true; ';
|
||||
}
|
||||
if ($i) {
|
||||
out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { ';
|
||||
out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;';
|
||||
out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';
|
||||
}
|
||||
}
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match exactly one schema in oneOf\' ';
|
||||
}
|
||||
@@ -55,7 +57,8 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
|
3
node_modules/ajv/lib/dotjs/pattern.js
generated
vendored
3
node_modules/ajv/lib/dotjs/pattern.js
generated
vendored
@@ -57,7 +57,8 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
190
node_modules/ajv/lib/dotjs/properties.js
generated
vendored
190
node_modules/ajv/lib/dotjs/properties.js
generated
vendored
@@ -8,7 +8,6 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
@@ -31,11 +30,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$ownProperties = it.opts.ownProperties,
|
||||
$currentBaseId = it.baseId;
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
|
||||
if (it.opts.patternGroups) {
|
||||
var $pgProperties = it.schema.patternGroups || {},
|
||||
$pgPropertyKeys = Object.keys($pgProperties);
|
||||
}
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
|
||||
if ($ownProperties) {
|
||||
out += ' var ' + ($dataProperties) + ' = undefined;';
|
||||
@@ -49,8 +44,8 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
if ($someProperties) {
|
||||
out += ' var isAdditional' + ($lvl) + ' = !(false ';
|
||||
if ($schemaKeys.length) {
|
||||
if ($schemaKeys.length > 5) {
|
||||
out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] ';
|
||||
if ($schemaKeys.length > 8) {
|
||||
out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';
|
||||
} else {
|
||||
var arr1 = $schemaKeys;
|
||||
if (arr1) {
|
||||
@@ -74,17 +69,6 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it.opts.patternGroups && $pgPropertyKeys.length) {
|
||||
var arr3 = $pgPropertyKeys;
|
||||
if (arr3) {
|
||||
var $pgProperty, $i = -1,
|
||||
l3 = arr3.length - 1;
|
||||
while ($i < l3) {
|
||||
$pgProperty = arr3[$i += 1];
|
||||
out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += ' ); if (isAdditional' + ($lvl) + ') { ';
|
||||
}
|
||||
if ($removeAdditional == 'all') {
|
||||
@@ -108,7 +92,13 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have additional properties\' ';
|
||||
out += ' , message: \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
out += 'is an invalid additional property';
|
||||
} else {
|
||||
out += 'should NOT have additional properties';
|
||||
}
|
||||
out += '\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
@@ -119,7 +109,8 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -185,12 +176,12 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
}
|
||||
var $useDefaults = it.opts.useDefaults && !it.compositeRule;
|
||||
if ($schemaKeys.length) {
|
||||
var arr4 = $schemaKeys;
|
||||
if (arr4) {
|
||||
var $propertyKey, i4 = -1,
|
||||
l4 = arr4.length - 1;
|
||||
while (i4 < l4) {
|
||||
$propertyKey = arr4[i4 += 1];
|
||||
var arr3 = $schemaKeys;
|
||||
if (arr3) {
|
||||
var $propertyKey, i3 = -1,
|
||||
l3 = arr3.length - 1;
|
||||
while (i3 < l3) {
|
||||
$propertyKey = arr3[i3 += 1];
|
||||
var $sch = $schema[$propertyKey];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
@@ -249,7 +240,8 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -287,12 +279,12 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
}
|
||||
}
|
||||
if ($pPropertyKeys.length) {
|
||||
var arr5 = $pPropertyKeys;
|
||||
if (arr5) {
|
||||
var $pProperty, i5 = -1,
|
||||
l5 = arr5.length - 1;
|
||||
while (i5 < l5) {
|
||||
$pProperty = arr5[i5 += 1];
|
||||
var arr4 = $pPropertyKeys;
|
||||
if (arr4) {
|
||||
var $pProperty, i4 = -1,
|
||||
l4 = arr4.length - 1;
|
||||
while (i4 < l4) {
|
||||
$pProperty = arr4[i4 += 1];
|
||||
var $sch = $pProperties[$pProperty];
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
$it.schema = $sch;
|
||||
@@ -330,136 +322,6 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it.opts.patternGroups && $pgPropertyKeys.length) {
|
||||
var arr6 = $pgPropertyKeys;
|
||||
if (arr6) {
|
||||
var $pgProperty, i6 = -1,
|
||||
l6 = arr6.length - 1;
|
||||
while (i6 < l6) {
|
||||
$pgProperty = arr6[i6 += 1];
|
||||
var $pgSchema = $pgProperties[$pgProperty],
|
||||
$sch = $pgSchema.schema;
|
||||
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema';
|
||||
out += ' var pgPropCount' + ($lvl) + ' = 0; ';
|
||||
if ($ownProperties) {
|
||||
out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
|
||||
} else {
|
||||
out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
|
||||
}
|
||||
out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else ' + ($nextValid) + ' = true; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
var $pgMin = $pgSchema.minimum,
|
||||
$pgMax = $pgSchema.maximum;
|
||||
if ($pgMin !== undefined || $pgMax !== undefined) {
|
||||
out += ' var ' + ($valid) + ' = true; ';
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
if ($pgMin !== undefined) {
|
||||
var $limit = $pgMin,
|
||||
$reason = 'minimum',
|
||||
$moreOrLess = 'less';
|
||||
out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; ';
|
||||
$errSchemaPath = it.errSchemaPath + '/patternGroups/minimum';
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($pgMax !== undefined) {
|
||||
out += ' else ';
|
||||
}
|
||||
}
|
||||
if ($pgMax !== undefined) {
|
||||
var $limit = $pgMax,
|
||||
$reason = 'maximum',
|
||||
$moreOrLess = 'more';
|
||||
out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; ';
|
||||
$errSchemaPath = it.errSchemaPath + '/patternGroups/maximum';
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
$errSchemaPath = $currErrSchemaPath;
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($valid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
|
5
node_modules/ajv/lib/dotjs/propertyNames.js
generated
vendored
5
node_modules/ajv/lib/dotjs/propertyNames.js
generated
vendored
@@ -13,6 +13,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
out += 'var ' + ($errs) + ' = errors;';
|
||||
if (it.util.schemaHasRules($schema, it.RULES.all)) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
@@ -26,7 +27,6 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
$dataProperties = 'dataProperties' + $lvl,
|
||||
$ownProperties = it.opts.ownProperties,
|
||||
$currentBaseId = it.baseId;
|
||||
out += ' var ' + ($errs) + ' = errors; ';
|
||||
if ($ownProperties) {
|
||||
out += ' var ' + ($dataProperties) + ' = undefined; ';
|
||||
}
|
||||
@@ -61,7 +61,8 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
|
7
node_modules/ajv/lib/dotjs/ref.js
generated
vendored
7
node_modules/ajv/lib/dotjs/ref.js
generated
vendored
@@ -40,7 +40,8 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -73,7 +74,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
}
|
||||
} else {
|
||||
$async = $refVal.$async === true;
|
||||
$async = $refVal.$async === true || (it.async && $refVal.$async !== false);
|
||||
$refCode = $refVal.code;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +101,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' var ' + ($valid) + '; ';
|
||||
}
|
||||
out += ' try { ' + (it.yieldAwait) + ' ' + (__callValidate) + '; ';
|
||||
out += ' try { await ' + (__callValidate) + '; ';
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($valid) + ' = true; ';
|
||||
}
|
||||
|
6
node_modules/ajv/lib/dotjs/required.js
generated
vendored
6
node_modules/ajv/lib/dotjs/required.js
generated
vendored
@@ -89,7 +89,8 @@ module.exports = function generate_required(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -148,7 +149,8 @@ module.exports = function generate_required(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
19
node_modules/ajv/lib/dotjs/uniqueItems.js
generated
vendored
19
node_modules/ajv/lib/dotjs/uniqueItems.js
generated
vendored
@@ -21,7 +21,21 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
|
||||
if ($isData) {
|
||||
out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { ';
|
||||
}
|
||||
out += ' var ' + ($valid) + ' = true; if (' + ($data) + '.length > 1) { var i = ' + ($data) + '.length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } } ';
|
||||
out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';
|
||||
var $itemType = it.schema.items && it.schema.items.type,
|
||||
$typeIsArray = Array.isArray($itemType);
|
||||
if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {
|
||||
out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';
|
||||
} 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; ';
|
||||
if ($typeIsArray) {
|
||||
out += ' if (typeof item == \'string\') item = \'"\' + item; ';
|
||||
}
|
||||
out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
@@ -49,7 +63,8 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
|
108
node_modules/ajv/lib/dotjs/validate.js
generated
vendored
108
node_modules/ajv/lib/dotjs/validate.js
generated
vendored
@@ -4,26 +4,21 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
var $async = it.schema.$async === true,
|
||||
$refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),
|
||||
$id = it.self._getId(it.schema);
|
||||
if (it.isTop) {
|
||||
if ($async) {
|
||||
it.async = true;
|
||||
var $es7 = it.opts.async == 'es7';
|
||||
it.yieldAwait = $es7 ? 'await' : 'yield';
|
||||
if (it.opts.strictKeywords) {
|
||||
var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
|
||||
if ($unknownKwd) {
|
||||
var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;
|
||||
if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);
|
||||
else throw new Error($keywordsMsg);
|
||||
}
|
||||
}
|
||||
if (it.isTop) {
|
||||
out += ' var validate = ';
|
||||
if ($async) {
|
||||
if ($es7) {
|
||||
out += ' (async function ';
|
||||
} else {
|
||||
if (it.opts.async != '*') {
|
||||
out += 'co.wrap';
|
||||
}
|
||||
out += '(function* ';
|
||||
}
|
||||
} else {
|
||||
out += ' (function ';
|
||||
it.async = true;
|
||||
out += 'async ';
|
||||
}
|
||||
out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';
|
||||
out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';
|
||||
if ($id && (it.opts.sourceCode || it.opts.processCode)) {
|
||||
out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' ';
|
||||
}
|
||||
@@ -62,7 +57,8 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -83,7 +79,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
}
|
||||
}
|
||||
if (it.isTop) {
|
||||
out += ' }); return validate; ';
|
||||
out += ' }; return validate; ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -96,6 +92,11 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
delete it.isTop;
|
||||
it.dataPathArr = [undefined];
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
out += ' var vErrors = null; ';
|
||||
out += ' var errors = 0; ';
|
||||
out += ' if (rootData === undefined) rootData = data; ';
|
||||
@@ -114,6 +115,14 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
var $errorKeyword;
|
||||
var $typeSchema = it.schema.type,
|
||||
$typeIsArray = Array.isArray($typeSchema);
|
||||
if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
|
||||
if ($typeIsArray) {
|
||||
if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null');
|
||||
} else if ($typeSchema != 'null') {
|
||||
$typeSchema = [$typeSchema, 'null'];
|
||||
$typeIsArray = true;
|
||||
}
|
||||
}
|
||||
if ($typeIsArray && $typeSchema.length == 1) {
|
||||
$typeSchema = $typeSchema[0];
|
||||
$typeIsArray = false;
|
||||
@@ -126,6 +135,9 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
}
|
||||
}
|
||||
if (it.schema.$comment && it.opts.$comment) {
|
||||
out += ' ' + (it.RULES.all.$comment.code(it, '$comment'));
|
||||
}
|
||||
if ($typeSchema) {
|
||||
if (it.opts.coerceTypes) {
|
||||
var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);
|
||||
@@ -207,7 +219,8 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -254,7 +267,8 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -280,9 +294,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
$closingBraces2 += '}';
|
||||
}
|
||||
} else {
|
||||
if (it.opts.v5 && it.schema.patternGroups) {
|
||||
it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');
|
||||
}
|
||||
var arr2 = it.RULES;
|
||||
if (arr2) {
|
||||
var $rulesGroup, i2 = -1,
|
||||
@@ -293,7 +304,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
if ($rulesGroup.type) {
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
|
||||
}
|
||||
if (it.opts.useDefaults && !it.compositeRule) {
|
||||
if (it.opts.useDefaults) {
|
||||
if ($rulesGroup.type == 'object' && it.schema.properties) {
|
||||
var $schema = it.schema.properties,
|
||||
$schemaKeys = Object.keys($schema);
|
||||
@@ -306,13 +317,25 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
var $sch = $schema[$propertyKey];
|
||||
if ($sch.default !== undefined) {
|
||||
var $passData = $data + it.util.getProperty($propertyKey);
|
||||
out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = ';
|
||||
if (it.opts.useDefaults == 'shared') {
|
||||
out += ' ' + (it.useDefault($sch.default)) + ' ';
|
||||
if (it.compositeRule) {
|
||||
if (it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored for: ' + $passData;
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
} else {
|
||||
out += ' ' + (JSON.stringify($sch.default)) + ' ';
|
||||
out += ' if (' + ($passData) + ' === undefined ';
|
||||
if (it.opts.useDefaults == 'empty') {
|
||||
out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';
|
||||
}
|
||||
out += ' ) ' + ($passData) + ' = ';
|
||||
if (it.opts.useDefaults == 'shared') {
|
||||
out += ' ' + (it.useDefault($sch.default)) + ' ';
|
||||
} else {
|
||||
out += ' ' + (JSON.stringify($sch.default)) + ' ';
|
||||
}
|
||||
out += '; ';
|
||||
}
|
||||
out += '; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,13 +348,25 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
$sch = arr4[$i += 1];
|
||||
if ($sch.default !== undefined) {
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = ';
|
||||
if (it.opts.useDefaults == 'shared') {
|
||||
out += ' ' + (it.useDefault($sch.default)) + ' ';
|
||||
if (it.compositeRule) {
|
||||
if (it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored for: ' + $passData;
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
} else {
|
||||
out += ' ' + (JSON.stringify($sch.default)) + ' ';
|
||||
out += ' if (' + ($passData) + ' === undefined ';
|
||||
if (it.opts.useDefaults == 'empty') {
|
||||
out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';
|
||||
}
|
||||
out += ' ) ' + ($passData) + ' = ';
|
||||
if (it.opts.useDefaults == 'shared') {
|
||||
out += ' ' + (it.useDefault($sch.default)) + ' ';
|
||||
} else {
|
||||
out += ' ' + (JSON.stringify($sch.default)) + ' ';
|
||||
}
|
||||
out += '; ';
|
||||
}
|
||||
out += '; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,7 +428,8 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
@@ -430,7 +466,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
out += ' validate.errors = vErrors; ';
|
||||
out += ' return errors === 0; ';
|
||||
}
|
||||
out += ' }); return validate;';
|
||||
out += ' }; return validate;';
|
||||
} else {
|
||||
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
|
||||
}
|
||||
|
Reference in New Issue
Block a user