Framework updates
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
5
node_modules/ajv/lib/ajv.d.ts
generated
vendored
5
node_modules/ajv/lib/ajv.d.ts
generated
vendored
@@ -203,6 +203,11 @@ declare namespace ajv {
|
||||
logger?: CustomLogger | false;
|
||||
nullable?: boolean;
|
||||
serialize?: ((schema: object | boolean) => any) | false;
|
||||
regExp?: (pattern: string) => RegExpLike;
|
||||
}
|
||||
|
||||
interface RegExpLike {
|
||||
test: (s: string) => boolean;
|
||||
}
|
||||
|
||||
type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike<any>);
|
||||
|
||||
14
node_modules/ajv/lib/compile/index.js
generated
vendored
14
node_modules/ajv/lib/compile/index.js
generated
vendored
@@ -42,6 +42,11 @@ function compile(schema, root, localRefs, baseId) {
|
||||
, defaultsHash = {}
|
||||
, customRules = [];
|
||||
|
||||
function patternCode(i, patterns) {
|
||||
var regExpCode = opts.regExp ? 'regExp' : 'new RegExp';
|
||||
return 'var pattern' + i + ' = ' + regExpCode + '(' + util.toQuotedString(patterns[i]) + ');';
|
||||
}
|
||||
|
||||
root = root || { schema: schema, refVal: refVal, refs: refs };
|
||||
|
||||
var c = checkCompiling.call(this, schema, root, baseId);
|
||||
@@ -128,6 +133,7 @@ function compile(schema, root, localRefs, baseId) {
|
||||
'equal',
|
||||
'ucs2length',
|
||||
'ValidationError',
|
||||
'regExp',
|
||||
sourceCode
|
||||
);
|
||||
|
||||
@@ -141,7 +147,8 @@ function compile(schema, root, localRefs, baseId) {
|
||||
customRules,
|
||||
equal,
|
||||
ucs2length,
|
||||
ValidationError
|
||||
ValidationError,
|
||||
opts.regExp
|
||||
);
|
||||
|
||||
refVal[0] = validate;
|
||||
@@ -358,11 +365,6 @@ function compIndex(schema, root, baseId) {
|
||||
}
|
||||
|
||||
|
||||
function patternCode(i, patterns) {
|
||||
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
||||
}
|
||||
|
||||
|
||||
function defaultCode(i) {
|
||||
return 'var default' + i + ' = defaults[' + i + '];';
|
||||
}
|
||||
|
||||
19
node_modules/ajv/lib/dot/pattern.jst
generated
vendored
19
node_modules/ajv/lib/dot/pattern.jst
generated
vendored
@@ -4,11 +4,22 @@
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $regexp = $isData
|
||||
? '(new RegExp(' + $schemaValue + '))'
|
||||
: it.usePattern($schema);
|
||||
var $regExpCode = it.opts.regExp ? 'regExp' : 'new RegExp';
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
|
||||
{{? $isData }}
|
||||
var {{=$valid}} = true;
|
||||
try {
|
||||
{{=$valid}} = {{=$regExpCode}}({{=$schemaValue}}).test({{=$data}});
|
||||
} catch(e) {
|
||||
{{=$valid}} = false;
|
||||
}
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$valid}}) {
|
||||
{{??}}
|
||||
{{
|
||||
var $regexp = it.usePattern($schema);
|
||||
}}
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
|
||||
{{?}}
|
||||
{{# def.error:'pattern' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
|
||||
18
node_modules/ajv/lib/dotjs/pattern.js
generated
vendored
18
node_modules/ajv/lib/dotjs/pattern.js
generated
vendored
@@ -8,6 +8,7 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
@@ -16,12 +17,21 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
|
||||
out += 'if ( ';
|
||||
var $regExpCode = it.opts.regExp ? 'regExp' : 'new RegExp';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
|
||||
out += ' var ' + ($valid) + ' = true; try { ' + ($valid) + ' = ' + ($regExpCode) + '(' + ($schemaValue) + ').test(' + ($data) + '); } catch(e) { ' + ($valid) + ' = false; } if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
|
||||
}
|
||||
out += ' !' + ($valid) + ') {';
|
||||
} else {
|
||||
var $regexp = it.usePattern($schema);
|
||||
out += ' if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
|
||||
}
|
||||
out += ' !' + ($regexp) + '.test(' + ($data) + ') ) {';
|
||||
}
|
||||
out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
|
||||
Reference in New Issue
Block a user