@umijs/deps
Version:
[](https://packagephobia.now.sh/result?p=@umijs/deps)
1,753 lines (1,478 loc) • 1.02 MB
JavaScript
module.exports =
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 1161:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
module.exports = {
entry() {
return __nccwpck_require__(2350);
},
TypeScriptReporterRpcService() {
return __nccwpck_require__(5459);
},
EsLintReporterRpcService() {
return __nccwpck_require__(6125);
}
}
/***/ }),
/***/ 35:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var KEYWORDS = __nccwpck_require__(2197);
module.exports = defineKeywords;
/**
* Defines one or several keywords in ajv instance
* @param {Ajv} ajv validator instance
* @param {String|Array<String>|undefined} keyword keyword(s) to define
* @return {Ajv} ajv instance (for chaining)
*/
function defineKeywords(ajv, keyword) {
if (Array.isArray(keyword)) {
for (var i=0; i<keyword.length; i++)
get(keyword[i])(ajv);
return ajv;
}
if (keyword) {
get(keyword)(ajv);
return ajv;
}
for (keyword in KEYWORDS) get(keyword)(ajv);
return ajv;
}
defineKeywords.get = get;
function get(keyword) {
var defFunc = KEYWORDS[keyword];
if (!defFunc) throw new Error('Unknown keyword ' + keyword);
return defFunc;
}
/***/ }),
/***/ 315:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
var DATE_TIME_SEPARATOR = /t|\s/i;
var COMPARE_FORMATS = {
date: compareDate,
time: compareTime,
'date-time': compareDateTime
};
var $dataMetaSchema = {
type: 'object',
required: [ '$data' ],
properties: {
$data: {
type: 'string',
anyOf: [
{ format: 'relative-json-pointer' },
{ format: 'json-pointer' }
]
}
},
additionalProperties: false
};
module.exports = function (minMax) {
var keyword = 'format' + minMax;
return function defFunc(ajv) {
defFunc.definition = {
type: 'string',
inline: __nccwpck_require__(8666),
statements: true,
errors: 'full',
dependencies: ['format'],
metaSchema: {
anyOf: [
{type: 'string'},
$dataMetaSchema
]
}
};
ajv.addKeyword(keyword, defFunc.definition);
ajv.addKeyword('formatExclusive' + minMax, {
dependencies: ['format' + minMax],
metaSchema: {
anyOf: [
{type: 'boolean'},
$dataMetaSchema
]
}
});
extendFormats(ajv);
return ajv;
};
};
function extendFormats(ajv) {
var formats = ajv._formats;
for (var name in COMPARE_FORMATS) {
var format = formats[name];
// the last condition is needed if it's RegExp from another window
if (typeof format != 'object' || format instanceof RegExp || !format.validate)
format = formats[name] = { validate: format };
if (!format.compare)
format.compare = COMPARE_FORMATS[name];
}
}
function compareDate(d1, d2) {
if (!(d1 && d2)) return;
if (d1 > d2) return 1;
if (d1 < d2) return -1;
if (d1 === d2) return 0;
}
function compareTime(t1, t2) {
if (!(t1 && t2)) return;
t1 = t1.match(TIME);
t2 = t2.match(TIME);
if (!(t1 && t2)) return;
t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
if (t1 > t2) return 1;
if (t1 < t2) return -1;
if (t1 === t2) return 0;
}
function compareDateTime(dt1, dt2) {
if (!(dt1 && dt2)) return;
dt1 = dt1.split(DATE_TIME_SEPARATOR);
dt2 = dt2.split(DATE_TIME_SEPARATOR);
var res = compareDate(dt1[0], dt2[0]);
if (res === undefined) return;
return res || compareTime(dt1[1], dt2[1]);
}
/***/ }),
/***/ 221:
/***/ ((module) => {
"use strict";
module.exports = {
metaSchemaRef: metaSchemaRef
};
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
function metaSchemaRef(ajv) {
var defaultMeta = ajv._opts.defaultMeta;
if (typeof defaultMeta == 'string') return { $ref: defaultMeta };
if (ajv.getSchema(META_SCHEMA_ID)) return { $ref: META_SCHEMA_ID };
console.warn('meta schema not defined');
return {};
}
/***/ }),
/***/ 7321:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema, parentSchema) {
if (!schema) return true;
var properties = Object.keys(parentSchema.properties);
if (properties.length == 0) return true;
return {required: properties};
},
metaSchema: {type: 'boolean'},
dependencies: ['properties']
};
ajv.addKeyword('allRequired', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 8268:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema) {
if (schema.length == 0) return true;
if (schema.length == 1) return {required: schema};
var schemas = schema.map(function (prop) {
return {required: [prop]};
});
return {anyOf: schemas};
},
metaSchema: {
type: 'array',
items: {
type: 'string'
}
}
};
ajv.addKeyword('anyRequired', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 9007:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var util = __nccwpck_require__(221);
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema) {
var schemas = [];
for (var pointer in schema)
schemas.push(getSchema(pointer, schema[pointer]));
return {'allOf': schemas};
},
metaSchema: {
type: 'object',
propertyNames: {
type: 'string',
format: 'json-pointer'
},
additionalProperties: util.metaSchemaRef(ajv)
}
};
ajv.addKeyword('deepProperties', defFunc.definition);
return ajv;
};
function getSchema(jsonPointer, schema) {
var segments = jsonPointer.split('/');
var rootSchema = {};
var pointerSchema = rootSchema;
for (var i=1; i<segments.length; i++) {
var segment = segments[i];
var isLast = i == segments.length - 1;
segment = unescapeJsonPointer(segment);
var properties = pointerSchema.properties = {};
var items = undefined;
if (/[0-9]+/.test(segment)) {
var count = +segment;
items = pointerSchema.items = [];
while (count--) items.push({});
}
pointerSchema = isLast ? schema : {};
properties[segment] = pointerSchema;
if (items) items.push(pointerSchema);
}
return rootSchema;
}
function unescapeJsonPointer(str) {
return str.replace(/~1/g, '/').replace(/~0/g, '~');
}
/***/ }),
/***/ 6452:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
inline: function (it, keyword, schema) {
var expr = '';
for (var i=0; i<schema.length; i++) {
if (i) expr += ' && ';
expr += '(' + getData(schema[i], it.dataLevel) + ' !== undefined)';
}
return expr;
},
metaSchema: {
type: 'array',
items: {
type: 'string',
format: 'json-pointer'
}
}
};
ajv.addKeyword('deepRequired', defFunc.definition);
return ajv;
};
function getData(jsonPointer, lvl) {
var data = 'data' + (lvl || '');
if (!jsonPointer) return data;
var expr = data;
var segments = jsonPointer.split('/');
for (var i=1; i<segments.length; i++) {
var segment = segments[i];
data += getProperty(unescapeJsonPointer(segment));
expr += ' && ' + data;
}
return expr;
}
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
var INTEGER = /^[0-9]+$/;
var SINGLE_QUOTE = /'|\\/g;
function getProperty(key) {
return INTEGER.test(key)
? '[' + key + ']'
: IDENTIFIER.test(key)
? '.' + key
: "['" + key.replace(SINGLE_QUOTE, '\\$&') + "']";
}
function unescapeJsonPointer(str) {
return str.replace(/~1/g, '/').replace(/~0/g, '~');
}
/***/ }),
/***/ 8666:
/***/ ((module) => {
"use strict";
module.exports = function generate__formatLimit(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 $errorKeyword;
var $data = 'data' + ($dataLvl || '');
var $valid = 'valid' + $lvl;
out += 'var ' + ($valid) + ' = undefined;';
if (it.opts.format === false) {
out += ' ' + ($valid) + ' = true; ';
return out;
}
var $schemaFormat = it.schema.format,
$isDataFormat = it.opts.$data && $schemaFormat.$data,
$closingBraces = '';
if ($isDataFormat) {
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr),
$format = 'format' + $lvl,
$compare = 'compare' + $lvl;
out += ' var ' + ($format) + ' = formats[' + ($schemaValueFormat) + '] , ' + ($compare) + ' = ' + ($format) + ' && ' + ($format) + '.compare;';
} else {
var $format = it.formats[$schemaFormat];
if (!($format && $format.compare)) {
out += ' ' + ($valid) + ' = true; ';
return out;
}
var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare';
}
var $isMax = $keyword == 'formatMaximum',
$exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum'),
$schemaExcl = it.schema[$exclusiveKeyword],
$isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
$op = $isMax ? '<' : '>',
$result = 'result' + $lvl;
var $isData = it.opts.$data && $schema && $schema.$data,
$schemaValue;
if ($isData) {
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
$schemaValue = 'schema' + $lvl;
} else {
$schemaValue = $schema;
}
if ($isDataExcl) {
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
$exclusive = 'exclusive' + $lvl,
$opExpr = 'op' + $lvl,
$opStr = '\' + ' + $opExpr + ' + \'';
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
$schemaValueExcl = 'schemaExcl' + $lvl;
out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; ';
var $errorKeyword = $exclusiveKeyword;
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
if (it.opts.messages !== false) {
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
}
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 ($breakOnError) {
$closingBraces += '}';
out += ' else { ';
}
if ($isData) {
out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
$closingBraces += '}';
}
if ($isDataFormat) {
out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
$closingBraces += '}';
}
out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
if ($isData) {
out += '' + ($schemaValue);
} else {
out += '' + (it.util.toQuotedString($schema));
}
out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
} else {
var $exclusive = $schemaExcl === true,
$opStr = $op;
if (!$exclusive) $opStr += '=';
var $opExpr = '\'' + $opStr + '\'';
if ($isData) {
out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
$closingBraces += '}';
}
if ($isDataFormat) {
out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
$closingBraces += '}';
}
out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
if ($isData) {
out += '' + ($schemaValue);
} else {
out += '' + (it.util.toQuotedString($schema));
}
out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op);
if (!$exclusive) {
out += '=';
}
out += ' 0;';
}
out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
var $errorKeyword = $keyword;
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ';
if ($isData) {
out += '' + ($schemaValue);
} else {
out += '' + (it.util.toQuotedString($schema));
}
out += ' , exclusive: ' + ($exclusive) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should be ' + ($opStr) + ' "';
if ($isData) {
out += '\' + ' + ($schemaValue) + ' + \'';
} else {
out += '' + (it.util.escapeQuotes($schema));
}
out += '"\' ';
}
if (it.opts.verbose) {
out += ' , schema: ';
if ($isData) {
out += 'validate.schema' + ($schemaPath);
} else {
out += '' + (it.util.toQuotedString($schema));
}
out += ' , 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 += '}';
return out;
}
/***/ }),
/***/ 1786:
/***/ ((module) => {
"use strict";
module.exports = function generate_patternRequired(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 $key = 'key' + $lvl,
$idx = 'idx' + $lvl,
$matched = 'patternMatched' + $lvl,
$dataProperties = 'dataProperties' + $lvl,
$closingBraces = '',
$ownProperties = it.opts.ownProperties;
out += 'var ' + ($valid) + ' = true;';
if ($ownProperties) {
out += ' var ' + ($dataProperties) + ' = undefined;';
}
var arr1 = $schema;
if (arr1) {
var $pProperty, i1 = -1,
l1 = arr1.length - 1;
while (i1 < l1) {
$pProperty = arr1[i1 += 1];
out += ' var ' + ($matched) + ' = false; ';
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 += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } ';
var $missingPattern = it.util.escapeQuotes($pProperty);
out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' ';
}
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 ($breakOnError) {
$closingBraces += '}';
out += ' else { ';
}
}
}
out += '' + ($closingBraces);
return out;
}
/***/ }),
/***/ 9538:
/***/ ((module) => {
"use strict";
module.exports = function generate_switch(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);
var $closingBraces = '';
$it.level++;
var $nextValid = 'valid' + $it.level;
var $ifPassed = 'ifPassed' + it.level,
$currentBaseId = $it.baseId,
$shouldContinue;
out += 'var ' + ($ifPassed) + ';';
var arr1 = $schema;
if (arr1) {
var $sch, $caseIndex = -1,
l1 = arr1.length - 1;
while ($caseIndex < l1) {
$sch = arr1[$caseIndex += 1];
if ($caseIndex && !$shouldContinue) {
out += ' if (!' + ($ifPassed) + ') { ';
$closingBraces += '}';
}
if ($sch.if && (it.opts.strictKeywords ? typeof $sch.if == 'object' && Object.keys($sch.if).length > 0 : it.util.schemaHasRules($sch.if, it.RULES.all))) {
out += ' var ' + ($errs) + ' = errors; ';
var $wasComposite = it.compositeRule;
it.compositeRule = $it.compositeRule = true;
$it.createErrors = false;
$it.schema = $sch.if;
$it.schemaPath = $schemaPath + '[' + $caseIndex + '].if';
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/if';
out += ' ' + (it.validate($it)) + ' ';
$it.baseId = $currentBaseId;
$it.createErrors = true;
it.compositeRule = $it.compositeRule = $wasComposite;
out += ' ' + ($ifPassed) + ' = ' + ($nextValid) + '; if (' + ($ifPassed) + ') { ';
if (typeof $sch.then == 'boolean') {
if ($sch.then === false) {
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should pass "switch" keyword validation\' ';
}
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 += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
} else {
$it.schema = $sch.then;
$it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
out += ' ' + (it.validate($it)) + ' ';
$it.baseId = $currentBaseId;
}
out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } } ';
} else {
out += ' ' + ($ifPassed) + ' = true; ';
if (typeof $sch.then == 'boolean') {
if ($sch.then === false) {
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should pass "switch" keyword validation\' ';
}
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 += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
} else {
$it.schema = $sch.then;
$it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
out += ' ' + (it.validate($it)) + ' ';
$it.baseId = $currentBaseId;
}
}
$shouldContinue = $sch.continue
}
}
out += '' + ($closingBraces) + 'var ' + ($valid) + ' = ' + ($nextValid) + ';';
return out;
}
/***/ }),
/***/ 6181:
/***/ ((module) => {
"use strict";
var sequences = {};
var DEFAULTS = {
timestamp: function() { return Date.now(); },
datetime: function() { return (new Date).toISOString(); },
date: function() { return (new Date).toISOString().slice(0, 10); },
time: function() { return (new Date).toISOString().slice(11); },
random: function() { return Math.random(); },
randomint: function (args) {
var limit = args && args.max || 2;
return function() { return Math.floor(Math.random() * limit); };
},
seq: function (args) {
var name = args && args.name || '';
sequences[name] = sequences[name] || 0;
return function() { return sequences[name]++; };
}
};
module.exports = function defFunc(ajv) {
defFunc.definition = {
compile: function (schema, parentSchema, it) {
var funcs = {};
for (var key in schema) {
var d = schema[key];
var func = getDefault(typeof d == 'string' ? d : d.func);
funcs[key] = func.length ? func(d.args) : func;
}
return it.opts.useDefaults && !it.compositeRule
? assignDefaults
: noop;
function assignDefaults(data) {
for (var prop in schema){
if (data[prop] === undefined
|| (it.opts.useDefaults == 'empty'
&& (data[prop] === null || data[prop] === '')))
data[prop] = funcs[prop]();
}
return true;
}
function noop() { return true; }
},
DEFAULTS: DEFAULTS,
metaSchema: {
type: 'object',
additionalProperties: {
type: ['string', 'object'],
additionalProperties: false,
required: ['func', 'args'],
properties: {
func: { type: 'string' },
args: { type: 'object' }
}
}
}
};
ajv.addKeyword('dynamicDefaults', defFunc.definition);
return ajv;
function getDefault(d) {
var def = DEFAULTS[d];
if (def) return def;
throw new Error('invalid "dynamicDefaults" keyword property value: ' + d);
}
};
/***/ }),
/***/ 3552:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
module.exports = __nccwpck_require__(315)('Maximum');
/***/ }),
/***/ 2495:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
module.exports = __nccwpck_require__(315)('Minimum');
/***/ }),
/***/ 2197:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
module.exports = {
'instanceof': __nccwpck_require__(6103),
range: __nccwpck_require__(4614),
regexp: __nccwpck_require__(9531),
'typeof': __nccwpck_require__(2895),
dynamicDefaults: __nccwpck_require__(6181),
allRequired: __nccwpck_require__(7321),
anyRequired: __nccwpck_require__(8268),
oneRequired: __nccwpck_require__(6996),
prohibited: __nccwpck_require__(5655),
uniqueItemProperties: __nccwpck_require__(1067),
deepProperties: __nccwpck_require__(9007),
deepRequired: __nccwpck_require__(6452),
formatMinimum: __nccwpck_require__(2495),
formatMaximum: __nccwpck_require__(3552),
patternRequired: __nccwpck_require__(6753),
'switch': __nccwpck_require__(7461),
select: __nccwpck_require__(605),
transform: __nccwpck_require__(9673)
};
/***/ }),
/***/ 6103:
/***/ ((module) => {
"use strict";
var CONSTRUCTORS = {
Object: Object,
Array: Array,
Function: Function,
Number: Number,
String: String,
Date: Date,
RegExp: RegExp
};
module.exports = function defFunc(ajv) {
/* istanbul ignore else */
if (typeof Buffer != 'undefined')
CONSTRUCTORS.Buffer = Buffer;
/* istanbul ignore else */
if (typeof Promise != 'undefined')
CONSTRUCTORS.Promise = Promise;
defFunc.definition = {
compile: function (schema) {
if (typeof schema == 'string') {
var Constructor = getConstructor(schema);
return function (data) {
return data instanceof Constructor;
};
}
var constructors = schema.map(getConstructor);
return function (data) {
for (var i=0; i<constructors.length; i++)
if (data instanceof constructors[i]) return true;
return false;
};
},
CONSTRUCTORS: CONSTRUCTORS,
metaSchema: {
anyOf: [
{ type: 'string' },
{
type: 'array',
items: { type: 'string' }
}
]
}
};
ajv.addKeyword('instanceof', defFunc.definition);
return ajv;
function getConstructor(c) {
var Constructor = CONSTRUCTORS[c];
if (Constructor) return Constructor;
throw new Error('invalid "instanceof" keyword value ' + c);
}
};
/***/ }),
/***/ 6996:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema) {
if (schema.length == 0) return true;
if (schema.length == 1) return {required: schema};
var schemas = schema.map(function (prop) {
return {required: [prop]};
});
return {oneOf: schemas};
},
metaSchema: {
type: 'array',
items: {
type: 'string'
}
}
};
ajv.addKeyword('oneRequired', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 6753:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
inline: __nccwpck_require__(1786),
statements: true,
errors: 'full',
metaSchema: {
type: 'array',
items: {
type: 'string',
format: 'regex'
},
uniqueItems: true
}
};
ajv.addKeyword('patternRequired', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 5655:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema) {
if (schema.length == 0) return true;
if (schema.length == 1) return {not: {required: schema}};
var schemas = schema.map(function (prop) {
return {required: [prop]};
});
return {not: {anyOf: schemas}};
},
metaSchema: {
type: 'array',
items: {
type: 'string'
}
}
};
ajv.addKeyword('prohibited', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 4614:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'number',
macro: function (schema, parentSchema) {
var min = schema[0]
, max = schema[1]
, exclusive = parentSchema.exclusiveRange;
validateRangeSchema(min, max, exclusive);
return exclusive === true
? {exclusiveMinimum: min, exclusiveMaximum: max}
: {minimum: min, maximum: max};
},
metaSchema: {
type: 'array',
minItems: 2,
maxItems: 2,
items: { type: 'number' }
}
};
ajv.addKeyword('range', defFunc.definition);
ajv.addKeyword('exclusiveRange');
return ajv;
function validateRangeSchema(min, max, exclusive) {
if (exclusive !== undefined && typeof exclusive != 'boolean')
throw new Error('Invalid schema for exclusiveRange keyword, should be boolean');
if (min > max || (exclusive && min == max))
throw new Error('There are no numbers in range');
}
};
/***/ }),
/***/ 9531:
/***/ ((module) => {
"use strict";
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'string',
inline: function (it, keyword, schema) {
return getRegExp() + '.test(data' + (it.dataLevel || '') + ')';
function getRegExp() {
try {
if (typeof schema == 'object')
return new RegExp(schema.pattern, schema.flags);
var rx = schema.match(/^\/(.*)\/([gimuy]*)$/);
if (rx) return new RegExp(rx[1], rx[2]);
throw new Error('cannot parse string into RegExp');
} catch(e) {
console.error('regular expression', schema, 'is invalid');
throw e;
}
}
},
metaSchema: {
type: ['string', 'object'],
properties: {
pattern: { type: 'string' },
flags: { type: 'string' }
},
required: ['pattern'],
additionalProperties: false
}
};
ajv.addKeyword('regexp', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 605:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var util = __nccwpck_require__(221);
module.exports = function defFunc(ajv) {
if (!ajv._opts.$data) {
console.warn('keyword select requires $data option');
return ajv;
}
var metaSchemaRef = util.metaSchemaRef(ajv);
var compiledCaseSchemas = [];
defFunc.definition = {
validate: function v(schema, data, parentSchema) {
if (parentSchema.selectCases === undefined)
throw new Error('keyword "selectCases" is absent');
var compiled = getCompiledSchemas(parentSchema, false);
var validate = compiled.cases[schema];
if (validate === undefined) validate = compiled.default;
if (typeof validate == 'boolean') return validate;
var valid = validate(data);
if (!valid) v.errors = validate.errors;
return valid;
},
$data: true,
metaSchema: { type: ['string', 'number', 'boolean', 'null'] }
};
ajv.addKeyword('select', defFunc.definition);
ajv.addKeyword('selectCases', {
compile: function (schemas, parentSchema) {
var compiled = getCompiledSchemas(parentSchema);
for (var value in schemas)
compiled.cases[value] = compileOrBoolean(schemas[value]);
return function() { return true; };
},
valid: true,
metaSchema: {
type: 'object',
additionalProperties: metaSchemaRef
}
});
ajv.addKeyword('selectDefault', {
compile: function (schema, parentSchema) {
var compiled = getCompiledSchemas(parentSchema);
compiled.default = compileOrBoolean(schema);
return function() { return true; };
},
valid: true,
metaSchema: metaSchemaRef
});
return ajv;
function getCompiledSchemas(parentSchema, create) {
var compiled;
compiledCaseSchemas.some(function (c) {
if (c.parentSchema === parentSchema) {
compiled = c;
return true;
}
});
if (!compiled && create !== false) {
compiled = {
parentSchema: parentSchema,
cases: {},
default: true
};
compiledCaseSchemas.push(compiled);
}
return compiled;
}
function compileOrBoolean(schema) {
return typeof schema == 'boolean'
? schema
: ajv.compile(schema);
}
};
/***/ }),
/***/ 7461:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var util = __nccwpck_require__(221);
module.exports = function defFunc(ajv) {
if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return;
var metaSchemaRef = util.metaSchemaRef(ajv);
defFunc.definition = {
inline: __nccwpck_require__(9538),
statements: true,
errors: 'full',
metaSchema: {
type: 'array',
items: {
required: [ 'then' ],
properties: {
'if': metaSchemaRef,
'then': {
anyOf: [
{ type: 'boolean' },
metaSchemaRef
]
},
'continue': { type: 'boolean' }
},
additionalProperties: false,
dependencies: {
'continue': [ 'if' ]
}
}
}
};
ajv.addKeyword('switch', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 9673:
/***/ ((module) => {
"use strict";
module.exports = function defFunc (ajv) {
var transform = {
trimLeft: function (value) {
return value.replace(/^[\s]+/, '');
},
trimRight: function (value) {
return value.replace(/[\s]+$/, '');
},
trim: function (value) {
return value.trim();
},
toLowerCase: function (value) {
return value.toLowerCase();
},
toUpperCase: function (value) {
return value.toUpperCase();
},
toEnumCase: function (value, cfg) {
return cfg.hash[makeHashTableKey(value)] || value;
}
};
defFunc.definition = {
type: 'string',
errors: false,
modifying: true,
valid: true,
compile: function (schema, parentSchema) {
var cfg;
if (schema.indexOf('toEnumCase') !== -1) {
// build hash table to enum values
cfg = {hash: {}};
// requires `enum` in schema
if (!parentSchema.enum)
throw new Error('Missing enum. To use `transform:["toEnumCase"]`, `enum:[...]` is required.');
for (var i = parentSchema.enum.length; i--; i) {
var v = parentSchema.enum[i];
if (typeof v !== 'string') continue;
var k = makeHashTableKey(v);
// requires all `enum` values have unique keys
if (cfg.hash[k])
throw new Error('Invalid enum uniqueness. To use `transform:["toEnumCase"]`, all values must be unique when case insensitive.');
cfg.hash[k] = v;
}
}
return function (data, dataPath, object, key) {
// skip if value only
if (!object) return;
// apply transform in order provided
for (var j = 0, l = schema.length; j < l; j++)
data = transform[schema[j]](data, cfg);
object[key] = data;
};
},
metaSchema: {
type: 'array',
items: {
type: 'string',
enum: [
'trimLeft', 'trimRight', 'trim',
'toLowerCase', 'toUpperCase', 'toEnumCase'
]
}
}
};
ajv.addKeyword('transform', defFunc.definition);
return ajv;
function makeHashTableKey (value) {
return value.toLowerCase();
}
};
/***/ }),
/***/ 2895:
/***/ ((module) => {
"use strict";
var KNOWN_TYPES = ['undefined', 'string', 'number', 'object', 'function', 'boolean', 'symbol'];
module.exports = function defFunc(ajv) {
defFunc.definition = {
inline: function (it, keyword, schema) {
var data = 'data' + (it.dataLevel || '');
if (typeof schema == 'string') return 'typeof ' + data + ' == "' + schema + '"';
schema = 'validate.schema' + it.schemaPath + '.' + keyword;
return schema + '.indexOf(typeof ' + data + ') >= 0';
},
metaSchema: {
anyOf: [
{
type: 'string',
enum: KNOWN_TYPES
},
{
type: 'array',
items: {
type: 'string',
enum: KNOWN_TYPES
}
}
]
}
};
ajv.addKeyword('typeof', defFunc.definition);
return ajv;
};
/***/ }),
/***/ 1067:
/***/ ((module) => {
"use strict";
var SCALAR_TYPES = ['number', 'integer', 'string', 'boolean', 'null'];
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'array',
compile: function(keys, parentSchema, it) {
var equal = it.util.equal;
var scalar = getScalarKeys(keys, parentSchema);
return function(data) {
if (data.length > 1) {
for (var k=0; k < keys.length; k++) {
var i, key = keys[k];
if (scalar[k]) {
var hash = {};
for (i = data.length; i--;) {
if (!data[i] || typeof data[i] != 'object') continue;
var prop = data[i][key];
if (prop && typeof prop == 'object') continue;
if (typeof prop == 'string') prop = '"' + prop;
if (hash[prop]) return false;
hash[prop] = true;
}
} else {
for (i = data.length; i--;) {
if (!data[i] || typeof data[i] != 'object') continue;
for (var j = i; j--;) {
if (data[j] && typeof data[j] == 'object' && equal(data[i][key], data[j][key]))
return false;
}
}
}
}
}
return true;
};
},
metaSchema: {
type: 'array',
items: {type: 'string'}
}
};
ajv.addKeyword('uniqueItemProperties', defFunc.definition);
return ajv;
};
function getScalarKeys(keys, schema) {
return keys.map(function(key) {
var properties = schema.items && schema.items.properties;
var propType = properties && properties[key] && properties[key].type;
return Array.isArray(propType)
? propType.indexOf('object') < 0 && propType.indexOf('array') < 0
: SCALAR_TYPES.indexOf(propType) >= 0;
});
}
/***/ }),
/***/ 4941:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var compileSchema = __nccwpck_require__(875)
, resolve = __nccwpck_require__(3896)
, Cache = __nccwpck_require__(3679)
, SchemaObject = __nccwpck_require__(7605)
, stableStringify = __nccwpck_require__(969)
, formats = __nccwpck_require__(6627)
, rules = __nccwpck_require__(8561)
, $dataMetaSchema = __nccwpck_require__(1412)
, util = __nccwpck_require__(6578);
module.exports = Ajv;
Ajv.prototype.validate = validate;
Ajv.prototype.compile = compile;
Ajv.prototype.addSchema = addSchema;
Ajv.prototype.addMetaSchema = addMetaSchema;
Ajv.prototype.validateSchema = validateSchema;
Ajv.prototype.getSchema = getSchema;
Ajv.prototype.removeSchema = removeSchema;
Ajv.prototype.addFormat = addFormat;
Ajv.prototype.errorsText = errorsText;
Ajv.prototype._addSchema = _addSchema;
Ajv.prototype._compile = _compile;
Ajv.prototype.compileAsync = __nccwpck_require__(890);
var customKeyword = __nccwpck_require__(3297);
Ajv.prototype.addKeyword = customKeyword.add;
Ajv.prototype.getKeyword = customKeyword.get;
Ajv.prototype.removeKeyword = customKeyword.remove;
Ajv.prototype.validateKeyword = customKeyword.validate;
var errorClasses = __nccwpck_require__(5726);
Ajv.ValidationError = errorClasses.Validation;
Ajv.MissingRefError = errorClasses.MissingRef;
Ajv.$dataMetaSchema = $dataMetaSchema;
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
var META_SUPPORT_DATA = ['/properties'];
/**
* Creates validator instance.
* Usage: `Ajv(opts)`
* @param {Object} opts optional options
* @return {Object} ajv instance
*/
function Ajv(opts) {
if (!(this instanceof Ajv)) return new Ajv(opts);
opts = this._opts = util.copy(opts) || {};
setLogger(this);
this._schemas = {};
this._refs = {};
this._fragments = {};
this._formats = formats(opts.format);
this._cache = opts.cache || new Cache;
this._loadingSchemas = {};
this._compilations = [];
this.RULES = rules();
this._getId = chooseGetId(opts);
opts.loopRequired = opts.loopRequired || Infinity;
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
if (opts.serialize === undefined) opts.serialize = stableStringify;
this._metaOpts = getMetaSchemaOptions(this);
if (opts.formats) addInitialFormats(this);
if (opts.keywords) addInitialKeywords(this);
addDefaultMetaSchema(this);
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
addInitialSchemas(this);
}
/**
* Validate data using schema
* Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.
* @this Ajv
* @param {String|Object} schemaKeyRef key, ref or schema object
* @param {Any} data to be validated
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
*/
function validate(schemaKeyRef, data) {
var v;
if (typeof schemaKeyRef == 'string') {
v = this.getSchema(schemaKeyRef);
if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
} else {
var schemaObj = this._addSchema(schemaKeyRef);
v = schemaObj.validate || this._compile(schemaObj);
}
var valid = v(data);
if (v.$async !== true) this.errors = v.errors;
return valid;
}
/**
* Create validating function for passed schema.
* @this Ajv
* @param {Object} schema schema object
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
* @return {Function} validating function
*/
function compile(schema, _meta) {
var schemaObj = this._addSchema(schema, undefined, _meta);
return schemaObj.validate || this._compile(schemaObj);
}
/**
* Adds schema to the instance.
* @this Ajv
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
* @return {Ajv} this for method chaining
*/
function addSchema(schema, key, _skipValidation, _meta) {
if (Array.isArray(schema)){
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
return this;
}
var id = this._getId(schema);
if (id !== undefined && typeof id != 'string')
throw new Error('schema id must be string');
key = resolve.normalizeId(key || id);
checkUnique(this, key);
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
return this;
}
/**
* Add schema that will be used to validate other schemas
* options in META_IGNORE_OPTIONS are alway set to false
* @this Ajv
* @param {Object} schema schema object
* @param {String} key optional schema key
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
* @return {Ajv} this for method chaining
*/
function addMetaSchema(schema, key, skipValidation) {
this.addSchema(schema, key, skipValidation, true);
return this;
}
/**
* Validate schema
* @this Ajv
* @param {Object} schema schema to validate
* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
* @return {Boolean} true if schema is valid
*/
function validateSchema(schema, throwOrLogError) {
var $schema = schema.$schema;
if ($schema !== undefined && typeof $schema != 'string')
throw new Error('$schema must be a string');
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
if (!$schema) {
this.logger.warn('meta-schema not available');
this.errors = null;
return true;
}
var valid = this.validate($schema, schema);
if (!valid && throwOrLogError) {
var message = 'schema is invalid: ' + this.errorsText();
if (this._opts.validateSchema == 'log') this.logger.error(message);
else throw new Error(message);
}
return valid;
}
function defaultMeta(self) {
var meta = self._opts.meta;
self._opts.defaultMeta = typeof meta == 'object'
? self._getId(meta) || meta
: self.getSchema(META_SCHEMA_ID)
? META_SCHEMA_ID
: undefined;
return self._opts.defaultMeta;
}
/**
* Get compiled schema from the instance by `key` or `ref`.
* @this Ajv
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
* @return {Function} schema validating function (with property `schema`).
*/
function getSchema(keyRef) {
var schemaObj = _getSchemaObj(this, keyRef);
switch (typeof schemaObj) {
case 'object': return schemaObj.validate || this._compile(schemaObj);
case 'string': return this.getSchema(schemaObj);
case 'undefined': return _getSchemaFragment(this, keyRef);
}
}
function _getSchemaFragment(self, ref) {
var res = resolve.schema.call(self, { schema: {} }, ref);
if (res) {
var schema = res.schema
, root = res.root
, baseId = res.baseId;
var v = compileSchema.call(self, schema, root, undefined, baseId);
self._fragments[ref] = new SchemaObject({
ref: ref,
fragment: true,
schema: schema,
root: root,
baseId: baseId,
validate: v
});
return v;
}
}
function _getSchemaObj(self, keyRef) {
keyRef = resolve.normalizeId(keyRef);
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
}
/**
* Remove cached schema(s).
* If no parameter is passed all schemas but meta-schemas are removed.
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
* @this Ajv
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
* @return {Ajv} this for method chaining
*/
function removeSchema(schemaKeyRef) {
if (schemaKeyRef instanceof RegExp) {
_removeAllSchemas(this, this._schemas, schemaKeyRef);
_removeAllSchemas(this, this._refs, schemaKeyRef);
return this;
}
switch (typeof schemaKeyRef) {
case 'undefined':
_removeAllSchemas(this, this._schemas);
_removeAllSchemas(this, this._refs);
this._cache.clear();
return this;
case 'string':
var schemaObj = _getSchemaObj(this, schemaKeyRef);
if (schemaObj) this._cache.del(schemaObj.cacheKey);
delete this._schemas[schemaKeyRef];
delete this._refs[schemaKeyRef];
return this;
case 'object':
var serialize = this._opts.serialize;
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
this._cache.del(cacheKey);
var id = this._getId(schemaKeyRef);
if (id) {
id = re