Framework updates
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
20
node_modules/ajv/README.md
generated
vendored
20
node_modules/ajv/README.md
generated
vendored
@@ -6,7 +6,7 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/
|
||||
|
||||
[](https://travis-ci.org/ajv-validator/ajv)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://www.npmjs.com/package/ajv/v/7.0.0-beta.0)
|
||||
[](https://www.npmjs.com/package/ajv/v/7.0.0-beta.4)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://coveralls.io/github/ajv-validator/ajv?branch=master)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
@@ -15,12 +15,13 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/
|
||||
|
||||
## Ajv v7 beta is released
|
||||
|
||||
[Ajv version 7.0.0-beta.0](https://github.com/ajv-validator/ajv/tree/v7-beta) is released with these changes:
|
||||
[Ajv version 7 (beta)](https://github.com/ajv-validator/ajv/tree/v7-beta) is released with these changes:
|
||||
|
||||
- support of JSON Schema draft-2019-09 features: [`unevaluatedProperties`](./json-schema.md#unevaluatedproperties) and [`unevaluatedItems`](./json-schema.md#unevaluateditems), [dynamic recursive references](./validation.md#extending-recursive-schemas) and other [additional keywords](./json-schema.md#json-schema-draft-2019-09).
|
||||
- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements.
|
||||
- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe.
|
||||
- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas.
|
||||
- schemas are compiled to ES6 code (ES5 code generation is supported with an option).
|
||||
- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe and to allow code optimization (compiled schema code size is reduced by more than 10%).
|
||||
- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package was updated to use the new API (in [v4.0.0-beta.0](https://github.com/ajv-validator/ajv-keywords/releases/tag/v4.0.0-beta.0))
|
||||
- schemas are compiled to ES6 code (ES5 code generation is also supported with an option).
|
||||
- to improve reliability and maintainability the code is migrated to TypeScript.
|
||||
|
||||
**Please note**:
|
||||
@@ -1214,7 +1215,8 @@ Defaults:
|
||||
sourceCode: false,
|
||||
processCode: undefined, // function (str: string, schema: object): string {}
|
||||
cache: new Cache,
|
||||
serialize: undefined
|
||||
serialize: undefined,
|
||||
regExp: undefined // custom RegExp engine
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1328,6 +1330,11 @@ Defaults:
|
||||
- `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/ajv-validator/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information.
|
||||
- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`.
|
||||
- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used.
|
||||
- _regExp_: an optional function to create RegExp objects. This allows using a custom RegExp engine (e.g., [RE2](https://github.com/uhop/node-re2)) to mitigate ReDoS attacks. The function must have the signature `(pattern: string) => RegExpLike` where `RegExpLike` is an object with a `test(string) => boolean` method. Example with RE2:
|
||||
```javascript
|
||||
var ajv = new Ajv({regExp: require('re2')});
|
||||
```
|
||||
By default (`undefined`), native `RegExp` constructor is used.
|
||||
|
||||
|
||||
## Validation errors
|
||||
@@ -1451,6 +1458,7 @@ If you have published a useful plugin please submit a PR to add it to the next s
|
||||
- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter
|
||||
- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages
|
||||
- [ESLint](https://github.com/eslint/eslint) - the pluggable linting utility for JavaScript and JSX
|
||||
- [Spectral](https://github.com/stoplightio/spectral) - the customizable linting utility for JSON/YAML, OpenAPI, AsyncAPI, and JSON Schema
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
34
node_modules/ajv/dist/ajv.bundle.js
generated
vendored
34
node_modules/ajv/dist/ajv.bundle.js
generated
vendored
@@ -343,6 +343,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);
|
||||
@@ -429,6 +434,7 @@ function compile(schema, root, localRefs, baseId) {
|
||||
'equal',
|
||||
'ucs2length',
|
||||
'ValidationError',
|
||||
'regExp',
|
||||
sourceCode
|
||||
);
|
||||
|
||||
@@ -442,7 +448,8 @@ function compile(schema, root, localRefs, baseId) {
|
||||
customRules,
|
||||
equal,
|
||||
ucs2length,
|
||||
ValidationError
|
||||
ValidationError,
|
||||
opts.regExp
|
||||
);
|
||||
|
||||
refVal[0] = validate;
|
||||
@@ -659,11 +666,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 + '];';
|
||||
}
|
||||
@@ -3239,6 +3241,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) {
|
||||
@@ -3247,12 +3250,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 */
|
||||
@@ -5233,7 +5245,7 @@ function escapeJsonPtr(str) {
|
||||
}
|
||||
|
||||
},{}],45:[function(require,module,exports){
|
||||
/** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
||||
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
|
||||
4
node_modules/ajv/dist/ajv.min.js
generated
vendored
4
node_modules/ajv/dist/ajv.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/ajv/dist/ajv.min.js.map
generated
vendored
2
node_modules/ajv/dist/ajv.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
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 */
|
||||
|
||||
3
node_modules/ajv/package.json
generated
vendored
3
node_modules/ajv/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ajv",
|
||||
"version": "6.12.6",
|
||||
"version": "6.14.0",
|
||||
"description": "Another JSON Schema Validator",
|
||||
"main": "lib/ajv.js",
|
||||
"typings": "lib/ajv.d.ts",
|
||||
@@ -90,6 +90,7 @@
|
||||
"mocha": "^8.0.1",
|
||||
"nyc": "^15.0.0",
|
||||
"pre-commit": "^1.1.1",
|
||||
"re2": "^1.21.4",
|
||||
"require-globify": "^1.3.0",
|
||||
"typescript": "^3.9.5",
|
||||
"uglify-js": "^3.6.9",
|
||||
|
||||
Reference in New Issue
Block a user