Jesus sucks
This commit is contained in:
385
backend/frontend/node_modules/file-loader/CHANGELOG.md
generated
vendored
Normal file
385
backend/frontend/node_modules/file-loader/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [6.2.0](https://github.com/webpack-contrib/file-loader/compare/v6.1.1...v6.2.0) (2020-10-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added the `sourceFilename` property to asset info with original filename ([#393](https://github.com/webpack-contrib/file-loader/issues/393)) ([654e0d6](https://github.com/webpack-contrib/file-loader/commit/654e0d641ec067089f6a2d12e30ec3520f00d808))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* immutable flag when the `name` option have hash in query string ([#392](https://github.com/webpack-contrib/file-loader/issues/392)) ([381d8bd](https://github.com/webpack-contrib/file-loader/commit/381d8bda3f2494487bfe840386e365b97b6025fe))
|
||||
|
||||
### [6.1.1](https://github.com/webpack-contrib/file-loader/compare/v6.1.0...v6.1.1) (2020-10-09)
|
||||
|
||||
### Chore
|
||||
|
||||
* update `schema-utils`
|
||||
|
||||
## [6.1.0](https://github.com/webpack-contrib/file-loader/compare/v6.0.0...v6.1.0) (2020-08-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* pass immutable flag to asset info ([#383](https://github.com/webpack-contrib/file-loader/issues/383)) ([40fcde8](https://github.com/webpack-contrib/file-loader/commit/40fcde81681d4f8ee19d2ee3845fd34e24459195))
|
||||
|
||||
## [6.0.0](https://github.com/webpack-contrib/file-loader/compare/v5.1.0...v6.0.0) (2020-03-17)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* use `md4` by default for hashing ([#369](https://github.com/webpack-contrib/file-loader/issues/369)) ([ad39022](https://github.com/webpack-contrib/file-loader/commit/ad3902284d28adeddf667212a39faa4c6bfb2964))
|
||||
|
||||
## [5.1.0](https://github.com/webpack-contrib/file-loader/compare/v5.0.2...v5.1.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support the `query` template for the `name` option ([#366](https://github.com/webpack-contrib/file-loader/issues/366)) ([cd8698b](https://github.com/webpack-contrib/file-loader/commit/cd8698b1d9fd560d85e912acca9a1e24f00e18f8))
|
||||
|
||||
### [5.0.2](https://github.com/webpack-contrib/file-loader/compare/v5.0.1...v5.0.2) (2019-11-25)
|
||||
|
||||
|
||||
### Chore
|
||||
|
||||
* add the `funding` field in `package.json`
|
||||
|
||||
|
||||
|
||||
### [5.0.1](https://github.com/webpack-contrib/file-loader/compare/v5.0.0...v5.0.1) (2019-11-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* name of `esModule` option in source code ([#346](https://github.com/webpack-contrib/file-loader/issues/346)) ([31d6589](https://github.com/webpack-contrib/file-loader/commit/31d6589b71b471f83908e80380dff9b9eada2d06))
|
||||
|
||||
## [5.0.0](https://github.com/webpack-contrib/file-loader/compare/v4.2.0...v5.0.0) (2019-11-22)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* minimum required nodejs version is `10.13.0`
|
||||
* rename the `esModules` option to `esModule`
|
||||
* switch to ES modules by default (the option `esModule` is `true` by default)
|
||||
|
||||
|
||||
|
||||
## [4.3.0](https://github.com/webpack-contrib/file-loader/compare/v4.2.0...v4.3.0) (2019-11-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* new `esModules` option to output ES modules ([#340](https://github.com/webpack-contrib/file-loader/issues/340)) ([9b9cd8d](https://github.com/webpack-contrib/file-loader/commit/9b9cd8d22b3dbe4677be9bdd0bf5fbe07815df54))
|
||||
|
||||
## [4.2.0](https://github.com/webpack-contrib/file-loader/compare/v4.1.0...v4.2.0) (2019-08-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `postTransformPublicPath` option ([#334](https://github.com/webpack-contrib/file-loader/issues/334)) ([c136f44](https://github.com/webpack-contrib/file-loader/commit/c136f44))
|
||||
|
||||
|
||||
|
||||
## [4.1.0](https://github.com/webpack-contrib/file-loader/compare/v4.0.0...v4.1.0) (2019-07-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improved validation error messages ([#339](https://github.com/webpack-contrib/file-loader/issues/339)) ([705eed4](https://github.com/webpack-contrib/file-loader/commit/705eed4))
|
||||
|
||||
|
||||
|
||||
## [4.0.0](https://github.com/webpack-contrib/file-loader/compare/v3.0.1...v4.0.0) (2019-06-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* **deps:** update ([#333](https://github.com/webpack-contrib/file-loader/issues/333)) ([0d2f9b8](https://github.com/webpack-contrib/file-loader/commit/0d2f9b8))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **deps:** minimum required nodejs version is `8.9.0`
|
||||
|
||||
|
||||
|
||||
<a name="3.0.1"></a>
|
||||
## [3.0.1](https://github.com/webpack-contrib/file-loader/compare/v3.0.0...v3.0.1) (2018-12-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* relax options validation for additional properties ([#309](https://github.com/webpack-contrib/file-loader/issues/309)) ([c74d44e](https://github.com/webpack-contrib/file-loader/commit/c74d44e))
|
||||
|
||||
|
||||
|
||||
<a name="3.0.0"></a>
|
||||
# [3.0.0](https://github.com/webpack-contrib/file-loader/compare/v2.0.0...v3.0.0) (2018-12-20)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* drop support for webpack < 4 ([#303](https://github.com/webpack-contrib/file-loader/issues/303)) ([203a4ee](https://github.com/webpack-contrib/file-loader/commit/203a4ee))
|
||||
* more validations in `options` schema
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `resourcePath` is now available in `outputPath` and `publicPath` ([#304](https://github.com/webpack-contrib/file-loader/issues/304)) ([0d66e64](https://github.com/webpack-contrib/file-loader/commit/0d66e64))
|
||||
* `context` is now available in `outputPath` and `publicPath` ([#305](https://github.com/webpack-contrib/file-loader/issues/305)) ([d5eb823](https://github.com/webpack-contrib/file-loader/commit/d5eb823))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* removed the `useRelativePath` option. It is dangerously and break url when you use multiple entry points.
|
||||
* drop support for webpack < 4
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
# [2.0.0](https://github.com/webpack-contrib/file-loader/compare/v1.1.11...v2.0.0) (2018-08-21)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* **defaults:** update to latest webpack-defaults ([#268](https://github.com/webpack-contrib/file-loader/issues/268)) ([687f422](https://github.com/webpack-contrib/file-loader/commit/687f422))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **defaults:** Enforces `engines` of `"node": ">=6.9.0 < 7.0.0 || >= 8.9.0"`
|
||||
|
||||
|
||||
|
||||
<a name="1.1.11"></a>
|
||||
## [1.1.11](https://github.com/webpack/file-loader/compare/v1.1.10...v1.1.11) (2018-03-01)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* **index:** `context` takes precedence over `issuer.context` (`options.useRelativePath`) ([#260](https://github.com/webpack/file-loader/issues/260)) ([e73131f](https://github.com/webpack/file-loader/commit/e73131f))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.10"></a>
|
||||
## [1.1.10](https://github.com/webpack/file-loader/compare/v1.1.9...v1.1.10) (2018-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** add `webpack >= 4` (`peerDependencies`) ([#255](https://github.com/webpack/file-loader/issues/255)) ([3a6a7a1](https://github.com/webpack/file-loader/commit/3a6a7a1))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.9"></a>
|
||||
## [1.1.9](https://github.com/webpack/file-loader/compare/v1.1.8...v1.1.9) (2018-02-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** handle protocol URL's correctly (`options.publicPath`) ([#253](https://github.com/webpack/file-loader/issues/253)) ([54fa5a3](https://github.com/webpack/file-loader/commit/54fa5a3))
|
||||
* **index:** use `path.posix` for platform consistency ([#254](https://github.com/webpack/file-loader/issues/254)) ([2afe0af](https://github.com/webpack/file-loader/commit/2afe0af))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.8"></a>
|
||||
## [1.1.8](https://github.com/webpack/file-loader/compare/v1.1.7...v1.1.8) (2018-02-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** `context` takes precedence over `issuer.context` (`options.useRelativePath`) ([3b071f5](https://github.com/webpack/file-loader/commit/3b071f5))
|
||||
* **index:** don't append `outputPath` to the original `url` (`options.outputPath` `{Function}`) ([4c1ccaa](https://github.com/webpack/file-loader/commit/4c1ccaa))
|
||||
* **index:** normalize and concat paths via `path.join()` ([26e47ca](https://github.com/webpack/file-loader/commit/26e47ca))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.7"></a>
|
||||
## [1.1.7](https://github.com/webpack/file-loader/compare/v1.1.6...v1.1.7) (2018-02-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** don't concat `options.outputPath` and `options.publicPath` ([#246](https://github.com/webpack/file-loader/issues/246)) ([98bf052](https://github.com/webpack/file-loader/commit/98bf052))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.6"></a>
|
||||
## [1.1.6](https://github.com/webpack/file-loader/compare/v1.1.5...v1.1.6) (2017-12-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* rootContext compatibility fix for legacy / v4 (#237) ([1e4b7cf](https://github.com/webpack/file-loader/commit/1e4b7cf)), closes [#237](https://github.com/webpack/file-loader/issues/237)
|
||||
|
||||
|
||||
|
||||
<a name="1.1.5"></a>
|
||||
## [1.1.5](https://github.com/webpack/file-loader/compare/v1.1.4...v1.1.5) (2017-10-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **schema:** allow `name` to be a `{Function}` (`options.name`) ([#216](https://github.com/webpack/file-loader/issues/216)) ([fbfb160](https://github.com/webpack/file-loader/commit/fbfb160))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.4"></a>
|
||||
## [1.1.4](https://github.com/webpack/file-loader/compare/v1.1.3...v1.1.4) (2017-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** revert to CJS exports ([#212](https://github.com/webpack/file-loader/issues/212)) ([f412b3e](https://github.com/webpack/file-loader/commit/f412b3e))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.3"></a>
|
||||
## [1.1.3](https://github.com/webpack/file-loader/compare/v1.1.2...v1.1.3) (2017-09-30)
|
||||
|
||||
|
||||
|
||||
<a name="1.1.2"></a>
|
||||
## [1.1.2](https://github.com/webpack/file-loader/compare/v1.1.1...v1.1.2) (2017-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cjs:** export `raw` value ([#183](https://github.com/webpack/file-loader/issues/183)) ([daeff0e](https://github.com/webpack/file-loader/commit/daeff0e))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.1"></a>
|
||||
## [1.1.1](https://github.com/webpack/file-loader/compare/v1.1.0...v1.1.1) (2017-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **schema:** allow `additionalProperties` ([#207](https://github.com/webpack/file-loader/issues/207)) ([cf7c85a](https://github.com/webpack/file-loader/commit/cf7c85a))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/webpack/file-loader/compare/v1.0.0...v1.1.0) (2017-09-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `options` validation (`schema-utils`) ([#184](https://github.com/webpack/file-loader/issues/184)) ([696ca77](https://github.com/webpack/file-loader/commit/696ca77))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# [1.0.0](https://github.com/webpack/file-loader/compare/v1.0.0-rc.0...v1.0.0) (2017-07-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove `=` from default export (`SyntaxError`) ([#178](https://github.com/webpack/file-loader/issues/178)) ([3fe2d12](https://github.com/webpack/file-loader/commit/3fe2d12))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* Upgrade to defaults 1.3.0 ([#170](https://github.com/webpack-contrib/file-loader/pull/170)) ([632ed72](https://github.com/webpack/file-loader/commit/acd6c2f))
|
||||
* Apply webpack-defaults ([#167](https://github.com/webpack/file-loader/issues/167)) ([632ed72](https://github.com/webpack/file-loader/commit/632ed72))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Enforces Webpack standard NodeJS engines range.
|
||||
at the time of merge `>= 4.3 < 5.0.0 || >= 5.10`.
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0-rc.0"></a>
|
||||
# [1.0.0-rc.0](https://github.com/webpack/file-loader/compare/v1.0.0-beta.1...v1.0.0-rc.0) (2017-07-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove `=` from default export (`SyntaxError`) ([#178](https://github.com/webpack/file-loader/issues/178)) ([3fe2d12](https://github.com/webpack/file-loader/commit/3fe2d12))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0-beta.1"></a>
|
||||
# [1.0.0-beta.1](https://github.com/webpack/file-loader/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2017-06-09)
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* Upgrade to defaults 1.3.0 ([#170](https://github.com/webpack-contrib/file-loader/pull/170)) ([632ed72](https://github.com/webpack/file-loader/commit/acd6c2f))
|
||||
|
||||
|
||||
<a name="1.0.0-beta.0"></a>
|
||||
# [1.0.0-beta.0](https://github.com/webpack/file-loader/compare/v0.11.2...v1.0.0-beta.0) (2017-06-07)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* Apply webpack-defaults ([#167](https://github.com/webpack/file-loader/issues/167)) ([632ed72](https://github.com/webpack/file-loader/commit/632ed72))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Enforces Webpack standard NodeJS engines range.
|
||||
at the time of merge `>= 4.3 < 5.0.0 || >= 5.10`.
|
||||
|
||||
|
||||
|
||||
<a name="0.11.2"></a>
|
||||
## [0.11.2](https://github.com/webpack/file-loader/compare/v0.11.1...v0.11.2) (2017-06-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **index:** allow to override publicPath with an empty string ([#145](https://github.com/webpack/file-loader/issues/145)) ([26ab81a](https://github.com/webpack/file-loader/commit/26ab81a))
|
||||
* init `publicPath` to undefined ([#159](https://github.com/webpack/file-loader/issues/159)) ([e4c0b2a](https://github.com/webpack/file-loader/commit/e4c0b2a))
|
||||
|
||||
|
||||
|
||||
<a name="0.11.1"></a>
|
||||
## [0.11.1](https://github.com/webpack/file-loader/compare/v0.11.0...v0.11.1) (2017-04-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* outputPath function overriden by useRelativePath ([#139](https://github.com/webpack/file-loader/issues/139)) ([80cdee2](https://github.com/webpack/file-loader/commit/80cdee2))
|
||||
|
||||
|
||||
|
||||
<a name="0.11.0"></a>
|
||||
# [0.11.0](https://github.com/webpack/file-loader/compare/v0.10.1...v0.11.0) (2017-03-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Emit files with relative urls ([#135](https://github.com/webpack/file-loader/issues/135)) ([dbcd6cc](https://github.com/webpack/file-loader/commit/dbcd6cc))
|
||||
|
||||
|
||||
|
||||
<a name="0.10.1"></a>
|
||||
## [0.10.1](https://github.com/webpack/file-loader/compare/v0.10.0...v0.10.1) (2017-02-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **getOptions:** deprecation warn in loaderUtils ([#129](https://github.com/webpack/file-loader/issues/129)) ([a8358a0](https://github.com/webpack/file-loader/commit/a8358a0))
|
||||
|
||||
|
||||
|
||||
<a name="0.10.0"></a>
|
||||
# [0.10.0](https://github.com/webpack/file-loader/compare/v0.9.0...v0.10.0) (2017-01-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **resources:** specify custom public file name ([6833c70](https://github.com/webpack/file-loader/commit/6833c70))
|
||||
|
||||
|
||||
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
20
backend/frontend/node_modules/file-loader/LICENSE
generated
vendored
Normal file
20
backend/frontend/node_modules/file-loader/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
763
backend/frontend/node_modules/file-loader/README.md
generated
vendored
Normal file
763
backend/frontend/node_modules/file-loader/README.md
generated
vendored
Normal file
@@ -0,0 +1,763 @@
|
||||
<div align="center">
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![chat][chat]][chat-url]
|
||||
[![size][size]][size-url]
|
||||
|
||||
# file-loader
|
||||
|
||||
The `file-loader` resolves `import`/`require()` on a file into a url and emits the file into the output directory.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To begin, you'll need to install `file-loader`:
|
||||
|
||||
```console
|
||||
$ npm install file-loader --save-dev
|
||||
```
|
||||
|
||||
Import (or `require`) the target file(s) in one of the bundle's files:
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import img from './file.png';
|
||||
```
|
||||
|
||||
Then add the loader to your `webpack` config. For example:
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
And run `webpack` via your preferred method. This will emit `file.png` as a file
|
||||
in the output directory (with the specified naming convention, if options are
|
||||
specified to do so) and returns the public URI of the file.
|
||||
|
||||
> ℹ️ By default the filename of the resulting file is the hash of the file's contents with the original extension of the required resource.
|
||||
|
||||
## Options
|
||||
|
||||
### `name`
|
||||
|
||||
Type: `String|Function`
|
||||
Default: `'[contenthash].[ext]'`
|
||||
|
||||
Specifies a custom filename template for the target file(s) using the query
|
||||
parameter `name`. For example, to emit a file from your `context` directory into
|
||||
the output directory retaining the full directory structure, you might use:
|
||||
|
||||
#### `String`
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[path][name].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
#### `Function`
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name(resourcePath, resourceQuery) {
|
||||
// `resourcePath` - `/absolute/path/to/file.js`
|
||||
// `resourceQuery` - `?foo=bar`
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return '[path][name].[ext]';
|
||||
}
|
||||
|
||||
return '[contenthash].[ext]';
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
> ℹ️ By default the path and name you specify will output the file in that same directory, and will also use the same URI path to access the file.
|
||||
|
||||
### `outputPath`
|
||||
|
||||
Type: `String|Function`
|
||||
Default: `undefined`
|
||||
|
||||
Specify a filesystem path where the target file(s) will be placed.
|
||||
|
||||
#### `String`
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
outputPath: 'images',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
#### `Function`
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
outputPath: (url, resourcePath, context) => {
|
||||
// `resourcePath` is original absolute path to asset
|
||||
// `context` is directory where stored asset (`rootContext`) or `context` option
|
||||
|
||||
// To get relative path you can use
|
||||
// const relativePath = path.relative(context, resourcePath);
|
||||
|
||||
if (/my-custom-image\.png/.test(resourcePath)) {
|
||||
return `other_output_path/${url}`;
|
||||
}
|
||||
|
||||
if (/images/.test(context)) {
|
||||
return `image_output_path/${url}`;
|
||||
}
|
||||
|
||||
return `output_path/${url}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `publicPath`
|
||||
|
||||
Type: `String|Function`
|
||||
Default: [`__webpack_public_path__`](https://webpack.js.org/api/module-variables/#__webpack_public_path__-webpack-specific-)+outputPath
|
||||
|
||||
Specifies a custom public path for the target file(s).
|
||||
|
||||
#### `String`
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
publicPath: 'assets',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
#### `Function`
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
publicPath: (url, resourcePath, context) => {
|
||||
// `resourcePath` is original absolute path to asset
|
||||
// `context` is directory where stored asset (`rootContext`) or `context` option
|
||||
|
||||
// To get relative path you can use
|
||||
// const relativePath = path.relative(context, resourcePath);
|
||||
|
||||
if (/my-custom-image\.png/.test(resourcePath)) {
|
||||
return `other_public_path/${url}`;
|
||||
}
|
||||
|
||||
if (/images/.test(context)) {
|
||||
return `image_output_path/${url}`;
|
||||
}
|
||||
|
||||
return `public_path/${url}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `postTransformPublicPath`
|
||||
|
||||
Type: `Function`
|
||||
Default: `undefined`
|
||||
|
||||
Specifies a custom function to post-process the generated public path. This can be used to prepend or append dynamic global variables that are only available at runtime, like `__webpack_public_path__`. This would not be possible with just `publicPath`, since it stringifies the values.
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
publicPath: '/some/path/',
|
||||
postTransformPublicPath: (p) => `__webpack_public_path__ + ${p}`,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `context`
|
||||
|
||||
Type: `String`
|
||||
Default: [`context`](https://webpack.js.org/configuration/entry-context/#context)
|
||||
|
||||
Specifies a custom file context.
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
context: 'project',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `emitFile`
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `true`
|
||||
|
||||
If true, emits a file (writes a file to the filesystem). If false, the loader
|
||||
will return a public URI but **will not** emit the file. It is often useful to
|
||||
disable this option for server-side packages.
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
// bundle file
|
||||
import img from './file.png';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
emitFile: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### `regExp`
|
||||
|
||||
Type: `RegExp`
|
||||
Default: `undefined`
|
||||
|
||||
Specifies a Regular Expression to one or many parts of the target file path.
|
||||
The capture groups can be reused in the `name` property using `[N]`
|
||||
[placeholder](https://github.com/webpack-contrib/file-loader#placeholders).
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import img from './customer01/file.png';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
regExp: /\/([a-z0-9]+)\/[a-z0-9]+\.png$/i,
|
||||
name: '[1]-[name].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
> ℹ️ If `[0]` is used, it will be replaced by the entire tested string, whereas `[1]` will contain the first capturing parenthesis of your regex and so on...
|
||||
|
||||
### `esModule`
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `true`
|
||||
|
||||
By default, `file-loader` generates JS modules that use the ES modules syntax.
|
||||
There are some cases in which using ES modules is beneficial, like in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/).
|
||||
|
||||
You can enable a CommonJS module syntax using:
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
esModule: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Placeholders
|
||||
|
||||
Full information about placeholders you can find [here](https://github.com/webpack/loader-utils#interpolatename).
|
||||
|
||||
### `[ext]`
|
||||
|
||||
Type: `String`
|
||||
Default: `file.extname`
|
||||
|
||||
The file extension of the target file/resource.
|
||||
|
||||
### `[name]`
|
||||
|
||||
Type: `String`
|
||||
Default: `file.basename`
|
||||
|
||||
The basename of the file/resource.
|
||||
|
||||
### `[path]`
|
||||
|
||||
Type: `String`
|
||||
Default: `file.directory`
|
||||
|
||||
The path of the resource relative to the webpack/config `context`.
|
||||
|
||||
### `[folder]`
|
||||
|
||||
Type: `String`
|
||||
Default: `file.folder`
|
||||
|
||||
The folder of the resource is in.
|
||||
|
||||
### `[query]`
|
||||
|
||||
Type: `String`
|
||||
Default: `file.query`
|
||||
|
||||
The query of the resource, i.e. `?foo=bar`.
|
||||
|
||||
### `[emoji]`
|
||||
|
||||
Type: `String`
|
||||
Default: `undefined`
|
||||
|
||||
A random emoji representation of `content`.
|
||||
|
||||
### `[emoji:<length>]`
|
||||
|
||||
Type: `String`
|
||||
Default: `undefined`
|
||||
|
||||
Same as above, but with a customizable number of emojis
|
||||
|
||||
### `[hash]`
|
||||
|
||||
Type: `String`
|
||||
Default: `md4`
|
||||
|
||||
Specifies the hash method to use for hashing the file content.
|
||||
|
||||
### `[contenthash]`
|
||||
|
||||
Type: `String`
|
||||
Default: `md4`
|
||||
|
||||
Specifies the hash method to use for hashing the file content.
|
||||
|
||||
### `[<hashType>:hash:<digestType>:<length>]`
|
||||
|
||||
Type: `String`
|
||||
|
||||
The hash of options.content (Buffer) (by default it's the hex digest of the hash).
|
||||
|
||||
#### `digestType`
|
||||
|
||||
Type: `String`
|
||||
Default: `'hex'`
|
||||
|
||||
The [digest](https://en.wikipedia.org/wiki/Cryptographic_hash_function) that the
|
||||
hash function should use. Valid values include: base26, base32, base36,
|
||||
base49, base52, base58, base62, base64, and hex.
|
||||
|
||||
#### `hashType`
|
||||
|
||||
Type: `String`
|
||||
Default: `'md4'`
|
||||
|
||||
The type of hash that the has function should use. Valid values include: `md4`, `md5`, `sha1`, `sha256`, and `sha512`.
|
||||
|
||||
#### `length`
|
||||
|
||||
Type: `Number`
|
||||
Default: `undefined`
|
||||
|
||||
Users may also specify a length for the computed hash.
|
||||
|
||||
### `[N]`
|
||||
|
||||
Type: `String`
|
||||
Default: `undefined`
|
||||
|
||||
The n-th match obtained from matching the current file name against the `regExp`.
|
||||
|
||||
## Examples
|
||||
|
||||
### Names
|
||||
|
||||
The following examples show how one might use `file-loader` and what the result would be.
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import png from './image.png';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'dirname/[contenthash].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```bash
|
||||
# result
|
||||
dirname/0dcbbaa701328ae351f.png
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import png from './image.png';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[sha512:hash:base64:7].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```bash
|
||||
# result
|
||||
gdyb21L.png
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import png from './path/to/file.png';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[path][name].[ext]?[contenthash]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```bash
|
||||
# result
|
||||
path/to/file.png?e43b20c069c4a01867c31e98cbce33c9
|
||||
```
|
||||
|
||||
### CDN
|
||||
|
||||
The following examples show how to use `file-loader` for CDN uses query params.
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import png from './directory/image.png?width=300&height=300';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
output: {
|
||||
publicPath: 'https://cdn.example.com/',
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[path][name].[ext][query]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```bash
|
||||
# result
|
||||
https://cdn.example.com/directory/image.png?width=300&height=300
|
||||
```
|
||||
|
||||
### Dynamic public path depending on environment variable at run time
|
||||
|
||||
An application might want to configure different CDN hosts depending on an environment variable that is only available when running the application. This can be an advantage, as only one build of the application is necessary, which behaves differently depending on environment variables of the deployment environment. Since file-loader is applied when compiling the application, and not when running it, the environment variable cannot be used in the file-loader configuration. A way around this is setting the `__webpack_public_path__` to the desired CDN host depending on the environment variable at the entrypoint of the application. The option `postTransformPublicPath` can be used to configure a custom path depending on a variable like `__webpack_public_path__`.
|
||||
|
||||
**main.js**
|
||||
|
||||
```js
|
||||
const assetPrefixForNamespace = (namespace) => {
|
||||
switch (namespace) {
|
||||
case 'prod':
|
||||
return 'https://cache.myserver.net/web';
|
||||
case 'uat':
|
||||
return 'https://cache-uat.myserver.net/web';
|
||||
case 'st':
|
||||
return 'https://cache-st.myserver.net/web';
|
||||
case 'dev':
|
||||
return 'https://cache-dev.myserver.net/web';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
};
|
||||
const namespace = process.env.NAMESPACE;
|
||||
|
||||
__webpack_public_path__ = `${assetPrefixForNamespace(namespace)}/`;
|
||||
```
|
||||
|
||||
**file.js**
|
||||
|
||||
```js
|
||||
import png from './image.png';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/i,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[contenthash].[ext]',
|
||||
outputPath: 'static/assets/',
|
||||
publicPath: 'static/assets/',
|
||||
postTransformPublicPath: (p) => `__webpack_public_path__ + ${p}`,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Result when run with `NAMESPACE=prod` env variable:
|
||||
|
||||
```bash
|
||||
# result
|
||||
https://cache.myserver.net/web/static/assets/image.somehash.png
|
||||
```
|
||||
|
||||
Result when run with `NAMESPACE=dev` env variable:
|
||||
|
||||
```bash
|
||||
# result
|
||||
https://cache-dev.myserver.net/web/static/assets/image.somehash.png
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
||||
|
||||
[CONTRIBUTING](./.github/CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/file-loader.svg
|
||||
[npm-url]: https://npmjs.com/package/file-loader
|
||||
[node]: https://img.shields.io/node/v/file-loader.svg
|
||||
[node-url]: https://nodejs.org
|
||||
[deps]: https://david-dm.org/webpack-contrib/file-loader.svg
|
||||
[deps-url]: https://david-dm.org/webpack-contrib/file-loader
|
||||
[tests]: https://github.com/webpack-contrib/file-loader/workflows/file-loader/badge.svg
|
||||
[tests-url]: https://github.com/webpack-contrib/file-loader/actions
|
||||
[cover]: https://codecov.io/gh/webpack-contrib/file-loader/branch/master/graph/badge.svg
|
||||
[cover-url]: https://codecov.io/gh/webpack-contrib/file-loader
|
||||
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
|
||||
[chat-url]: https://gitter.im/webpack/webpack
|
||||
[size]: https://packagephobia.now.sh/badge?p=file-loader
|
||||
[size-url]: https://packagephobia.now.sh/result?p=file-loader
|
||||
21
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/LICENSE
generated
vendored
Normal file
21
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
836
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/README.md
generated
vendored
Normal file
836
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/README.md
generated
vendored
Normal file
@@ -0,0 +1,836 @@
|
||||
# ajv-keywords
|
||||
|
||||
Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) validator
|
||||
|
||||
[](https://travis-ci.org/ajv-validator/ajv-keywords)
|
||||
[](https://www.npmjs.com/package/ajv-keywords)
|
||||
[](https://www.npmjs.com/package/ajv-keywords)
|
||||
[](https://coveralls.io/github/ajv-validator/ajv-keywords?branch=master)
|
||||
[](https://app.dependabot.com/accounts/ajv-validator/repos/60477053)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
|
||||
|
||||
## Contents
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Keywords](#keywords)
|
||||
- [Types](#types)
|
||||
- [typeof](#typeof)
|
||||
- [instanceof](#instanceof)
|
||||
- [Keywords for numbers](#keywords-for-numbers)
|
||||
- [range and exclusiveRange](#range-and-exclusiverange)
|
||||
- [Keywords for strings](#keywords-for-strings)
|
||||
- [regexp](#regexp)
|
||||
- [formatMaximum / formatMinimum and formatExclusiveMaximum / formatExclusiveMinimum](#formatmaximum--formatminimum-and-formatexclusivemaximum--formatexclusiveminimum)
|
||||
- [transform](#transform)<sup>\*</sup>
|
||||
- [Keywords for arrays](#keywords-for-arrays)
|
||||
- [uniqueItemProperties](#uniqueitemproperties)
|
||||
- [Keywords for objects](#keywords-for-objects)
|
||||
- [allRequired](#allrequired)
|
||||
- [anyRequired](#anyrequired)
|
||||
- [oneRequired](#onerequired)
|
||||
- [patternRequired](#patternrequired)
|
||||
- [prohibited](#prohibited)
|
||||
- [deepProperties](#deepproperties)
|
||||
- [deepRequired](#deeprequired)
|
||||
- [Compound keywords](#compound-keywords)
|
||||
- [switch](#switch) (deprecated)
|
||||
- [select/selectCases/selectDefault](#selectselectcasesselectdefault) (BETA)
|
||||
- [Keywords for all types](#keywords-for-all-types)
|
||||
- [dynamicDefaults](#dynamicdefaults)<sup>\*</sup>
|
||||
- [Security contact](#security-contact)
|
||||
- [Open-source software support](#open-source-software-support)
|
||||
- [License](#license)
|
||||
|
||||
<sup>\*</sup> - keywords that modify data
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install ajv-keywords
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
To add all available keywords:
|
||||
|
||||
```javascript
|
||||
var Ajv = require('ajv');
|
||||
var ajv = new Ajv;
|
||||
require('ajv-keywords')(ajv);
|
||||
|
||||
ajv.validate({ instanceof: 'RegExp' }, /.*/); // true
|
||||
ajv.validate({ instanceof: 'RegExp' }, '.*'); // false
|
||||
```
|
||||
|
||||
To add a single keyword:
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, 'instanceof');
|
||||
```
|
||||
|
||||
To add multiple keywords:
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['typeof', 'instanceof']);
|
||||
```
|
||||
|
||||
To add a single keyword in browser (to avoid adding unused code):
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords/keywords/instanceof')(ajv);
|
||||
```
|
||||
|
||||
|
||||
## Keywords
|
||||
|
||||
### Types
|
||||
|
||||
#### `typeof`
|
||||
|
||||
Based on JavaScript `typeof` operation.
|
||||
|
||||
The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or array of strings.
|
||||
|
||||
To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array).
|
||||
|
||||
```
|
||||
ajv.validate({ typeof: 'undefined' }, undefined); // true
|
||||
ajv.validate({ typeof: 'undefined' }, null); // false
|
||||
ajv.validate({ typeof: ['undefined', 'object'] }, null); // true
|
||||
```
|
||||
|
||||
|
||||
#### `instanceof`
|
||||
|
||||
Based on JavaScript `instanceof` operation.
|
||||
|
||||
The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"`, `"Promise"` or `"Buffer"`) or array of strings.
|
||||
|
||||
To pass validation the result of `data instanceof ...` operation on the value should be true:
|
||||
|
||||
```
|
||||
ajv.validate({ instanceof: 'Array' }, []); // true
|
||||
ajv.validate({ instanceof: 'Array' }, {}); // false
|
||||
ajv.validate({ instanceof: ['Array', 'Function'] }, function(){}); // true
|
||||
```
|
||||
|
||||
You can add your own constructor function to be recognised by this keyword:
|
||||
|
||||
```javascript
|
||||
function MyClass() {}
|
||||
var instanceofDefinition = require('ajv-keywords').get('instanceof').definition;
|
||||
// or require('ajv-keywords/keywords/instanceof').definition;
|
||||
instanceofDefinition.CONSTRUCTORS.MyClass = MyClass;
|
||||
|
||||
ajv.validate({ instanceof: 'MyClass' }, new MyClass); // true
|
||||
```
|
||||
|
||||
|
||||
### Keywords for numbers
|
||||
|
||||
#### `range` and `exclusiveRange`
|
||||
|
||||
Syntax sugar for the combination of minimum and maximum keywords, also fails schema compilation if there are no numbers in the range.
|
||||
|
||||
The value of this keyword must be the array consisting of two numbers, the second must be greater or equal than the first one.
|
||||
|
||||
If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. If `exclusiveRange` keyword is present in the same schema and its value is true, the validated value must not be equal to the range boundaries.
|
||||
|
||||
```javascript
|
||||
var schema = { range: [1, 3] };
|
||||
ajv.validate(schema, 1); // true
|
||||
ajv.validate(schema, 2); // true
|
||||
ajv.validate(schema, 3); // true
|
||||
ajv.validate(schema, 0.99); // false
|
||||
ajv.validate(schema, 3.01); // false
|
||||
|
||||
var schema = { range: [1, 3], exclusiveRange: true };
|
||||
ajv.validate(schema, 1.01); // true
|
||||
ajv.validate(schema, 2); // true
|
||||
ajv.validate(schema, 2.99); // true
|
||||
ajv.validate(schema, 1); // false
|
||||
ajv.validate(schema, 3); // false
|
||||
```
|
||||
|
||||
|
||||
### Keywords for strings
|
||||
|
||||
#### `regexp`
|
||||
|
||||
This keyword allows to use regular expressions with flags in schemas (the standard `pattern` keyword does not support flags).
|
||||
|
||||
This keyword applies only to strings. If the data is not a string, the validation succeeds.
|
||||
|
||||
The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor).
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
foo: { regexp: '/foo/i' },
|
||||
bar: { regexp: { pattern: 'bar', flags: 'i' } }
|
||||
}
|
||||
};
|
||||
|
||||
var validData = {
|
||||
foo: 'Food',
|
||||
bar: 'Barmen'
|
||||
};
|
||||
|
||||
var invalidData = {
|
||||
foo: 'fog',
|
||||
bar: 'bad'
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
#### `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum`
|
||||
|
||||
These keywords allow to define minimum/maximum constraints when the format keyword defines ordering.
|
||||
|
||||
These keywords apply only to strings. If the data is not a string, the validation succeeds.
|
||||
|
||||
The value of keyword `formatMaximum` (`formatMinimum`) should be a string. This value is the maximum (minimum) allowed value for the data to be valid as determined by `format` keyword. If `format` is not present schema compilation will throw exception.
|
||||
|
||||
When this keyword is added, it defines comparison rules for formats `"date"`, `"time"` and `"date-time"`. Custom formats also can have comparison rules. See [addFormat](https://github.com/epoberezkin/ajv#api-addformat) method.
|
||||
|
||||
The value of keyword `formatExclusiveMaximum` (`formatExclusiveMinimum`) should be a boolean value. These keyword cannot be used without `formatMaximum` (`formatMinimum`). If this keyword value is equal to `true`, the data to be valid should not be equal to the value in `formatMaximum` (`formatMinimum`) keyword.
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['formatMinimum', 'formatMaximum']);
|
||||
|
||||
var schema = {
|
||||
format: 'date',
|
||||
formatMinimum: '2016-02-06',
|
||||
formatMaximum: '2016-12-27',
|
||||
formatExclusiveMaximum: true
|
||||
}
|
||||
|
||||
var validDataList = ['2016-02-06', '2016-12-26', 1];
|
||||
|
||||
var invalidDataList = ['2016-02-05', '2016-12-27', 'abc'];
|
||||
```
|
||||
|
||||
|
||||
#### `transform`
|
||||
|
||||
This keyword allows a string to be modified before validation.
|
||||
|
||||
These keywords apply only to strings. If the data is not a string, the transform is skipped.
|
||||
|
||||
There are limitation due to how ajv is written:
|
||||
- a stand alone string cannot be transformed. ie `data = 'a'; ajv.validate(schema, data);`
|
||||
- currently cannot work with `ajv-pack`
|
||||
|
||||
**Supported options:**
|
||||
- `trim`: remove whitespace from start and end
|
||||
- `trimLeft`: remove whitespace from start
|
||||
- `trimRight`: remove whitespace from end
|
||||
- `toLowerCase`: case string to all lower case
|
||||
- `toUpperCase`: case string to all upper case
|
||||
- `toEnumCase`: case string to match case in schema
|
||||
|
||||
Options are applied in the order they are listed.
|
||||
|
||||
Note: `toEnumCase` requires that all allowed values are unique when case insensitive.
|
||||
|
||||
**Example: multiple options**
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['transform']);
|
||||
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type:'string',
|
||||
transform:['trim','toLowerCase']
|
||||
}
|
||||
};
|
||||
|
||||
var data = [' MixCase '];
|
||||
ajv.validate(schema, data);
|
||||
console.log(data); // ['mixcase']
|
||||
|
||||
```
|
||||
|
||||
**Example: `enumcase`**
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['transform']);
|
||||
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type:'string',
|
||||
transform:['trim','toEnumCase'],
|
||||
enum:['pH']
|
||||
}
|
||||
};
|
||||
|
||||
var data = ['ph',' Ph','PH','pH '];
|
||||
ajv.validate(schema, data);
|
||||
console.log(data); // ['pH','pH','pH','pH']
|
||||
```
|
||||
|
||||
|
||||
### Keywords for arrays
|
||||
|
||||
#### `uniqueItemProperties`
|
||||
|
||||
The keyword allows to check that some properties in array items are unique.
|
||||
|
||||
This keyword applies only to arrays. If the data is not an array, the validation succeeds.
|
||||
|
||||
The value of this keyword must be an array of strings - property names that should have unique values across all items.
|
||||
|
||||
```javascript
|
||||
var schema = { uniqueItemProperties: [ "id", "name" ] };
|
||||
|
||||
var validData = [
|
||||
{ id: 1 },
|
||||
{ id: 2 },
|
||||
{ id: 3 }
|
||||
];
|
||||
|
||||
var invalidData1 = [
|
||||
{ id: 1 },
|
||||
{ id: 1 }, // duplicate "id"
|
||||
{ id: 3 }
|
||||
];
|
||||
|
||||
var invalidData2 = [
|
||||
{ id: 1, name: "taco" },
|
||||
{ id: 2, name: "taco" }, // duplicate "name"
|
||||
{ id: 3, name: "salsa" }
|
||||
];
|
||||
```
|
||||
|
||||
This keyword is contributed by [@blainesch](https://github.com/blainesch).
|
||||
|
||||
|
||||
### Keywords for objects
|
||||
|
||||
#### `allRequired`
|
||||
|
||||
This keyword allows to require the presence of all properties used in `properties` keyword in the same schema object.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword must be boolean.
|
||||
|
||||
If the value of the keyword is `false`, the validation succeeds.
|
||||
|
||||
If the value of the keyword is `true`, the validation succeeds if the data contains all properties defined in `properties` keyword (in the same schema object).
|
||||
|
||||
If the `properties` keyword is not present in the same schema object, schema compilation will throw exception.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
properties: {
|
||||
foo: {type: 'number'},
|
||||
bar: {type: 'number'}
|
||||
}
|
||||
allRequired: true
|
||||
};
|
||||
|
||||
var validData = { foo: 1, bar: 2 };
|
||||
var alsoValidData = { foo: 1, bar: 2, baz: 3 };
|
||||
|
||||
var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ];
|
||||
```
|
||||
|
||||
|
||||
#### `anyRequired`
|
||||
|
||||
This keyword allows to require the presence of any (at least one) property from the list.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword must be an array of strings, each string being a property name. For data object to be valid at least one of the properties in this array should be present in the object.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
anyRequired: ['foo', 'bar']
|
||||
};
|
||||
|
||||
var validData = { foo: 1 };
|
||||
var alsoValidData = { foo: 1, bar: 2 };
|
||||
|
||||
var invalidDataList = [ {}, { baz: 3 } ];
|
||||
```
|
||||
|
||||
|
||||
#### `oneRequired`
|
||||
|
||||
This keyword allows to require the presence of only one property from the list.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword must be an array of strings, each string being a property name. For data object to be valid exactly one of the properties in this array should be present in the object.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
oneRequired: ['foo', 'bar']
|
||||
};
|
||||
|
||||
var validData = { foo: 1 };
|
||||
var alsoValidData = { bar: 2, baz: 3 };
|
||||
|
||||
var invalidDataList = [ {}, { baz: 3 }, { foo: 1, bar: 2 } ];
|
||||
```
|
||||
|
||||
|
||||
#### `patternRequired`
|
||||
|
||||
This keyword allows to require the presence of properties that match some pattern(s).
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword should be an array of strings, each string being a regular expression. For data object to be valid each regular expression in this array should match at least one property name in the data object.
|
||||
|
||||
If the array contains multiple regular expressions, more than one expression can match the same property name.
|
||||
|
||||
```javascript
|
||||
var schema = { patternRequired: [ 'f.*o', 'b.*r' ] };
|
||||
|
||||
var validData = { foo: 1, bar: 2 };
|
||||
var alsoValidData = { foobar: 3 };
|
||||
|
||||
var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ];
|
||||
```
|
||||
|
||||
|
||||
#### `prohibited`
|
||||
|
||||
This keyword allows to prohibit that any of the properties in the list is present in the object.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object.
|
||||
|
||||
```
|
||||
var schema = { prohibited: ['foo', 'bar']};
|
||||
|
||||
var validData = { baz: 1 };
|
||||
var alsoValidData = {};
|
||||
|
||||
var invalidDataList = [
|
||||
{ foo: 1 },
|
||||
{ bar: 2 },
|
||||
{ foo: 1, bar: 2}
|
||||
];
|
||||
```
|
||||
|
||||
__Please note__: `{prohibited: ['foo', 'bar']}` is equivalent to `{not: {anyRequired: ['foo', 'bar']}}` (i.e. it has the same validation result for any data).
|
||||
|
||||
|
||||
#### `deepProperties`
|
||||
|
||||
This keyword allows to validate deep properties (identified by JSON pointers).
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are JSON schemas. For data object to be valid the value of each JSON pointer should be valid according to the corresponding schema.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
deepProperties: {
|
||||
"/users/1/role": { "enum": ["admin"] }
|
||||
}
|
||||
};
|
||||
|
||||
var validData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123,
|
||||
role: 'admin'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var alsoValidData = {
|
||||
users: {
|
||||
"1": {
|
||||
id: 123,
|
||||
role: 'admin'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var invalidData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123,
|
||||
role: 'user'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var alsoInvalidData = {
|
||||
users: {
|
||||
"1": {
|
||||
id: 123,
|
||||
role: 'user'
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
#### `deepRequired`
|
||||
|
||||
This keyword allows to check that some deep properties (identified by JSON pointers) are available.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value should be an array of JSON pointers to the data, starting from the current position in data. For data object to be valid each JSON pointer should be some existing part of the data.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
deepRequired: ["/users/1/role"]
|
||||
};
|
||||
|
||||
var validData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123,
|
||||
role: 'admin'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var invalidData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword.
|
||||
|
||||
|
||||
### Compound keywords
|
||||
|
||||
#### `switch` (deprecated)
|
||||
|
||||
__Please note__: this keyword is provided to preserve backward compatibility with previous versions of Ajv. It is strongly recommended to use `if`/`then`/`else` keywords instead, as they have been added to the draft-07 of JSON Schema specification.
|
||||
|
||||
This keyword allows to perform advanced conditional validation.
|
||||
|
||||
The value of the keyword is the array of if/then clauses. Each clause is the object with the following properties:
|
||||
|
||||
- `if` (optional) - the value is JSON-schema
|
||||
- `then` (required) - the value is JSON-schema or boolean
|
||||
- `continue` (optional) - the value is boolean
|
||||
|
||||
The validation process is dynamic; all clauses are executed sequentially in the following way:
|
||||
|
||||
1. `if`:
|
||||
1. `if` property is JSON-schema according to which the data is:
|
||||
1. valid => go to step 2.
|
||||
2. invalid => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS.
|
||||
2. `if` property is absent => go to step 2.
|
||||
2. `then`:
|
||||
1. `then` property is `true` or it is JSON-schema according to which the data is valid => go to step 3.
|
||||
2. `then` property is `false` or it is JSON-schema according to which the data is invalid => the validation of `switch` FAILS.
|
||||
3. `continue`:
|
||||
1. `continue` property is `true` => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS.
|
||||
2. `continue` property is `false` or absent => validation of `switch` SUCCEEDS.
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, 'switch');
|
||||
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'integer',
|
||||
'switch': [
|
||||
{ if: { not: { minimum: 1 } }, then: false },
|
||||
{ if: { maximum: 10 }, then: true },
|
||||
{ if: { maximum: 100 }, then: { multipleOf: 10 } },
|
||||
{ if: { maximum: 1000 }, then: { multipleOf: 100 } },
|
||||
{ then: false }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var validItems = [1, 5, 10, 20, 50, 100, 200, 500, 1000];
|
||||
|
||||
var invalidItems = [1, 0, 2000, 11, 57, 123, 'foo'];
|
||||
```
|
||||
|
||||
The above schema is equivalent to (for example):
|
||||
|
||||
```javascript
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'integer',
|
||||
if: { minimum: 1, maximum: 10 },
|
||||
then: true,
|
||||
else: {
|
||||
if: { maximum: 100 },
|
||||
then: { multipleOf: 10 },
|
||||
else: {
|
||||
if: { maximum: 1000 },
|
||||
then: { multipleOf: 100 },
|
||||
else: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### `select`/`selectCases`/`selectDefault`
|
||||
|
||||
These keywords allow to choose the schema to validate the data based on the value of some property in the validated data.
|
||||
|
||||
These keywords must be present in the same schema object (`selectDefault` is optional).
|
||||
|
||||
The value of `select` keyword should be a [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference) that points to any primitive JSON type (string, number, boolean or null) in the data that is validated. You can also use a constant of primitive type as the value of this keyword (e.g., for debugging purposes).
|
||||
|
||||
The value of `selectCases` keyword must be an object where each property name is a possible string representation of the value of `select` keyword and each property value is a corresponding schema (from draft-06 it can be boolean) that must be used to validate the data.
|
||||
|
||||
The value of `selectDefault` keyword is a schema (from draft-06 it can be boolean) that must be used to validate the data in case `selectCases` has no key equal to the stringified value of `select` keyword.
|
||||
|
||||
The validation succeeds in one of the following cases:
|
||||
- the validation of data using selected schema succeeds,
|
||||
- none of the schemas is selected for validation,
|
||||
- the value of select is undefined (no property in the data that the data reference points to).
|
||||
|
||||
If `select` value (in data) is not a primitive type the validation fails.
|
||||
|
||||
__Please note__: these keywords require Ajv `$data` option to support [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference).
|
||||
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, 'select');
|
||||
|
||||
var schema = {
|
||||
type: object,
|
||||
required: ['kind'],
|
||||
properties: {
|
||||
kind: { type: 'string' }
|
||||
},
|
||||
select: { $data: '0/kind' },
|
||||
selectCases: {
|
||||
foo: {
|
||||
required: ['foo'],
|
||||
properties: {
|
||||
kind: {},
|
||||
foo: { type: 'string' }
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
bar: {
|
||||
required: ['bar'],
|
||||
properties: {
|
||||
kind: {},
|
||||
bar: { type: 'number' }
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
selectDefault: {
|
||||
propertyNames: {
|
||||
not: { enum: ['foo', 'bar'] }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var validDataList = [
|
||||
{ kind: 'foo', foo: 'any' },
|
||||
{ kind: 'bar', bar: 1 },
|
||||
{ kind: 'anything_else', not_bar_or_foo: 'any value' }
|
||||
];
|
||||
|
||||
var invalidDataList = [
|
||||
{ kind: 'foo' }, // no propery foo
|
||||
{ kind: 'bar' }, // no propery bar
|
||||
{ kind: 'foo', foo: 'any', another: 'any value' }, // additional property
|
||||
{ kind: 'bar', bar: 1, another: 'any value' }, // additional property
|
||||
{ kind: 'anything_else', foo: 'any' } // property foo not allowed
|
||||
{ kind: 'anything_else', bar: 1 } // property bar not allowed
|
||||
];
|
||||
```
|
||||
|
||||
__Please note__: the current implementation is BETA. It does not allow using relative URIs in $ref keywords in schemas in `selectCases` and `selectDefault` that point outside of these schemas. The workaround is to use absolute URIs (that can point to any (sub-)schema added to Ajv, including those inside the current root schema where `select` is used). See [tests](https://github.com/epoberezkin/ajv-keywords/blob/v2.0.0/spec/tests/select.json#L314).
|
||||
|
||||
|
||||
### Keywords for all types
|
||||
|
||||
#### `dynamicDefaults`
|
||||
|
||||
This keyword allows to assign dynamic defaults to properties, such as timestamps, unique IDs etc.
|
||||
|
||||
This keyword only works if `useDefaults` options is used and not inside `anyOf` keywords etc., in the same way as [default keyword treated by Ajv](https://github.com/epoberezkin/ajv#assigning-defaults).
|
||||
|
||||
The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be:
|
||||
|
||||
- an identifier of default function (a string)
|
||||
- an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples).
|
||||
|
||||
The properties used in `dynamicDefaults` should not be added to `required` keyword (or validation will fail), because unlike `default` this keyword is processed after validation.
|
||||
|
||||
There are several predefined dynamic default functions:
|
||||
|
||||
- `"timestamp"` - current timestamp in milliseconds
|
||||
- `"datetime"` - current date and time as string (ISO, valid according to `date-time` format)
|
||||
- `"date"` - current date as string (ISO, valid according to `date` format)
|
||||
- `"time"` - current time as string (ISO, valid according to `time` format)
|
||||
- `"random"` - pseudo-random number in [0, 1) interval
|
||||
- `"randomint"` - pseudo-random integer number. If string is used as a property value, the function will randomly return 0 or 1. If object `{ func: 'randomint', args: { max: N } }` is used then the default will be an integer number in [0, N) interval.
|
||||
- `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{ func: 'seq', args: { name: 'foo'} }` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
dynamicDefaults: {
|
||||
ts: 'datetime',
|
||||
r: { func: 'randomint', args: { max: 100 } },
|
||||
id: { func: 'seq', args: { name: 'id' } }
|
||||
},
|
||||
properties: {
|
||||
ts: {
|
||||
type: 'string',
|
||||
format: 'date-time'
|
||||
},
|
||||
r: {
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
exclusiveMaximum: 100
|
||||
},
|
||||
id: {
|
||||
type: 'integer',
|
||||
minimum: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var data = {};
|
||||
ajv.validate(data); // true
|
||||
data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 }
|
||||
|
||||
var data1 = {};
|
||||
ajv.validate(data1); // true
|
||||
data1; // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 }
|
||||
|
||||
ajv.validate(data1); // true
|
||||
data1; // didn't change, as all properties were defined
|
||||
```
|
||||
|
||||
When using the `useDefaults` option value `"empty"`, properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. Use the `allOf` [compound keyword](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) to execute `dynamicDefaults` before validation.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
allOf: [
|
||||
{
|
||||
dynamicDefaults: {
|
||||
ts: 'datetime',
|
||||
r: { func: 'randomint', args: { min: 5, max: 100 } },
|
||||
id: { func: 'seq', args: { name: 'id' } }
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
ts: {
|
||||
type: 'string'
|
||||
},
|
||||
r: {
|
||||
type: 'number',
|
||||
minimum: 5,
|
||||
exclusiveMaximum: 100
|
||||
},
|
||||
id: {
|
||||
type: 'integer',
|
||||
minimum: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var data = { ts: '', r: null };
|
||||
ajv.validate(data); // true
|
||||
data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 }
|
||||
```
|
||||
|
||||
You can add your own dynamic default function to be recognised by this keyword:
|
||||
|
||||
```javascript
|
||||
var uuid = require('uuid');
|
||||
|
||||
function uuidV4() { return uuid.v4(); }
|
||||
|
||||
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
|
||||
// or require('ajv-keywords/keywords/dynamicDefaults').definition;
|
||||
definition.DEFAULTS.uuid = uuidV4;
|
||||
|
||||
var schema = {
|
||||
dynamicDefaults: { id: 'uuid' },
|
||||
properties: { id: { type: 'string', format: 'uuid' } }
|
||||
};
|
||||
|
||||
var data = {};
|
||||
ajv.validate(schema, data); // true
|
||||
data; // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' };
|
||||
|
||||
var data1 = {};
|
||||
ajv.validate(schema, data1); // true
|
||||
data1; // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' }
|
||||
```
|
||||
|
||||
You also can define dynamic default that accepts parameters, e.g. version of uuid:
|
||||
|
||||
```javascript
|
||||
var uuid = require('uuid');
|
||||
|
||||
function getUuid(args) {
|
||||
var version = 'v' + (arvs && args.v || 4);
|
||||
return function() {
|
||||
return uuid[version]();
|
||||
};
|
||||
}
|
||||
|
||||
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
|
||||
definition.DEFAULTS.uuid = getUuid;
|
||||
|
||||
var schema = {
|
||||
dynamicDefaults: {
|
||||
id1: 'uuid', // v4
|
||||
id2: { func: 'uuid', v: 4 }, // v4
|
||||
id3: { func: 'uuid', v: 1 } // v1
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## Security contact
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
Please do NOT report security vulnerabilities via GitHub issues.
|
||||
|
||||
|
||||
## Open-source software support
|
||||
|
||||
Ajv-keywords is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv-keywords?utm_source=npm-ajv-keywords&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/epoberezkin/ajv-keywords/blob/master/LICENSE)
|
||||
7
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/ajv-keywords.d.ts
generated
vendored
Normal file
7
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/ajv-keywords.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
declare module 'ajv-keywords' {
|
||||
import { Ajv } from 'ajv';
|
||||
|
||||
function keywords(ajv: Ajv, include?: string | string[]): Ajv;
|
||||
|
||||
export = keywords;
|
||||
}
|
||||
35
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/index.js
generated
vendored
Normal file
35
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var KEYWORDS = require('./keywords');
|
||||
|
||||
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;
|
||||
}
|
||||
101
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/_formatLimit.js
generated
vendored
Normal file
101
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/_formatLimit.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'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: require('./dotjs/_formatLimit'),
|
||||
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]);
|
||||
}
|
||||
15
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/_util.js
generated
vendored
Normal file
15
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/_util.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'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 {};
|
||||
}
|
||||
18
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/allRequired.js
generated
vendored
Normal file
18
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/allRequired.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'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;
|
||||
};
|
||||
24
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/anyRequired.js
generated
vendored
Normal file
24
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/anyRequired.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'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;
|
||||
};
|
||||
54
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/deepProperties.js
generated
vendored
Normal file
54
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/deepProperties.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./_util');
|
||||
|
||||
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, '~');
|
||||
}
|
||||
57
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/deepRequired.js
generated
vendored
Normal file
57
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/deepRequired.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'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, '~');
|
||||
}
|
||||
116
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
generated
vendored
Normal file
116
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
var {{=$valid}} = undefined;
|
||||
|
||||
{{## def.skipFormatLimit:
|
||||
{{=$valid}} = true;
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{## def.compareFormat:
|
||||
{{? $isData }}
|
||||
if ({{=$schemaValue}} === undefined) {{=$valid}} = true;
|
||||
else if (typeof {{=$schemaValue}} != 'string') {{=$valid}} = false;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{? $isDataFormat }}
|
||||
if (!{{=$compare}}) {{=$valid}} = true;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
var {{=$result}} = {{=$compare}}({{=$data}}, {{# def.schemaValueQS }});
|
||||
|
||||
if ({{=$result}} === undefined) {{=$valid}} = false;
|
||||
#}}
|
||||
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormatLimit }}{{?}}
|
||||
|
||||
{{
|
||||
var $schemaFormat = it.schema.format
|
||||
, $isDataFormat = it.opts.$data && $schemaFormat.$data
|
||||
, $closingBraces = '';
|
||||
}}
|
||||
|
||||
{{? $isDataFormat }}
|
||||
{{
|
||||
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr)
|
||||
, $format = 'format' + $lvl
|
||||
, $compare = 'compare' + $lvl;
|
||||
}}
|
||||
|
||||
var {{=$format}} = formats[{{=$schemaValueFormat}}]
|
||||
, {{=$compare}} = {{=$format}} && {{=$format}}.compare;
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schemaFormat]; }}
|
||||
{{? !($format && $format.compare) }}
|
||||
{{# def.skipFormatLimit }}
|
||||
{{?}}
|
||||
{{ 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;
|
||||
}}
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) {
|
||||
{{=$valid}} = false;
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_formatExclusiveLimit' }}
|
||||
}
|
||||
|
||||
{{# def.elseIfValid }}
|
||||
|
||||
{{# def.compareFormat }}
|
||||
var {{=$exclusive}} = {{=$schemaValueExcl}} === true;
|
||||
|
||||
if ({{=$valid}} === undefined) {
|
||||
{{=$valid}} = {{=$exclusive}}
|
||||
? {{=$result}} {{=$op}} 0
|
||||
: {{=$result}} {{=$op}}= 0;
|
||||
}
|
||||
|
||||
if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{??}}
|
||||
{{
|
||||
var $exclusive = $schemaExcl === true
|
||||
, $opStr = $op; /*used in error*/
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
{{# def.compareFormat }}
|
||||
|
||||
if ({{=$valid}} === undefined)
|
||||
{{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0;
|
||||
{{?}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_formatLimit' }}
|
||||
}
|
||||
33
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dot/patternRequired.jst
generated
vendored
Normal file
33
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dot/patternRequired.jst
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $matched = 'patternMatched' + $lvl
|
||||
, $dataProperties = 'dataProperties' + $lvl
|
||||
, $closingBraces = ''
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
}}
|
||||
|
||||
var {{=$valid}} = true;
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$pProperty }}
|
||||
var {{=$matched}} = false;
|
||||
{{# def.iterateProperties }}
|
||||
{{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
|
||||
if ({{=$matched}}) break;
|
||||
}
|
||||
|
||||
{{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
|
||||
if (!{{=$matched}}) {
|
||||
{{=$valid}} = false;
|
||||
{{# def.addError:'patternRequired' }}
|
||||
} {{# def.elseIfValid }}
|
||||
{{~}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
71
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dot/switch.jst
generated
vendored
Normal file
71
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dot/switch.jst
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateIf:
|
||||
{{# def.setCompositeRule }}
|
||||
{{ $it.createErrors = false; }}
|
||||
{{# def._validateSwitchRule:if }}
|
||||
{{ $it.createErrors = true; }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{=$ifPassed}} = {{=$nextValid}};
|
||||
#}}
|
||||
|
||||
{{## def.validateThen:
|
||||
{{? typeof $sch.then == 'boolean' }}
|
||||
{{? $sch.then === false }}
|
||||
{{# def.error:'switch' }}
|
||||
{{?}}
|
||||
var {{=$nextValid}} = {{= $sch.then }};
|
||||
{{??}}
|
||||
{{# def._validateSwitchRule:then }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{## def._validateSwitchRule:_clause:
|
||||
{{
|
||||
$it.schema = $sch._clause;
|
||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
|
||||
}}
|
||||
{{# def.insertSubschemaCode }}
|
||||
#}}
|
||||
|
||||
{{## def.switchCase:
|
||||
{{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.validateIf }}
|
||||
if ({{=$ifPassed}}) {
|
||||
{{# def.validateThen }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
}
|
||||
{{??}}
|
||||
{{=$ifPassed}} = true;
|
||||
{{# def.validateThen }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $ifPassed = 'ifPassed' + it.level
|
||||
, $currentBaseId = $it.baseId
|
||||
, $shouldContinue;
|
||||
}}
|
||||
var {{=$ifPassed}};
|
||||
|
||||
{{~ $schema:$sch:$caseIndex }}
|
||||
{{? $caseIndex && !$shouldContinue }}
|
||||
if (!{{=$ifPassed}}) {
|
||||
{{ $closingBraces+= '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{# def.switchCase }}
|
||||
{{ $shouldContinue = $sch.continue }}
|
||||
{{~}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
var {{=$valid}} = {{=$nextValid}};
|
||||
3
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/README.md
generated
vendored
Normal file
3
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
These files are compiled dot templates from dot folder.
|
||||
|
||||
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv-keywords folder.
|
||||
178
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js
generated
vendored
Normal file
178
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
'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;
|
||||
}
|
||||
58
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js
generated
vendored
Normal file
58
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'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;
|
||||
}
|
||||
129
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/switch.js
generated
vendored
Normal file
129
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dotjs/switch.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
'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;
|
||||
}
|
||||
72
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dynamicDefaults.js
generated
vendored
Normal file
72
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/dynamicDefaults.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
'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);
|
||||
}
|
||||
};
|
||||
3
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/formatMaximum.js
generated
vendored
Normal file
3
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/formatMaximum.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./_formatLimit')('Maximum');
|
||||
3
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/formatMinimum.js
generated
vendored
Normal file
3
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/formatMinimum.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./_formatLimit')('Minimum');
|
||||
22
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/index.js
generated
vendored
Normal file
22
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
'instanceof': require('./instanceof'),
|
||||
range: require('./range'),
|
||||
regexp: require('./regexp'),
|
||||
'typeof': require('./typeof'),
|
||||
dynamicDefaults: require('./dynamicDefaults'),
|
||||
allRequired: require('./allRequired'),
|
||||
anyRequired: require('./anyRequired'),
|
||||
oneRequired: require('./oneRequired'),
|
||||
prohibited: require('./prohibited'),
|
||||
uniqueItemProperties: require('./uniqueItemProperties'),
|
||||
deepProperties: require('./deepProperties'),
|
||||
deepRequired: require('./deepRequired'),
|
||||
formatMinimum: require('./formatMinimum'),
|
||||
formatMaximum: require('./formatMaximum'),
|
||||
patternRequired: require('./patternRequired'),
|
||||
'switch': require('./switch'),
|
||||
select: require('./select'),
|
||||
transform: require('./transform')
|
||||
};
|
||||
58
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/instanceof.js
generated
vendored
Normal file
58
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/instanceof.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'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);
|
||||
}
|
||||
};
|
||||
24
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/oneRequired.js
generated
vendored
Normal file
24
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/oneRequired.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'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;
|
||||
};
|
||||
21
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/patternRequired.js
generated
vendored
Normal file
21
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/patternRequired.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'object',
|
||||
inline: require('./dotjs/patternRequired'),
|
||||
statements: true,
|
||||
errors: 'full',
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
format: 'regex'
|
||||
},
|
||||
uniqueItems: true
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('patternRequired', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
||||
24
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/prohibited.js
generated
vendored
Normal file
24
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/prohibited.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'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;
|
||||
};
|
||||
36
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/range.js
generated
vendored
Normal file
36
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/range.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'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');
|
||||
}
|
||||
};
|
||||
36
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/regexp.js
generated
vendored
Normal file
36
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/regexp.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'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;
|
||||
};
|
||||
79
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/select.js
generated
vendored
Normal file
79
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/select.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./_util');
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
38
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/switch.js
generated
vendored
Normal file
38
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/switch.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./_util');
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return;
|
||||
|
||||
var metaSchemaRef = util.metaSchemaRef(ajv);
|
||||
|
||||
defFunc.definition = {
|
||||
inline: require('./dotjs/switch'),
|
||||
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;
|
||||
};
|
||||
80
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/transform.js
generated
vendored
Normal file
80
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/transform.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
'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();
|
||||
}
|
||||
};
|
||||
32
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/typeof.js
generated
vendored
Normal file
32
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/typeof.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'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;
|
||||
};
|
||||
59
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/uniqueItemProperties.js
generated
vendored
Normal file
59
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/keywords/uniqueItemProperties.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'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;
|
||||
});
|
||||
}
|
||||
53
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/package.json
generated
vendored
Normal file
53
backend/frontend/node_modules/file-loader/node_modules/ajv-keywords/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "ajv-keywords",
|
||||
"version": "3.5.2",
|
||||
"description": "Custom JSON-Schema keywords for Ajv validator",
|
||||
"main": "index.js",
|
||||
"typings": "ajv-keywords.d.ts",
|
||||
"scripts": {
|
||||
"build": "node node_modules/ajv/scripts/compile-dots.js node_modules/ajv/lib keywords",
|
||||
"prepublish": "npm run build",
|
||||
"test": "npm run build && npm run eslint && npm run test-cov",
|
||||
"eslint": "eslint index.js keywords/*.js spec",
|
||||
"test-spec": "mocha spec/*.spec.js -R spec",
|
||||
"test-cov": "istanbul cover -x 'spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/epoberezkin/ajv-keywords.git"
|
||||
},
|
||||
"keywords": [
|
||||
"JSON-Schema",
|
||||
"ajv",
|
||||
"keywords"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"ajv-keywords.d.ts",
|
||||
"keywords"
|
||||
],
|
||||
"author": "Evgeny Poberezkin",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/epoberezkin/ajv-keywords/issues"
|
||||
},
|
||||
"homepage": "https://github.com/epoberezkin/ajv-keywords#readme",
|
||||
"peerDependencies": {
|
||||
"ajv": "^6.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ajv": "^6.9.1",
|
||||
"ajv-pack": "^0.3.0",
|
||||
"chai": "^4.2.0",
|
||||
"coveralls": "^3.0.2",
|
||||
"dot": "^1.1.1",
|
||||
"eslint": "^7.2.0",
|
||||
"glob": "^7.1.3",
|
||||
"istanbul": "^0.4.3",
|
||||
"js-beautify": "^1.8.9",
|
||||
"json-schema-test": "^2.0.0",
|
||||
"mocha": "^8.0.1",
|
||||
"pre-commit": "^1.1.3",
|
||||
"uuid": "^8.1.0"
|
||||
}
|
||||
}
|
||||
20
backend/frontend/node_modules/file-loader/node_modules/ajv/.tonic_example.js
generated
vendored
Normal file
20
backend/frontend/node_modules/file-loader/node_modules/ajv/.tonic_example.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var Ajv = require('ajv');
|
||||
var ajv = new Ajv({allErrors: true});
|
||||
|
||||
var schema = {
|
||||
"properties": {
|
||||
"foo": { "type": "string" },
|
||||
"bar": { "type": "number", "maximum": 3 }
|
||||
}
|
||||
};
|
||||
|
||||
var validate = ajv.compile(schema);
|
||||
|
||||
test({"foo": "abc", "bar": 2});
|
||||
test({"foo": 2, "bar": 4});
|
||||
|
||||
function test(data) {
|
||||
var valid = validate(data);
|
||||
if (valid) console.log('Valid!');
|
||||
else console.log('Invalid: ' + ajv.errorsText(validate.errors));
|
||||
}
|
||||
22
backend/frontend/node_modules/file-loader/node_modules/ajv/LICENSE
generated
vendored
Normal file
22
backend/frontend/node_modules/file-loader/node_modules/ajv/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
1497
backend/frontend/node_modules/file-loader/node_modules/ajv/README.md
generated
vendored
Normal file
1497
backend/frontend/node_modules/file-loader/node_modules/ajv/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
106
backend/frontend/node_modules/file-loader/node_modules/ajv/package.json
generated
vendored
Normal file
106
backend/frontend/node_modules/file-loader/node_modules/ajv/package.json
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "ajv",
|
||||
"version": "6.12.6",
|
||||
"description": "Another JSON Schema Validator",
|
||||
"main": "lib/ajv.js",
|
||||
"typings": "lib/ajv.d.ts",
|
||||
"files": [
|
||||
"lib/",
|
||||
"dist/",
|
||||
"scripts/",
|
||||
"LICENSE",
|
||||
".tonic_example.js"
|
||||
],
|
||||
"scripts": {
|
||||
"eslint": "eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite",
|
||||
"jshint": "jshint lib/{compile/,}*.js",
|
||||
"lint": "npm run jshint && npm run eslint",
|
||||
"test-spec": "mocha spec/{**/,}*.spec.js -R spec",
|
||||
"test-fast": "AJV_FAST_TEST=true npm run test-spec",
|
||||
"test-debug": "npm run test-spec -- --inspect-brk",
|
||||
"test-cov": "nyc npm run test-spec",
|
||||
"test-ts": "tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts",
|
||||
"bundle": "del-cli dist && node ./scripts/bundle.js . Ajv pure_getters",
|
||||
"bundle-beautify": "node ./scripts/bundle.js js-beautify",
|
||||
"build": "del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js",
|
||||
"test-karma": "karma start",
|
||||
"test-browser": "del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma",
|
||||
"test-all": "npm run test-cov && if-node-version 10 npm run test-browser",
|
||||
"test": "npm run lint && npm run build && npm run test-all",
|
||||
"prepublish": "npm run build && npm run bundle",
|
||||
"watch": "watch \"npm run build\" ./lib/dot"
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"**/spec/**",
|
||||
"node_modules"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ajv-validator/ajv.git"
|
||||
},
|
||||
"keywords": [
|
||||
"JSON",
|
||||
"schema",
|
||||
"validator",
|
||||
"validation",
|
||||
"jsonschema",
|
||||
"json-schema",
|
||||
"json-schema-validator",
|
||||
"json-schema-validation"
|
||||
],
|
||||
"author": "Evgeny Poberezkin",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ajv-validator/ajv/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ajv-validator/ajv",
|
||||
"tonicExampleFilename": ".tonic_example.js",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ajv-async": "^1.0.0",
|
||||
"bluebird": "^3.5.3",
|
||||
"brfs": "^2.0.0",
|
||||
"browserify": "^16.2.0",
|
||||
"chai": "^4.0.1",
|
||||
"coveralls": "^3.0.1",
|
||||
"del-cli": "^3.0.0",
|
||||
"dot": "^1.0.3",
|
||||
"eslint": "^7.3.1",
|
||||
"gh-pages-generator": "^0.2.3",
|
||||
"glob": "^7.0.0",
|
||||
"if-node-version": "^1.0.0",
|
||||
"js-beautify": "^1.7.3",
|
||||
"jshint": "^2.10.2",
|
||||
"json-schema-test": "^2.0.0",
|
||||
"karma": "^5.0.0",
|
||||
"karma-chrome-launcher": "^3.0.0",
|
||||
"karma-mocha": "^2.0.0",
|
||||
"karma-sauce-launcher": "^4.1.3",
|
||||
"mocha": "^8.0.1",
|
||||
"nyc": "^15.0.0",
|
||||
"pre-commit": "^1.1.1",
|
||||
"require-globify": "^1.3.0",
|
||||
"typescript": "^3.9.5",
|
||||
"uglify-js": "^3.6.9",
|
||||
"watch": "^1.0.0"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/ajv"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
}
|
||||
27
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/.eslintrc.yml
generated
vendored
Normal file
27
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/.eslintrc.yml
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
extends: eslint:recommended
|
||||
env:
|
||||
node: true
|
||||
browser: true
|
||||
rules:
|
||||
block-scoped-var: 2
|
||||
complexity: [2, 13]
|
||||
curly: [2, multi-or-nest, consistent]
|
||||
dot-location: [2, property]
|
||||
dot-notation: 2
|
||||
indent: [2, 2, SwitchCase: 1]
|
||||
linebreak-style: [2, unix]
|
||||
new-cap: 2
|
||||
no-console: [2, allow: [warn, error]]
|
||||
no-else-return: 2
|
||||
no-eq-null: 2
|
||||
no-fallthrough: 2
|
||||
no-invalid-this: 2
|
||||
no-return-assign: 2
|
||||
no-shadow: 1
|
||||
no-trailing-spaces: 2
|
||||
no-use-before-define: [2, nofunc]
|
||||
quotes: [2, single, avoid-escape]
|
||||
semi: [2, always]
|
||||
strict: [2, global]
|
||||
valid-jsdoc: [2, requireReturn: false]
|
||||
no-control-regex: 0
|
||||
8
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/.travis.yml
generated
vendored
Normal file
8
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4"
|
||||
- "6"
|
||||
- "7"
|
||||
- "8"
|
||||
after_script:
|
||||
- coveralls < coverage/lcov.info
|
||||
21
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/LICENSE
generated
vendored
Normal file
21
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
83
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/README.md
generated
vendored
Normal file
83
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/README.md
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
# json-schema-traverse
|
||||
Traverse JSON Schema passing each schema object to callback
|
||||
|
||||
[](https://travis-ci.org/epoberezkin/json-schema-traverse)
|
||||
[](https://www.npmjs.com/package/json-schema-traverse)
|
||||
[](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install json-schema-traverse
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
const traverse = require('json-schema-traverse');
|
||||
const schema = {
|
||||
properties: {
|
||||
foo: {type: 'string'},
|
||||
bar: {type: 'integer'}
|
||||
}
|
||||
};
|
||||
|
||||
traverse(schema, {cb});
|
||||
// cb is called 3 times with:
|
||||
// 1. root schema
|
||||
// 2. {type: 'string'}
|
||||
// 3. {type: 'integer'}
|
||||
|
||||
// Or:
|
||||
|
||||
traverse(schema, {cb: {pre, post}});
|
||||
// pre is called 3 times with:
|
||||
// 1. root schema
|
||||
// 2. {type: 'string'}
|
||||
// 3. {type: 'integer'}
|
||||
//
|
||||
// post is called 3 times with:
|
||||
// 1. {type: 'string'}
|
||||
// 2. {type: 'integer'}
|
||||
// 3. root schema
|
||||
|
||||
```
|
||||
|
||||
Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed.
|
||||
|
||||
Callback is passed these parameters:
|
||||
|
||||
- _schema_: the current schema object
|
||||
- _JSON pointer_: from the root schema to the current schema object
|
||||
- _root schema_: the schema passed to `traverse` object
|
||||
- _parent JSON pointer_: from the root schema to the parent schema object (see below)
|
||||
- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.)
|
||||
- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema
|
||||
- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'`
|
||||
|
||||
|
||||
## Traverse objects in all unknown keywords
|
||||
|
||||
```javascript
|
||||
const traverse = require('json-schema-traverse');
|
||||
const schema = {
|
||||
mySchema: {
|
||||
minimum: 1,
|
||||
maximum: 2
|
||||
}
|
||||
};
|
||||
|
||||
traverse(schema, {allKeys: true, cb});
|
||||
// cb is called 2 times with:
|
||||
// 1. root schema
|
||||
// 2. mySchema
|
||||
```
|
||||
|
||||
Without option `allKeys: true` callback will be called only with root schema.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE)
|
||||
89
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/index.js
generated
vendored
Normal file
89
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/index.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
'use strict';
|
||||
|
||||
var traverse = module.exports = function (schema, opts, cb) {
|
||||
// Legacy support for v0.3.1 and earlier.
|
||||
if (typeof opts == 'function') {
|
||||
cb = opts;
|
||||
opts = {};
|
||||
}
|
||||
|
||||
cb = opts.cb || cb;
|
||||
var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};
|
||||
var post = cb.post || function() {};
|
||||
|
||||
_traverse(opts, pre, post, schema, '', schema);
|
||||
};
|
||||
|
||||
|
||||
traverse.keywords = {
|
||||
additionalItems: true,
|
||||
items: true,
|
||||
contains: true,
|
||||
additionalProperties: true,
|
||||
propertyNames: true,
|
||||
not: true
|
||||
};
|
||||
|
||||
traverse.arrayKeywords = {
|
||||
items: true,
|
||||
allOf: true,
|
||||
anyOf: true,
|
||||
oneOf: true
|
||||
};
|
||||
|
||||
traverse.propsKeywords = {
|
||||
definitions: true,
|
||||
properties: true,
|
||||
patternProperties: true,
|
||||
dependencies: true
|
||||
};
|
||||
|
||||
traverse.skipKeywords = {
|
||||
default: true,
|
||||
enum: true,
|
||||
const: true,
|
||||
required: true,
|
||||
maximum: true,
|
||||
minimum: true,
|
||||
exclusiveMaximum: true,
|
||||
exclusiveMinimum: true,
|
||||
multipleOf: true,
|
||||
maxLength: true,
|
||||
minLength: true,
|
||||
pattern: true,
|
||||
format: true,
|
||||
maxItems: true,
|
||||
minItems: true,
|
||||
uniqueItems: true,
|
||||
maxProperties: true,
|
||||
minProperties: true
|
||||
};
|
||||
|
||||
|
||||
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
||||
if (schema && typeof schema == 'object' && !Array.isArray(schema)) {
|
||||
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
||||
for (var key in schema) {
|
||||
var sch = schema[key];
|
||||
if (Array.isArray(sch)) {
|
||||
if (key in traverse.arrayKeywords) {
|
||||
for (var i=0; i<sch.length; i++)
|
||||
_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
|
||||
}
|
||||
} else if (key in traverse.propsKeywords) {
|
||||
if (sch && typeof sch == 'object') {
|
||||
for (var prop in sch)
|
||||
_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
||||
}
|
||||
} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
|
||||
_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
|
||||
}
|
||||
}
|
||||
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function escapeJsonPtr(str) {
|
||||
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
}
|
||||
43
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/package.json
generated
vendored
Normal file
43
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "json-schema-traverse",
|
||||
"version": "0.4.1",
|
||||
"description": "Traverse JSON Schema passing each schema object to callback",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"eslint": "eslint index.js spec",
|
||||
"test-spec": "mocha spec -R spec",
|
||||
"test": "npm run eslint && nyc npm run test-spec"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/epoberezkin/json-schema-traverse.git"
|
||||
},
|
||||
"keywords": [
|
||||
"JSON-Schema",
|
||||
"traverse",
|
||||
"iterate"
|
||||
],
|
||||
"author": "Evgeny Poberezkin",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/epoberezkin/json-schema-traverse/issues"
|
||||
},
|
||||
"homepage": "https://github.com/epoberezkin/json-schema-traverse#readme",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.13.1",
|
||||
"eslint": "^3.19.0",
|
||||
"mocha": "^3.4.2",
|
||||
"nyc": "^11.0.2",
|
||||
"pre-commit": "^1.2.2"
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"**/spec/**",
|
||||
"node_modules"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
}
|
||||
}
|
||||
6
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/spec/.eslintrc.yml
generated
vendored
Normal file
6
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/spec/.eslintrc.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
parserOptions:
|
||||
ecmaVersion: 6
|
||||
globals:
|
||||
beforeEach: false
|
||||
describe: false
|
||||
it: false
|
||||
125
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/spec/fixtures/schema.js
generated
vendored
Normal file
125
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/spec/fixtures/schema.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
'use strict';
|
||||
|
||||
var schema = {
|
||||
additionalItems: subschema('additionalItems'),
|
||||
items: subschema('items'),
|
||||
contains: subschema('contains'),
|
||||
additionalProperties: subschema('additionalProperties'),
|
||||
propertyNames: subschema('propertyNames'),
|
||||
not: subschema('not'),
|
||||
allOf: [
|
||||
subschema('allOf_0'),
|
||||
subschema('allOf_1'),
|
||||
{
|
||||
items: [
|
||||
subschema('items_0'),
|
||||
subschema('items_1'),
|
||||
]
|
||||
}
|
||||
],
|
||||
anyOf: [
|
||||
subschema('anyOf_0'),
|
||||
subschema('anyOf_1'),
|
||||
],
|
||||
oneOf: [
|
||||
subschema('oneOf_0'),
|
||||
subschema('oneOf_1'),
|
||||
],
|
||||
definitions: {
|
||||
foo: subschema('definitions_foo'),
|
||||
bar: subschema('definitions_bar'),
|
||||
},
|
||||
properties: {
|
||||
foo: subschema('properties_foo'),
|
||||
bar: subschema('properties_bar'),
|
||||
},
|
||||
patternProperties: {
|
||||
foo: subschema('patternProperties_foo'),
|
||||
bar: subschema('patternProperties_bar'),
|
||||
},
|
||||
dependencies: {
|
||||
foo: subschema('dependencies_foo'),
|
||||
bar: subschema('dependencies_bar'),
|
||||
},
|
||||
required: ['foo', 'bar']
|
||||
};
|
||||
|
||||
|
||||
function subschema(keyword) {
|
||||
var sch = {
|
||||
properties: {},
|
||||
additionalProperties: false,
|
||||
additionalItems: false,
|
||||
anyOf: [
|
||||
{format: 'email'},
|
||||
{format: 'hostname'}
|
||||
]
|
||||
};
|
||||
sch.properties['foo_' + keyword] = {title: 'foo'};
|
||||
sch.properties['bar_' + keyword] = {title: 'bar'};
|
||||
return sch;
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
schema: schema,
|
||||
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
expectedCalls: [[schema, '', schema, undefined, undefined, undefined, undefined]]
|
||||
.concat(expectedCalls('additionalItems'))
|
||||
.concat(expectedCalls('items'))
|
||||
.concat(expectedCalls('contains'))
|
||||
.concat(expectedCalls('additionalProperties'))
|
||||
.concat(expectedCalls('propertyNames'))
|
||||
.concat(expectedCalls('not'))
|
||||
.concat(expectedCallsChild('allOf', 0))
|
||||
.concat(expectedCallsChild('allOf', 1))
|
||||
.concat([
|
||||
[schema.allOf[2], '/allOf/2', schema, '', 'allOf', schema, 2],
|
||||
[schema.allOf[2].items[0], '/allOf/2/items/0', schema, '/allOf/2', 'items', schema.allOf[2], 0],
|
||||
[schema.allOf[2].items[0].properties.foo_items_0, '/allOf/2/items/0/properties/foo_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'foo_items_0'],
|
||||
[schema.allOf[2].items[0].properties.bar_items_0, '/allOf/2/items/0/properties/bar_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'bar_items_0'],
|
||||
[schema.allOf[2].items[0].anyOf[0], '/allOf/2/items/0/anyOf/0', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 0],
|
||||
[schema.allOf[2].items[0].anyOf[1], '/allOf/2/items/0/anyOf/1', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 1],
|
||||
|
||||
[schema.allOf[2].items[1], '/allOf/2/items/1', schema, '/allOf/2', 'items', schema.allOf[2], 1],
|
||||
[schema.allOf[2].items[1].properties.foo_items_1, '/allOf/2/items/1/properties/foo_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'foo_items_1'],
|
||||
[schema.allOf[2].items[1].properties.bar_items_1, '/allOf/2/items/1/properties/bar_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'bar_items_1'],
|
||||
[schema.allOf[2].items[1].anyOf[0], '/allOf/2/items/1/anyOf/0', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 0],
|
||||
[schema.allOf[2].items[1].anyOf[1], '/allOf/2/items/1/anyOf/1', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 1]
|
||||
])
|
||||
.concat(expectedCallsChild('anyOf', 0))
|
||||
.concat(expectedCallsChild('anyOf', 1))
|
||||
.concat(expectedCallsChild('oneOf', 0))
|
||||
.concat(expectedCallsChild('oneOf', 1))
|
||||
.concat(expectedCallsChild('definitions', 'foo'))
|
||||
.concat(expectedCallsChild('definitions', 'bar'))
|
||||
.concat(expectedCallsChild('properties', 'foo'))
|
||||
.concat(expectedCallsChild('properties', 'bar'))
|
||||
.concat(expectedCallsChild('patternProperties', 'foo'))
|
||||
.concat(expectedCallsChild('patternProperties', 'bar'))
|
||||
.concat(expectedCallsChild('dependencies', 'foo'))
|
||||
.concat(expectedCallsChild('dependencies', 'bar'))
|
||||
};
|
||||
|
||||
|
||||
function expectedCalls(keyword) {
|
||||
return [
|
||||
[schema[keyword], `/${keyword}`, schema, '', keyword, schema, undefined],
|
||||
[schema[keyword].properties[`foo_${keyword}`], `/${keyword}/properties/foo_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `foo_${keyword}`],
|
||||
[schema[keyword].properties[`bar_${keyword}`], `/${keyword}/properties/bar_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `bar_${keyword}`],
|
||||
[schema[keyword].anyOf[0], `/${keyword}/anyOf/0`, schema, `/${keyword}`, 'anyOf', schema[keyword], 0],
|
||||
[schema[keyword].anyOf[1], `/${keyword}/anyOf/1`, schema, `/${keyword}`, 'anyOf', schema[keyword], 1]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function expectedCallsChild(keyword, i) {
|
||||
return [
|
||||
[schema[keyword][i], `/${keyword}/${i}`, schema, '', keyword, schema, i],
|
||||
[schema[keyword][i].properties[`foo_${keyword}_${i}`], `/${keyword}/${i}/properties/foo_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `foo_${keyword}_${i}`],
|
||||
[schema[keyword][i].properties[`bar_${keyword}_${i}`], `/${keyword}/${i}/properties/bar_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `bar_${keyword}_${i}`],
|
||||
[schema[keyword][i].anyOf[0], `/${keyword}/${i}/anyOf/0`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 0],
|
||||
[schema[keyword][i].anyOf[1], `/${keyword}/${i}/anyOf/1`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 1]
|
||||
];
|
||||
}
|
||||
171
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/spec/index.spec.js
generated
vendored
Normal file
171
backend/frontend/node_modules/file-loader/node_modules/json-schema-traverse/spec/index.spec.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
'use strict';
|
||||
|
||||
var traverse = require('../index');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('json-schema-traverse', function() {
|
||||
var calls;
|
||||
|
||||
beforeEach(function() {
|
||||
calls = [];
|
||||
});
|
||||
|
||||
it('should traverse all keywords containing schemas recursively', function() {
|
||||
var schema = require('./fixtures/schema').schema;
|
||||
var expectedCalls = require('./fixtures/schema').expectedCalls;
|
||||
|
||||
traverse(schema, {cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
describe('Legacy v0.3.1 API', function() {
|
||||
it('should traverse all keywords containing schemas recursively', function() {
|
||||
var schema = require('./fixtures/schema').schema;
|
||||
var expectedCalls = require('./fixtures/schema').expectedCalls;
|
||||
|
||||
traverse(schema, callback);
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
it('should work when an options object is provided', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var schema = require('./fixtures/schema').schema;
|
||||
var expectedCalls = require('./fixtures/schema').expectedCalls;
|
||||
|
||||
traverse(schema, {}, callback);
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('allKeys option', function() {
|
||||
var schema = {
|
||||
someObject: {
|
||||
minimum: 1,
|
||||
maximum: 2
|
||||
}
|
||||
};
|
||||
|
||||
it('should traverse objects with allKeys: true option', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
[schema.someObject, '/someObject', schema, '', 'someObject', schema, undefined]
|
||||
];
|
||||
|
||||
traverse(schema, {allKeys: true, cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
|
||||
it('should NOT traverse objects with allKeys: false option', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema, '', schema, undefined, undefined, undefined, undefined]
|
||||
];
|
||||
|
||||
traverse(schema, {allKeys: false, cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
|
||||
it('should NOT traverse objects without allKeys option', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema, '', schema, undefined, undefined, undefined, undefined]
|
||||
];
|
||||
|
||||
traverse(schema, {cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
|
||||
it('should NOT travers objects in standard keywords which value is not a schema', function() {
|
||||
var schema2 = {
|
||||
const: {foo: 'bar'},
|
||||
enum: ['a', 'b'],
|
||||
required: ['foo'],
|
||||
another: {
|
||||
|
||||
},
|
||||
patternProperties: {}, // will not traverse - no properties
|
||||
dependencies: true, // will not traverse - invalid
|
||||
properties: {
|
||||
smaller: {
|
||||
type: 'number'
|
||||
},
|
||||
larger: {
|
||||
type: 'number',
|
||||
minimum: {$data: '1/smaller'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema2, '', schema2, undefined, undefined, undefined, undefined],
|
||||
[schema2.another, '/another', schema2, '', 'another', schema2, undefined],
|
||||
[schema2.properties.smaller, '/properties/smaller', schema2, '', 'properties', schema2, 'smaller'],
|
||||
[schema2.properties.larger, '/properties/larger', schema2, '', 'properties', schema2, 'larger'],
|
||||
];
|
||||
|
||||
traverse(schema2, {allKeys: true, cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
});
|
||||
|
||||
describe('pre and post', function() {
|
||||
var schema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
age: {type: 'number'}
|
||||
}
|
||||
};
|
||||
|
||||
it('should traverse schema in pre-order', function() {
|
||||
traverse(schema, {cb: {pre}});
|
||||
var expectedCalls = [
|
||||
['pre', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
];
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
it('should traverse schema in post-order', function() {
|
||||
traverse(schema, {cb: {post}});
|
||||
var expectedCalls = [
|
||||
['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
['post', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
];
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
it('should traverse schema in pre- and post-order at the same time', function() {
|
||||
traverse(schema, {cb: {pre, post}});
|
||||
var expectedCalls = [
|
||||
['pre', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
['post', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
];
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
});
|
||||
|
||||
function callback() {
|
||||
calls.push(Array.prototype.slice.call(arguments));
|
||||
}
|
||||
|
||||
function pre() {
|
||||
calls.push(['pre'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
|
||||
function post() {
|
||||
calls.push(['post'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
});
|
||||
340
backend/frontend/node_modules/file-loader/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
340
backend/frontend/node_modules/file-loader/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [3.3.0](https://github.com/webpack/schema-utils/compare/v3.2.0...v3.3.0) (2023-06-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added API to disable and enable validation ([#183](https://github.com/webpack/schema-utils/issues/183)) ([d4d334f](https://github.com/webpack/schema-utils/commit/d4d334f0ba22eb6b6564b1119e8f3ea439e1f2bb))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **perf:** cache compiled schema ([#182](https://github.com/webpack/schema-utils/issues/182)) ([02aa068](https://github.com/webpack/schema-utils/commit/02aa068df80d99cc576a5ed385f947eb5204c5db))
|
||||
|
||||
## [3.2.0](https://github.com/webpack/schema-utils/compare/v3.1.2...v3.2.0) (2023-06-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* implement `undefinedAsNull` keyword for `enum` type ([#176](https://github.com/webpack/schema-utils/issues/176)) ([95826eb](https://github.com/webpack/schema-utils/commit/95826eb9e14bc4b10ab95f962ac2bdca447880a3))
|
||||
|
||||
### [3.1.2](https://github.com/webpack/schema-utils/compare/v3.1.1...v3.1.2) (2023-04-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **perf:** reduced initial start time ([#170](https://github.com/webpack/schema-utils/issues/170)) ([8d052e6](https://github.com/webpack/schema-utils/commit/8d052e6764dc9247e7d5b7b1ae8f87ca5047b2b0))
|
||||
|
||||
### [3.1.1](https://github.com/webpack/schema-utils/compare/v3.1.0...v3.1.1) (2021-07-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update error message for `integer` ([#136](https://github.com/webpack/schema-utils/issues/136)) ([2daa97e](https://github.com/webpack/schema-utils/commit/2daa97eae87e6790b92711746a6a527b859ac13b))
|
||||
|
||||
## [3.1.0](https://github.com/webpack/schema-utils/compare/v3.0.0...v3.1.0) (2021-06-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added the `link` property in validation error ([589aa59](https://github.com/webpack/schema-utils/commit/589aa5993424a8bc45ec22b67dff55be92c456a9))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* non-empty validation error message ([#116](https://github.com/webpack/schema-utils/issues/116)) ([c51abef](https://github.com/webpack/schema-utils/commit/c51abefa4d4d62e1346b3a105182d36675595077))
|
||||
|
||||
## [3.0.0](https://github.com/webpack/schema-utils/compare/v2.7.1...v3.0.0) (2020-10-05)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* minimum supported `Node.js` version is `10.13.0`,
|
||||
* the packages exports was changed, please use `const { validate } = require('schema-utils');`
|
||||
* the `ValidateError` export was removed in favor the `ValidationError` export, please use `const { ValidationError } = require('schema-utils');`
|
||||
|
||||
### [2.7.1](https://github.com/webpack/schema-utils/compare/v2.7.0...v2.7.1) (2020-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove esModuleInterop from tsconfig ([#110](https://github.com/webpack/schema-utils/issues/110)) ([#111](https://github.com/webpack/schema-utils/issues/111)) ([2f40154](https://github.com/webpack/schema-utils/commit/2f40154b91e45b393258ae9dd8f10cc3b8590b7d))
|
||||
|
||||
## [2.7.0](https://github.com/webpack/schema-utils/compare/v2.6.6...v2.7.0) (2020-05-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* improve hints ([a36e535](https://github.com/webpack/schema-utils/commit/a36e535faca1b01e27c3bfa3c8bee9227c3f836c))
|
||||
* smart not case ([#101](https://github.com/webpack/schema-utils/issues/101)) ([698d8b0](https://github.com/webpack/schema-utils/commit/698d8b05462d86aadb217e25a45c7b953a79a52e))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* move @types/json-schema from devDependencies to dependencies ([#97](https://github.com/webpack/schema-utils/issues/97)) ([#98](https://github.com/webpack/schema-utils/issues/98)) ([945e67d](https://github.com/webpack/schema-utils/commit/945e67db5e19baf7ec7df72813b0739dd56f950d))
|
||||
|
||||
### [2.6.6](https://github.com/webpack/schema-utils/compare/v2.6.5...v2.6.6) (2020-04-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* improve perf
|
||||
|
||||
### [2.6.5](https://github.com/webpack/schema-utils/compare/v2.6.4...v2.6.5) (2020-03-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct dots at end of sentence ([7284beb](https://github.com/webpack/schema-utils/commit/7284bebe00cd570f1bef2c15951a07b9794038e6))
|
||||
|
||||
### [2.6.4](https://github.com/webpack/schema-utils/compare/v2.6.3...v2.6.4) (2020-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change `initialised` to `initialized` ([#87](https://github.com/webpack/schema-utils/issues/87)) ([70f12d3](https://github.com/webpack/schema-utils/commit/70f12d33a8eaa27249bc9c1a27f886724cf91ea7))
|
||||
|
||||
### [2.6.3](https://github.com/webpack/schema-utils/compare/v2.6.2...v2.6.3) (2020-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* prefer the `baseDataPath` option from arguments ([#86](https://github.com/webpack/schema-utils/issues/86)) ([e236859](https://github.com/webpack/schema-utils/commit/e236859e85b28e35e1294f86fc1ff596a5031cea))
|
||||
|
||||
### [2.6.2](https://github.com/webpack/schema-utils/compare/v2.6.1...v2.6.2) (2020-01-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* better handle Windows absolute paths ([#85](https://github.com/webpack/schema-utils/issues/85)) ([1fa2930](https://github.com/webpack/schema-utils/commit/1fa2930a161e907b9fc53a7233d605910afdb883))
|
||||
|
||||
### [2.6.1](https://github.com/webpack/schema-utils/compare/v2.6.0...v2.6.1) (2019-11-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* typescript declarations ([#84](https://github.com/webpack/schema-utils/issues/84)) ([89d55a9](https://github.com/webpack/schema-utils/commit/89d55a9a8edfa6a8ac8b112f226bb3154e260319))
|
||||
|
||||
## [2.6.0](https://github.com/webpack/schema-utils/compare/v2.5.0...v2.6.0) (2019-11-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support configuration via title ([#81](https://github.com/webpack/schema-utils/issues/81)) ([afddc10](https://github.com/webpack/schema-utils/commit/afddc109f6891cd37a9f1835d50862d119a072bf))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* typescript definitions ([#70](https://github.com/webpack/schema-utils/issues/70)) ([f38158d](https://github.com/webpack/schema-utils/commit/f38158d6d040e2c701622778ae8122fb26a4f990))
|
||||
|
||||
## [2.5.0](https://github.com/webpack/schema-utils/compare/v2.4.1...v2.5.0) (2019-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* rework format for maxLength, minLength ([#67](https://github.com/webpack/schema-utils/issues/67)) ([0d12259](https://github.com/webpack/schema-utils/commit/0d12259))
|
||||
* support all cases with one number in range ([#64](https://github.com/webpack/schema-utils/issues/64)) ([7fc8069](https://github.com/webpack/schema-utils/commit/7fc8069))
|
||||
* typescript definition and export naming ([#69](https://github.com/webpack/schema-utils/issues/69)) ([a435b79](https://github.com/webpack/schema-utils/commit/a435b79))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* "smart" numbers range ([62fb107](https://github.com/webpack/schema-utils/commit/62fb107))
|
||||
|
||||
### [2.4.1](https://github.com/webpack/schema-utils/compare/v2.4.0...v2.4.1) (2019-09-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* publish definitions ([#58](https://github.com/webpack/schema-utils/issues/58)) ([1885faa](https://github.com/webpack/schema-utils/commit/1885faa))
|
||||
|
||||
## [2.4.0](https://github.com/webpack/schema-utils/compare/v2.3.0...v2.4.0) (2019-09-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* better errors when the `type` keyword doesn't exist ([0988be2](https://github.com/webpack/schema-utils/commit/0988be2))
|
||||
* support $data reference ([#56](https://github.com/webpack/schema-utils/issues/56)) ([d2f11d6](https://github.com/webpack/schema-utils/commit/d2f11d6))
|
||||
* types definitions ([#52](https://github.com/webpack/schema-utils/issues/52)) ([facb431](https://github.com/webpack/schema-utils/commit/facb431))
|
||||
|
||||
## [2.3.0](https://github.com/webpack/schema-utils/compare/v2.2.0...v2.3.0) (2019-09-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support `not` keyword ([#53](https://github.com/webpack/schema-utils/issues/53)) ([765f458](https://github.com/webpack/schema-utils/commit/765f458))
|
||||
|
||||
## [2.2.0](https://github.com/webpack/schema-utils/compare/v2.1.0...v2.2.0) (2019-09-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* better error output for `oneOf` and `anyOf` ([#48](https://github.com/webpack/schema-utils/issues/48)) ([#50](https://github.com/webpack/schema-utils/issues/50)) ([332242f](https://github.com/webpack/schema-utils/commit/332242f))
|
||||
|
||||
## [2.1.0](https://github.com/webpack-contrib/schema-utils/compare/v2.0.1...v2.1.0) (2019-08-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* throw error on sparse arrays ([#47](https://github.com/webpack-contrib/schema-utils/issues/47)) ([b85ac38](https://github.com/webpack-contrib/schema-utils/commit/b85ac38))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* export `ValidateError` ([#46](https://github.com/webpack-contrib/schema-utils/issues/46)) ([ff781d7](https://github.com/webpack-contrib/schema-utils/commit/ff781d7))
|
||||
|
||||
|
||||
|
||||
### [2.0.1](https://github.com/webpack-contrib/schema-utils/compare/v2.0.0...v2.0.1) (2019-07-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* error message for empty object ([#44](https://github.com/webpack-contrib/schema-utils/issues/44)) ([0b4b4a2](https://github.com/webpack-contrib/schema-utils/commit/0b4b4a2))
|
||||
|
||||
|
||||
|
||||
### [2.0.0](https://github.com/webpack-contrib/schema-utils/compare/v1.0.0...v2.0.0) (2019-07-17)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* drop support for Node.js < 8.9.0
|
||||
* drop support `errorMessage`, please use `description` for links.
|
||||
* api was changed, please look documentation.
|
||||
* error messages was fully rewritten.
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.7"></a>
|
||||
## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.6"></a>
|
||||
## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81))
|
||||
* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.5"></a>
|
||||
## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f))
|
||||
* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.4"></a>
|
||||
## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.3"></a>
|
||||
## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda))
|
||||
* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.2"></a>
|
||||
## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.1"></a>
|
||||
## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974))
|
||||
|
||||
|
||||
|
||||
<a name="0.4.0"></a>
|
||||
# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816))
|
||||
|
||||
|
||||
|
||||
<a name="0.3.0"></a>
|
||||
# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb))
|
||||
|
||||
|
||||
|
||||
<a name="0.2.1"></a>
|
||||
## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363))
|
||||
* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f))
|
||||
|
||||
|
||||
|
||||
<a name="0.2.0"></a>
|
||||
# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12)
|
||||
|
||||
<a name="0.1.0"></a>
|
||||
# 0.1.0 (2017-03-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b))
|
||||
|
||||
|
||||
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
20
backend/frontend/node_modules/file-loader/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
20
backend/frontend/node_modules/file-loader/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
290
backend/frontend/node_modules/file-loader/node_modules/schema-utils/README.md
generated
vendored
Normal file
290
backend/frontend/node_modules/file-loader/node_modules/schema-utils/README.md
generated
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
<div align="center">
|
||||
<a href="http://json-schema.org">
|
||||
<img width="160" height="160"
|
||||
src="https://raw.githubusercontent.com/webpack-contrib/schema-utils/master/.github/assets/logo.png">
|
||||
</a>
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img width="200" height="200"
|
||||
src="https://webpack.js.org/assets/icon-square-big.svg">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![chat][chat]][chat-url]
|
||||
[![size][size]][size-url]
|
||||
|
||||
# schema-utils
|
||||
|
||||
Package for validate options in loaders and plugins.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To begin, you'll need to install `schema-utils`:
|
||||
|
||||
```console
|
||||
npm install schema-utils
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
**schema.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"option": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { option: true };
|
||||
const configuration = { name: "Loader Name/Plugin Name/Name" };
|
||||
|
||||
validate(schema, options, configuration);
|
||||
```
|
||||
|
||||
### `schema`
|
||||
|
||||
Type: `String`
|
||||
|
||||
JSON schema.
|
||||
|
||||
Simple example of schema:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "This is description of option.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
### `options`
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Object with options.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, { name: 123 }, { name: "MyPlugin" });
|
||||
```
|
||||
|
||||
### `configuration`
|
||||
|
||||
Allow to configure validator.
|
||||
|
||||
There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "My Loader options",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "This is description of option.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
The last word used for the `baseDataPath` option, other words used for the `name` option.
|
||||
Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`.
|
||||
|
||||
#### `name`
|
||||
|
||||
Type: `Object`
|
||||
Default: `"Object"`
|
||||
|
||||
Allow to setup name in validation errors.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, options, { name: "MyPlugin" });
|
||||
```
|
||||
|
||||
```shell
|
||||
Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema.
|
||||
- configuration.optionName should be a integer.
|
||||
```
|
||||
|
||||
#### `baseDataPath`
|
||||
|
||||
Type: `String`
|
||||
Default: `"configuration"`
|
||||
|
||||
Allow to setup base data path in validation errors.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, options, { name: "MyPlugin", baseDataPath: "options" });
|
||||
```
|
||||
|
||||
```shell
|
||||
Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema.
|
||||
- options.optionName should be a integer.
|
||||
```
|
||||
|
||||
#### `postFormatter`
|
||||
|
||||
Type: `Function`
|
||||
Default: `undefined`
|
||||
|
||||
Allow to reformat errors.
|
||||
|
||||
```js
|
||||
import schema from "./path/to/schema.json";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
const options = { foo: "bar" };
|
||||
|
||||
validate(schema, options, {
|
||||
name: "MyPlugin",
|
||||
postFormatter: (formattedError, error) => {
|
||||
if (error.keyword === "type") {
|
||||
return `${formattedError}\nAdditional Information.`;
|
||||
}
|
||||
|
||||
return formattedError;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```shell
|
||||
Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema.
|
||||
- options.optionName should be a integer.
|
||||
Additional Information.
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**schema.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"test": {
|
||||
"anyOf": [
|
||||
{ "type": "array" },
|
||||
{ "type": "string" },
|
||||
{ "instanceof": "RegExp" }
|
||||
]
|
||||
},
|
||||
"transform": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"sourceMap": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
```
|
||||
|
||||
### `Loader`
|
||||
|
||||
```js
|
||||
import { getOptions } from "loader-utils";
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
import schema from "path/to/schema.json";
|
||||
|
||||
function loader(src, map) {
|
||||
const options = getOptions(this);
|
||||
|
||||
validate(schema, options, {
|
||||
name: "Loader Name",
|
||||
baseDataPath: "options",
|
||||
});
|
||||
|
||||
// Code...
|
||||
}
|
||||
|
||||
export default loader;
|
||||
```
|
||||
|
||||
### `Plugin`
|
||||
|
||||
```js
|
||||
import { validate } from "schema-utils";
|
||||
|
||||
import schema from "path/to/schema.json";
|
||||
|
||||
class Plugin {
|
||||
constructor(options) {
|
||||
validate(schema, options, {
|
||||
name: "Plugin Name",
|
||||
baseDataPath: "options",
|
||||
});
|
||||
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
// Code...
|
||||
}
|
||||
}
|
||||
|
||||
export default Plugin;
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
||||
|
||||
[CONTRIBUTING](./.github/CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/schema-utils.svg
|
||||
[npm-url]: https://npmjs.com/package/schema-utils
|
||||
[node]: https://img.shields.io/node/v/schema-utils.svg
|
||||
[node-url]: https://nodejs.org
|
||||
[deps]: https://david-dm.org/webpack/schema-utils.svg
|
||||
[deps-url]: https://david-dm.org/webpack/schema-utils
|
||||
[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg
|
||||
[tests-url]: https://github.com/webpack/schema-utils/actions
|
||||
[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg
|
||||
[cover-url]: https://codecov.io/gh/webpack/schema-utils
|
||||
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
||||
[chat-url]: https://gitter.im/webpack/webpack
|
||||
[size]: https://packagephobia.com/badge?p=schema-utils
|
||||
[size-url]: https://packagephobia.com/result?p=schema-utils
|
||||
74
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/ValidationError.d.ts
generated
vendored
Normal file
74
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/ValidationError.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
export default ValidationError;
|
||||
export type JSONSchema6 = import("json-schema").JSONSchema6;
|
||||
export type JSONSchema7 = import("json-schema").JSONSchema7;
|
||||
export type Schema = import("./validate").Schema;
|
||||
export type ValidationErrorConfiguration =
|
||||
import("./validate").ValidationErrorConfiguration;
|
||||
export type PostFormatter = import("./validate").PostFormatter;
|
||||
export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject;
|
||||
declare class ValidationError extends Error {
|
||||
/**
|
||||
* @param {Array<SchemaUtilErrorObject>} errors
|
||||
* @param {Schema} schema
|
||||
* @param {ValidationErrorConfiguration} configuration
|
||||
*/
|
||||
constructor(
|
||||
errors: Array<SchemaUtilErrorObject>,
|
||||
schema: Schema,
|
||||
configuration?: ValidationErrorConfiguration
|
||||
);
|
||||
/** @type {Array<SchemaUtilErrorObject>} */
|
||||
errors: Array<SchemaUtilErrorObject>;
|
||||
/** @type {Schema} */
|
||||
schema: Schema;
|
||||
/** @type {string} */
|
||||
headerName: string;
|
||||
/** @type {string} */
|
||||
baseDataPath: string;
|
||||
/** @type {PostFormatter | null} */
|
||||
postFormatter: PostFormatter | null;
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {Schema}
|
||||
*/
|
||||
getSchemaPart(path: string): Schema;
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {boolean} logic
|
||||
* @param {Array<Object>} prevSchemas
|
||||
* @returns {string}
|
||||
*/
|
||||
formatSchema(
|
||||
schema: Schema,
|
||||
logic?: boolean,
|
||||
prevSchemas?: Array<Object>
|
||||
): string;
|
||||
/**
|
||||
* @param {Schema=} schemaPart
|
||||
* @param {(boolean | Array<string>)=} additionalPath
|
||||
* @param {boolean=} needDot
|
||||
* @param {boolean=} logic
|
||||
* @returns {string}
|
||||
*/
|
||||
getSchemaPartText(
|
||||
schemaPart?: Schema | undefined,
|
||||
additionalPath?: (boolean | Array<string>) | undefined,
|
||||
needDot?: boolean | undefined,
|
||||
logic?: boolean | undefined
|
||||
): string;
|
||||
/**
|
||||
* @param {Schema=} schemaPart
|
||||
* @returns {string}
|
||||
*/
|
||||
getSchemaPartDescription(schemaPart?: Schema | undefined): string;
|
||||
/**
|
||||
* @param {SchemaUtilErrorObject} error
|
||||
* @returns {string}
|
||||
*/
|
||||
formatValidationError(error: SchemaUtilErrorObject): string;
|
||||
/**
|
||||
* @param {Array<SchemaUtilErrorObject>} errors
|
||||
* @returns {string}
|
||||
*/
|
||||
formatValidationErrors(errors: Array<SchemaUtilErrorObject>): string;
|
||||
}
|
||||
12
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/index.d.ts
generated
vendored
Normal file
12
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { validate } from "./validate";
|
||||
import { ValidationError } from "./validate";
|
||||
import { enableValidation } from "./validate";
|
||||
import { disableValidation } from "./validate";
|
||||
import { needValidate } from "./validate";
|
||||
export {
|
||||
validate,
|
||||
ValidationError,
|
||||
enableValidation,
|
||||
disableValidation,
|
||||
needValidate,
|
||||
};
|
||||
10
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts
generated
vendored
Normal file
10
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export default addAbsolutePathKeyword;
|
||||
export type Ajv = import("ajv").Ajv;
|
||||
export type ValidateFunction = import("ajv").ValidateFunction;
|
||||
export type SchemaUtilErrorObject = import("../validate").SchemaUtilErrorObject;
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @returns {Ajv}
|
||||
*/
|
||||
declare function addAbsolutePathKeyword(ajv: Ajv): Ajv;
|
||||
8
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts
generated
vendored
Normal file
8
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/keywords/undefinedAsNull.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export default addUndefinedAsNullKeyword;
|
||||
export type Ajv = import("ajv").Ajv;
|
||||
/**
|
||||
*
|
||||
* @param {Ajv} ajv
|
||||
* @returns {Ajv}
|
||||
*/
|
||||
declare function addUndefinedAsNullKeyword(ajv: Ajv): Ajv;
|
||||
79
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/util/Range.d.ts
generated
vendored
Normal file
79
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/util/Range.d.ts
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
export = Range;
|
||||
/**
|
||||
* @typedef {[number, boolean]} RangeValue
|
||||
*/
|
||||
/**
|
||||
* @callback RangeValueCallback
|
||||
* @param {RangeValue} rangeValue
|
||||
* @returns {boolean}
|
||||
*/
|
||||
declare class Range {
|
||||
/**
|
||||
* @param {"left" | "right"} side
|
||||
* @param {boolean} exclusive
|
||||
* @returns {">" | ">=" | "<" | "<="}
|
||||
*/
|
||||
static getOperator(
|
||||
side: "left" | "right",
|
||||
exclusive: boolean
|
||||
): ">" | ">=" | "<" | "<=";
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @param {boolean} exclusive is range exclusive
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatRight(value: number, logic: boolean, exclusive: boolean): string;
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @param {boolean} exclusive is range exclusive
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatLeft(value: number, logic: boolean, exclusive: boolean): string;
|
||||
/**
|
||||
* @param {number} start left side value
|
||||
* @param {number} end right side value
|
||||
* @param {boolean} startExclusive is range exclusive from left side
|
||||
* @param {boolean} endExclusive is range exclusive from right side
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatRange(
|
||||
start: number,
|
||||
end: number,
|
||||
startExclusive: boolean,
|
||||
endExclusive: boolean,
|
||||
logic: boolean
|
||||
): string;
|
||||
/**
|
||||
* @param {Array<RangeValue>} values
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @return {RangeValue} computed value and it's exclusive flag
|
||||
*/
|
||||
static getRangeValue(values: Array<RangeValue>, logic: boolean): RangeValue;
|
||||
/** @type {Array<RangeValue>} */
|
||||
_left: Array<RangeValue>;
|
||||
/** @type {Array<RangeValue>} */
|
||||
_right: Array<RangeValue>;
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} exclusive
|
||||
*/
|
||||
left(value: number, exclusive?: boolean | undefined): void;
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {boolean=} exclusive
|
||||
*/
|
||||
right(value: number, exclusive?: boolean | undefined): void;
|
||||
/**
|
||||
* @param {boolean} logic is not logic applied
|
||||
* @return {string} "smart" range string representation
|
||||
*/
|
||||
format(logic?: boolean): string;
|
||||
}
|
||||
declare namespace Range {
|
||||
export { RangeValue, RangeValueCallback };
|
||||
}
|
||||
type RangeValue = [number, boolean];
|
||||
type RangeValueCallback = (rangeValue: RangeValue) => boolean;
|
||||
3
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/util/hints.d.ts
generated
vendored
Normal file
3
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/util/hints.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export function stringHints(schema: Schema, logic: boolean): string[];
|
||||
export function numberHints(schema: Schema, logic: boolean): string[];
|
||||
export type Schema = import("../validate").Schema;
|
||||
42
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/validate.d.ts
generated
vendored
Normal file
42
backend/frontend/node_modules/file-loader/node_modules/schema-utils/declarations/validate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
export type JSONSchema4 = import("json-schema").JSONSchema4;
|
||||
export type JSONSchema6 = import("json-schema").JSONSchema6;
|
||||
export type JSONSchema7 = import("json-schema").JSONSchema7;
|
||||
export type ErrorObject = import("ajv").ErrorObject;
|
||||
export type ValidateFunction = import("ajv").ValidateFunction;
|
||||
export type Extend = {
|
||||
formatMinimum?: number | undefined;
|
||||
formatMaximum?: number | undefined;
|
||||
formatExclusiveMinimum?: boolean | undefined;
|
||||
formatExclusiveMaximum?: boolean | undefined;
|
||||
link?: string | undefined;
|
||||
undefinedAsNull?: boolean | undefined;
|
||||
};
|
||||
export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend;
|
||||
export type SchemaUtilErrorObject = ErrorObject & {
|
||||
children?: Array<ErrorObject>;
|
||||
};
|
||||
export type PostFormatter = (
|
||||
formattedError: string,
|
||||
error: SchemaUtilErrorObject
|
||||
) => string;
|
||||
export type ValidationErrorConfiguration = {
|
||||
name?: string | undefined;
|
||||
baseDataPath?: string | undefined;
|
||||
postFormatter?: PostFormatter | undefined;
|
||||
};
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {Array<object> | object} options
|
||||
* @param {ValidationErrorConfiguration=} configuration
|
||||
* @returns {void}
|
||||
*/
|
||||
export function validate(
|
||||
schema: Schema,
|
||||
options: Array<object> | object,
|
||||
configuration?: ValidationErrorConfiguration | undefined
|
||||
): void;
|
||||
export function enableValidation(): void;
|
||||
export function disableValidation(): void;
|
||||
export function needValidate(): boolean;
|
||||
import ValidationError from "./ValidationError";
|
||||
export { ValidationError };
|
||||
78
backend/frontend/node_modules/file-loader/node_modules/schema-utils/package.json
generated
vendored
Normal file
78
backend/frontend/node_modules/file-loader/node_modules/schema-utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "schema-utils",
|
||||
"version": "3.3.0",
|
||||
"description": "webpack Validation Utils",
|
||||
"license": "MIT",
|
||||
"repository": "webpack/schema-utils",
|
||||
"author": "webpack Contrib (https://github.com/webpack-contrib)",
|
||||
"homepage": "https://github.com/webpack/schema-utils",
|
||||
"bugs": "https://github.com/webpack/schema-utils/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "declarations/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run build -- -w",
|
||||
"clean": "del-cli dist declarations",
|
||||
"prebuild": "npm run clean",
|
||||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write",
|
||||
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
||||
"build": "npm-run-all -p \"build:**\"",
|
||||
"commitlint": "commitlint --from=master",
|
||||
"security": "npm audit --production",
|
||||
"fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
|
||||
"lint:js": "eslint --cache .",
|
||||
"lint:types": "tsc --pretty --noEmit",
|
||||
"lint": "npm-run-all lint:js lint:types fmt:check",
|
||||
"fmt": "npm run fmt:check -- --write",
|
||||
"fix:js": "npm run lint:js -- --fix",
|
||||
"fix": "npm-run-all fix:js fmt",
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch",
|
||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:coverage",
|
||||
"prepare": "npm run build && husky install",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"declarations"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.8",
|
||||
"ajv": "^6.12.5",
|
||||
"ajv-keywords": "^3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/preset-env": "^7.14.7",
|
||||
"@commitlint/cli": "^12.1.4",
|
||||
"@commitlint/config-conventional": "^12.1.4",
|
||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
||||
"babel-jest": "^27.0.6",
|
||||
"cross-env": "^7.0.3",
|
||||
"del": "^6.0.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"eslint": "^7.31.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"husky": "^6.0.0",
|
||||
"jest": "^27.0.6",
|
||||
"lint-staged": "^11.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.3.2",
|
||||
"standard-version": "^9.3.1",
|
||||
"typescript": "^4.3.5",
|
||||
"webpack": "^5.45.1"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack"
|
||||
]
|
||||
}
|
||||
75
backend/frontend/node_modules/file-loader/package.json
generated
vendored
Normal file
75
backend/frontend/node_modules/file-loader/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "file-loader",
|
||||
"version": "6.2.0",
|
||||
"description": "A file loader module for webpack",
|
||||
"license": "MIT",
|
||||
"repository": "webpack-contrib/file-loader",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"homepage": "https://github.com/webpack-contrib/file-loader",
|
||||
"bugs": "https://github.com/webpack-contrib/file-loader/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"main": "dist/cjs.js",
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run build -- -w",
|
||||
"clean": "del-cli dist",
|
||||
"prebuild": "npm run clean",
|
||||
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
||||
"commitlint": "commitlint --from=master",
|
||||
"security": "npm audit",
|
||||
"lint:prettier": "prettier --list-different .",
|
||||
"lint:js": "eslint --cache .",
|
||||
"lint": "npm-run-all -l -p \"lint:**\"",
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch",
|
||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:coverage",
|
||||
"prepare": "npm run build",
|
||||
"release": "standard-version",
|
||||
"defaults": "webpack-defaults"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"webpack": "^4.0.0 || ^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"loader-utils": "^2.0.0",
|
||||
"schema-utils": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.11.6",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@commitlint/cli": "^11.0.0",
|
||||
"@commitlint/config-conventional": "^11.0.0",
|
||||
"@webpack-contrib/defaults": "^6.3.0",
|
||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
||||
"babel-jest": "^26.5.2",
|
||||
"cross-env": "^7.0.2",
|
||||
"del": "^6.0.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"eslint": "^7.10.0",
|
||||
"eslint-config-prettier": "^6.12.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"husky": "^4.3.0",
|
||||
"jest": "^26.5.2",
|
||||
"lint-staged": "^10.4.0",
|
||||
"memfs": "^3.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.2",
|
||||
"standard-version": "^9.0.0",
|
||||
"url-loader": "^4.1.0",
|
||||
"webpack": "^4.44.2"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user