mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-24 22:39:26 +01:00
Merge pull request #151 from henrywhitaker3/docker-speedtest-error
Updated to v1.7.4
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Speedtest Tracker
|
||||
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||
|
||||
This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses [Ookla's Speedtest cli](https://www.speedtest.net/apps/cli) to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Speedtest Tracker
|
||||
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||
|
||||
This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses the [Ookla's speedtest cli](https://www.speedtest.net/apps/cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Setting;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SettingsHelper {
|
||||
|
||||
@@ -38,6 +39,9 @@ class SettingsHelper {
|
||||
$setting = SettingsHelper::get($name);
|
||||
|
||||
if($setting !== false) {
|
||||
if($value == false) {
|
||||
$value = "0";
|
||||
}
|
||||
$setting->value = $value;
|
||||
$setting->save();
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Helpers;
|
||||
use App\Speedtest;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use JsonException;
|
||||
@@ -63,6 +64,8 @@ class SpeedtestHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
Cache::flush();
|
||||
|
||||
return $test;
|
||||
}
|
||||
|
||||
@@ -207,4 +210,47 @@ class SpeedtestHelper {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a percentage rate of failure by days
|
||||
*
|
||||
* @param integer $days number of days to get rate for
|
||||
* @return integer percentage fail rate
|
||||
*/
|
||||
public static function failureRate(int $days)
|
||||
{
|
||||
$ttl = Carbon::now()->addDays(1);
|
||||
$rate = Cache::remember('failure-rate-' . $days, $ttl, function () use ($days) {
|
||||
$range = [
|
||||
Carbon::today()
|
||||
];
|
||||
for($i = 0; $i < $days; $i++) {
|
||||
$prev = end($range);
|
||||
$new = $prev->copy()->subDays(1);
|
||||
array_push($range, $new);
|
||||
}
|
||||
|
||||
$rate = [];
|
||||
|
||||
foreach($range as $day) {
|
||||
$success = Speedtest::select(DB::raw('COUNT(id) as rate'))->whereDate('created_at', $day)->where('failed', false)->get()[0]['rate'];
|
||||
$fail = Speedtest::select(DB::raw('COUNT(id) as rate'))->whereDate('created_at', $day)->where('failed', true)->get()[0]['rate'];
|
||||
|
||||
if(( $success + $fail ) == 0) {
|
||||
$percentage = 0;
|
||||
} else {
|
||||
$percentage = round(( $fail / ( $success + $fail ) * 100 ), 1);
|
||||
}
|
||||
|
||||
array_push($rate, [
|
||||
'date' => $day->toDateString(),
|
||||
'rate' => $percentage
|
||||
]);
|
||||
}
|
||||
|
||||
return array_reverse($rate);
|
||||
});
|
||||
|
||||
return $rate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,13 @@ class SettingsController extends Controller
|
||||
|
||||
|
||||
$config = [
|
||||
'base' => SettingsHelper::getBase()
|
||||
'base' => SettingsHelper::getBase(),
|
||||
'download_upload_graph_enabled' => SettingsHelper::get('download_upload_graph_enabled'),
|
||||
'download_upload_graph_width' => SettingsHelper::get('download_upload_graph_width'),
|
||||
'ping_graph_enabled' => SettingsHelper::get('ping_graph_enabled'),
|
||||
'ping_graph_width' => SettingsHelper::get('ping_graph_width'),
|
||||
'failure_graph_enabled' => SettingsHelper::get('failure_graph_enabled'),
|
||||
'failure_graph_width' => SettingsHelper::get('failure_graph_width'),
|
||||
];
|
||||
|
||||
return $config;
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Speedtest;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
@@ -51,9 +52,43 @@ class SpeedtestController extends Controller
|
||||
], 422);
|
||||
}
|
||||
|
||||
$data = Speedtest::where('created_at', '>=', Carbon::now()->subDays($days))
|
||||
->orderBy('created_at', 'asc')
|
||||
->get();
|
||||
$ttl = Carbon::now()->addDays(1);
|
||||
$data = Cache::remember('speedtest-days-' . $days, $ttl, function () use ($days) {
|
||||
return Speedtest::where('created_at', '>=', Carbon::now()->subDays($days))
|
||||
->where('failed', false)
|
||||
->orderBy('created_at', 'asc')
|
||||
->get();
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'method' => 'get speedtests in last x days',
|
||||
'days' => $days,
|
||||
'data' => $data
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns speedtest failure rate going back 'x' days
|
||||
*
|
||||
* @param int $days
|
||||
* @return void
|
||||
*/
|
||||
public function fail($days)
|
||||
{
|
||||
$rule = [
|
||||
'days' => [ 'required', 'integer' ],
|
||||
];
|
||||
|
||||
$validator = Validator::make([ 'days' => $days ], $rule);
|
||||
|
||||
if($validator->fails()) {
|
||||
return response()->json([
|
||||
'method' => 'get speedtests in last x days',
|
||||
'error' => $validator->errors(),
|
||||
], 422);
|
||||
}
|
||||
|
||||
$data = SpeedtestHelper::failureRate($days);
|
||||
|
||||
return response()->json([
|
||||
'method' => 'get speedtests in last x days',
|
||||
|
||||
@@ -39,7 +39,7 @@ class Kernel extends HttpKernel
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:100,1',
|
||||
'throttle:200,1',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
{
|
||||
"1.7.4": [
|
||||
{
|
||||
"description": "Stopped failed tests appearing in graphs",
|
||||
"link": ""
|
||||
},
|
||||
{
|
||||
"description": "Added failure rate graph",
|
||||
"link": ""
|
||||
},
|
||||
{
|
||||
"description": "Updated dependencies",
|
||||
"link": ""
|
||||
}
|
||||
],
|
||||
"1.7.3": [
|
||||
{
|
||||
"description": "Updated dependencies",
|
||||
|
||||
@@ -7,7 +7,7 @@ return [
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'version' => '1.7.3',
|
||||
'version' => '1.7.4',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use App\Setting;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddGraphSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Setting::create([
|
||||
'name' => 'download_upload_graph_enabled',
|
||||
'value' => true,
|
||||
'description' => 'Enable the download/upload graph'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'name' => 'download_upload_graph_width',
|
||||
'value' => 6,
|
||||
'description' => 'Set the width of the download/upload graph'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'name' => 'ping_graph_enabled',
|
||||
'value' => true,
|
||||
'description' => 'Enable the ping graph'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'name' => 'ping_graph_width',
|
||||
'value' => 6,
|
||||
'description' => 'Set the width of the ping graph'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'name' => 'failure_graph_enabled',
|
||||
'value' => true,
|
||||
'description' => 'Enable the failure rate graph'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'name' => 'failure_graph_width',
|
||||
'value' => 6,
|
||||
'description' => 'Set the width of the failure rate graph'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Setting::whereIn('name', [
|
||||
'download_upload_graph_enabled',
|
||||
'download_upload_graph_width',
|
||||
'ping_graph_enabled',
|
||||
'ping_graph_width',
|
||||
'failure_graph_enabled',
|
||||
'failure_graph_width'
|
||||
])->delete();
|
||||
}
|
||||
}
|
||||
BIN
conf/site/node_modules/.cache/babel-loader/2d495fde4b1d19cc9cae642c5a62b81a.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/2d495fde4b1d19cc9cae642c5a62b81a.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/699b10a5a407cfc05a14463104938254.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/699b10a5a407cfc05a14463104938254.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/76ee66ffd4c880a25b9545a5da8d594f.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/76ee66ffd4c880a25b9545a5da8d594f.json.gz
generated
vendored
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/cf/9b/8d1f4ae70eac6b710301059843b66914d673584410f2567f3448e3280727
generated
vendored
Normal file
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/cf/9b/8d1f4ae70eac6b710301059843b66914d673584410f2567f3448e3280727
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
45b283404ee80f8fb34c3b922933c1bd2b313115 {"key":"{\"terser\":\"4.6.10\",\"terser-webpack-plugin\":\"2.3.5\",\"terser-webpack-plugin-options\":{\"test\":new RegExp(\"\\\\.m?js(\\\\?.*)?$\", \"i\"),\"chunkFilter\":() => true,\"warningsFilter\":() => true,\"extractComments\":true,\"sourceMap\":true,\"cache\":true,\"cacheKeys\":defaultCacheKeys => defaultCacheKeys,\"parallel\":true,\"include\":undefined,\"exclude\":undefined,\"minify\":undefined,\"terserOptions\":{\"compress\":{\"warnings\":false},\"output\":{\"comments\":false}}},\"nodeVersion\":\"v10.19.0\",\"filename\":\"\\u002Fjs\\u002Fapp.js\",\"contentHash\":\"7fcab13d767c0ae02dc5\"}","integrity":"sha512-CjfTV0DxbAbh0NfxVY6mpjDbS8NzihPmrjlnD/+f8DhuqD252x7uxWUEgsKy9pZ5QtC1KI4u3R90mgvUBwtdtw==","time":1594060811125,"size":2539978}
|
||||
21
conf/site/node_modules/clone-deep/LICENSE
generated
vendored
21
conf/site/node_modules/clone-deep/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
106
conf/site/node_modules/clone-deep/README.md
generated
vendored
106
conf/site/node_modules/clone-deep/README.md
generated
vendored
@@ -1,106 +0,0 @@
|
||||
# clone-deep [](https://www.npmjs.com/package/clone-deep) [](https://npmjs.org/package/clone-deep) [](https://npmjs.org/package/clone-deep) [](https://travis-ci.org/jonschlinkert/clone-deep)
|
||||
|
||||
> Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save clone-deep
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const cloneDeep = require('clone-deep');
|
||||
|
||||
let obj = { a: 'b' };
|
||||
let arr = [obj];
|
||||
let copy = cloneDeep(arr);
|
||||
obj.c = 'd';
|
||||
|
||||
console.log(copy);
|
||||
//=> [{ a: 'b' }]
|
||||
|
||||
console.log(arr);
|
||||
//=> [{ a: 'b', c: 'd' }]
|
||||
```
|
||||
|
||||
## Heads up!
|
||||
|
||||
The last argument specifies whether or not to clone instances (objects that are from a custom class or are not created by the `Object` constructor. This value may be `true` or the function use for cloning instances.
|
||||
|
||||
When an `instanceClone` function is provided, it will be invoked to clone objects that are not "plain" objects (as defined by [isPlainObject](#isPlainObject)`isPlainObject`). If `instanceClone` is not specified, this library will not attempt to clone non-plain objects, and will simply copy the object reference.
|
||||
|
||||
## Attribution
|
||||
|
||||
Initially based on [mout's](https://github.com/mout/mout) implementation of deepClone.
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
|
||||
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
|
||||
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
|
||||
* [shallow-clone](https://www.npmjs.com/package/shallow-clone): Creates a shallow clone of any JavaScript value. | [homepage](https://github.com/jonschlinkert/shallow-clone "Creates a shallow clone of any JavaScript value.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 46 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 2 | [yujunlong2000](https://github.com/yujunlong2000) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on November 21, 2018._
|
||||
49
conf/site/node_modules/clone-deep/index.js
generated
vendored
49
conf/site/node_modules/clone-deep/index.js
generated
vendored
@@ -1,49 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependenices
|
||||
*/
|
||||
|
||||
const clone = require('shallow-clone');
|
||||
const typeOf = require('kind-of');
|
||||
const isPlainObject = require('is-plain-object');
|
||||
|
||||
function cloneDeep(val, instanceClone) {
|
||||
switch (typeOf(val)) {
|
||||
case 'object':
|
||||
return cloneObjectDeep(val, instanceClone);
|
||||
case 'array':
|
||||
return cloneArrayDeep(val, instanceClone);
|
||||
default: {
|
||||
return clone(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cloneObjectDeep(val, instanceClone) {
|
||||
if (typeof instanceClone === 'function') {
|
||||
return instanceClone(val);
|
||||
}
|
||||
if (instanceClone || isPlainObject(val)) {
|
||||
const res = new val.constructor();
|
||||
for (let key in val) {
|
||||
res[key] = cloneDeep(val[key], instanceClone);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
function cloneArrayDeep(val, instanceClone) {
|
||||
const res = new val.constructor(val.length);
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
res[i] = cloneDeep(val[i], instanceClone);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `cloneDeep`
|
||||
*/
|
||||
|
||||
module.exports = cloneDeep;
|
||||
116
conf/site/node_modules/clone-deep/package.json
generated
vendored
116
conf/site/node_modules/clone-deep/package.json
generated
vendored
@@ -1,116 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"clone-deep@4.0.1",
|
||||
"/home/henry/Documents/git/Speedtest-tracker-docker/conf/site"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "clone-deep@4.0.1",
|
||||
"_id": "clone-deep@4.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
|
||||
"_location": "/clone-deep",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "clone-deep@4.0.1",
|
||||
"name": "clone-deep",
|
||||
"escapedName": "clone-deep",
|
||||
"rawSpec": "4.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sass-loader"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
|
||||
"_spec": "4.0.1",
|
||||
"_where": "/home/henry/Documents/git/Speedtest-tracker-docker/conf/site",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/clone-deep/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-plain-object": "^2.0.4",
|
||||
"kind-of": "^6.0.2",
|
||||
"shallow-clone": "^3.0.0"
|
||||
},
|
||||
"description": "Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^5.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/clone-deep",
|
||||
"keywords": [
|
||||
"array",
|
||||
"assign",
|
||||
"buffer",
|
||||
"clamped",
|
||||
"clone",
|
||||
"clone-array",
|
||||
"clone-array-deep",
|
||||
"clone-buffer",
|
||||
"clone-date",
|
||||
"clone-deep",
|
||||
"clone-map",
|
||||
"clone-object",
|
||||
"clone-object-deep",
|
||||
"clone-reg-exp",
|
||||
"clone-regex",
|
||||
"clone-regexp",
|
||||
"clone-set",
|
||||
"date",
|
||||
"deep",
|
||||
"extend",
|
||||
"mixin",
|
||||
"mixin-object",
|
||||
"object",
|
||||
"regex",
|
||||
"regexp",
|
||||
"shallow",
|
||||
"symbol"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "clone-deep",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/clone-deep.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"is-plain-object",
|
||||
"isobject",
|
||||
"kind-of",
|
||||
"shallow-clone"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "4.0.1"
|
||||
}
|
||||
71
conf/site/node_modules/klona/dist/index.js
generated
vendored
Normal file
71
conf/site/node_modules/klona/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
module.exports = function klona(x) {
|
||||
if (typeof x !== 'object') return x;
|
||||
|
||||
var k, tmp, str=Object.prototype.toString.call(x);
|
||||
|
||||
if (str === '[object Object]') {
|
||||
if (x.constructor !== Object && typeof x.constructor === 'function') {
|
||||
tmp = new x.constructor();
|
||||
for (k in x) {
|
||||
if (tmp.hasOwnProperty(k) && tmp[k] !== x[k]) {
|
||||
tmp[k] = klona(x[k]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tmp = {}; // null
|
||||
for (k in x) {
|
||||
if (k === '__proto__') {
|
||||
Object.defineProperty(tmp, k, {
|
||||
value: klona(x[k]),
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
} else {
|
||||
tmp[k] = klona(x[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Array]') {
|
||||
k = x.length;
|
||||
for (tmp=Array(k); k--;) {
|
||||
tmp[k] = klona(x[k]);
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Set]') {
|
||||
tmp = new Set;
|
||||
x.forEach(function (val) {
|
||||
tmp.add(klona(val));
|
||||
});
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Map]') {
|
||||
tmp = new Map;
|
||||
x.forEach(function (val, key) {
|
||||
tmp.set(klona(key), klona(val));
|
||||
});
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Date]') {
|
||||
return new Date(+x);
|
||||
}
|
||||
|
||||
if (str === '[object RegExp]') {
|
||||
tmp = new RegExp(x.source, x.flags);
|
||||
tmp.lastIndex = x.lastIndex;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str.slice(-6) === 'Array]') {
|
||||
return new x.constructor(x);
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
1
conf/site/node_modules/klona/dist/index.min.js
generated
vendored
Normal file
1
conf/site/node_modules/klona/dist/index.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.klona=t()}(this,(function(){return function e(t){if("object"!=typeof t)return t;var o,n,r=Object.prototype.toString.call(t);if("[object Object]"===r){if(t.constructor!==Object&&"function"==typeof t.constructor)for(o in n=new t.constructor,t)n.hasOwnProperty(o)&&n[o]!==t[o]&&(n[o]=e(t[o]));else for(o in n={},t)"__proto__"===o?Object.defineProperty(n,o,{value:e(t[o]),configurable:!0,enumerable:!0,writable:!0}):n[o]=e(t[o]);return n}if("[object Array]"===r){for(o=t.length,n=Array(o);o--;)n[o]=e(t[o]);return n}return"[object Set]"===r?(n=new Set,t.forEach((function(t){n.add(e(t))})),n):"[object Map]"===r?(n=new Map,t.forEach((function(t,o){n.set(e(o),e(t))})),n):"[object Date]"===r?new Date(+t):"[object RegExp]"===r?((n=new RegExp(t.source,t.flags)).lastIndex=t.lastIndex,n):"Array]"===r.slice(-6)?new t.constructor(t):t}}));
|
||||
71
conf/site/node_modules/klona/dist/index.mjs
generated
vendored
Normal file
71
conf/site/node_modules/klona/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
export default function klona(x) {
|
||||
if (typeof x !== 'object') return x;
|
||||
|
||||
var k, tmp, str=Object.prototype.toString.call(x);
|
||||
|
||||
if (str === '[object Object]') {
|
||||
if (x.constructor !== Object && typeof x.constructor === 'function') {
|
||||
tmp = new x.constructor();
|
||||
for (k in x) {
|
||||
if (tmp.hasOwnProperty(k) && tmp[k] !== x[k]) {
|
||||
tmp[k] = klona(x[k]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tmp = {}; // null
|
||||
for (k in x) {
|
||||
if (k === '__proto__') {
|
||||
Object.defineProperty(tmp, k, {
|
||||
value: klona(x[k]),
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
});
|
||||
} else {
|
||||
tmp[k] = klona(x[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Array]') {
|
||||
k = x.length;
|
||||
for (tmp=Array(k); k--;) {
|
||||
tmp[k] = klona(x[k]);
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Set]') {
|
||||
tmp = new Set;
|
||||
x.forEach(function (val) {
|
||||
tmp.add(klona(val));
|
||||
});
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Map]') {
|
||||
tmp = new Map;
|
||||
x.forEach(function (val, key) {
|
||||
tmp.set(klona(key), klona(val));
|
||||
});
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str === '[object Date]') {
|
||||
return new Date(+x);
|
||||
}
|
||||
|
||||
if (str === '[object RegExp]') {
|
||||
tmp = new RegExp(x.source, x.flags);
|
||||
tmp.lastIndex = x.lastIndex;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (str.slice(-6) === 'Array]') {
|
||||
return new x.constructor(x);
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
4
conf/site/node_modules/klona/index.d.ts
generated
vendored
Normal file
4
conf/site/node_modules/klona/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare module 'klona' {
|
||||
function klona<T>(val: T): T;
|
||||
export = klona;
|
||||
}
|
||||
9
conf/site/node_modules/klona/license
generated
vendored
Normal file
9
conf/site/node_modules/klona/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
||||
|
||||
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.
|
||||
77
conf/site/node_modules/klona/package.json
generated
vendored
Normal file
77
conf/site/node_modules/klona/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"klona@1.1.2",
|
||||
"/home/henry/Documents/git/Speedtest-tracker-docker/conf/site"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "klona@1.1.2",
|
||||
"_id": "klona@1.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-xf88rTeHiXk+XE2Vhi6yj8Wm3gMZrygGdKjJqN8HkV+PwF/t50/LdAKHoHpPcxFAlmQszTZ1CugrK25S7qDRLA==",
|
||||
"_location": "/klona",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "klona@1.1.2",
|
||||
"name": "klona",
|
||||
"escapedName": "klona",
|
||||
"rawSpec": "1.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sass-loader"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/klona/-/klona-1.1.2.tgz",
|
||||
"_spec": "1.1.2",
|
||||
"_where": "/home/henry/Documents/git/Speedtest-tracker-docker/conf/site",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lukeed/klona/issues"
|
||||
},
|
||||
"description": "A tiny (423B) and fast utility to \"deep clone\" Objects, Arrays, Dates, RegExps, and more!",
|
||||
"devDependencies": {
|
||||
"bundt": "1.0.2",
|
||||
"esm": "3.2.25",
|
||||
"uvu": "0.0.17"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/lukeed/klona#readme",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"deep",
|
||||
"extend",
|
||||
"recursive",
|
||||
"object"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"name": "klona",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lukeed/klona.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "bundt",
|
||||
"pretest": "npm run build",
|
||||
"test": "uvu -r esm test"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"unpkg": "dist/index.min.js",
|
||||
"version": "1.1.2"
|
||||
}
|
||||
139
conf/site/node_modules/klona/readme.md
generated
vendored
Normal file
139
conf/site/node_modules/klona/readme.md
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<div align="center">
|
||||
<img src="logo.png" alt="klona" height="100" />
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://npmjs.org/package/klona">
|
||||
<img src="https://badgen.now.sh/npm/v/klona" alt="version" />
|
||||
</a>
|
||||
<a href="https://github.com/lukeed/klona/actions">
|
||||
<img src="https://github.com/lukeed/klona/workflows/CI/badge.svg" alt="CI" />
|
||||
</a>
|
||||
<a href="https://npmjs.org/package/klona">
|
||||
<img src="https://badgen.now.sh/npm/dm/klona" alt="downloads" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/lukeed/klona">
|
||||
<img src="https://codecov.io/gh/lukeed/klona/branch/master/graph/badge.svg?token=8ej0WeKqz7" alt="codecov" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div align="center">A tiny (423B) and fast utility to "deep clone" Objects, Arrays, Dates, RegExps, and more!</div>
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* Super tiny and [performant](#benchmarks)
|
||||
* Deep clone / recursive copies
|
||||
* Safely handles complex data types<br>
|
||||
_Array, Date, Map, Object, RegExp, Set, TypedArray_
|
||||
|
||||
Unlike a "shallow copy" (eg, `Object.assign`), a "deep clone" recursively traverses a source input and copies its _values_ — instead of _references_ to its values — into a new instance of that input. The result is a structurally equivalent clone that operates independently of the original source and controls its own values.
|
||||
|
||||
Additionally, this module is delivered as:
|
||||
|
||||
* **ES Module**: [`dist/index.mjs`](https://unpkg.com/klona/dist/index.mjs)
|
||||
* **CommonJS**: [`dist/index.js`](https://unpkg.com/klona/dist/index.js)
|
||||
* **UMD**: [`dist/klona.min.js`](https://unpkg.com/klona)
|
||||
|
||||
> **Why "klona"?** It's "clone" in Swedish.<br>
|
||||
> **What's with the sheep?** [Dolly](https://en.wikipedia.org/wiki/Dolly_(sheep)).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save klona
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import klona from 'klona';
|
||||
|
||||
const input = {
|
||||
foo: 1,
|
||||
bar: {
|
||||
baz: 2,
|
||||
bat: {
|
||||
hello: 'world'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const output = klona(input);
|
||||
|
||||
// exact copy of original
|
||||
assert.deepStrictEqual(input, output);
|
||||
|
||||
// applying deep updates...
|
||||
output.bar.bat.hola = 'mundo';
|
||||
output.bar.baz = 99;
|
||||
|
||||
// ...doesn't affect source!
|
||||
console.log(
|
||||
JSON.stringify(input, null, 2)
|
||||
);
|
||||
// {
|
||||
// "foo": 1,
|
||||
// "bar": {
|
||||
// "baz": 2,
|
||||
// "bat": {
|
||||
// "hello": "world"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### klona(input)
|
||||
Returns: `typeof input`
|
||||
|
||||
Returns a deep copy/clone of the input.
|
||||
|
||||
|
||||
## Benchmarks
|
||||
|
||||
> via Node.js v10.13.0
|
||||
|
||||
```
|
||||
Load times:
|
||||
fast-clone 0.884ms
|
||||
lodash/clonedeep 27.716ms
|
||||
rfdc 0.782ms
|
||||
clone-deep 4.023ms
|
||||
deep-copy 0.513ms
|
||||
klona 0.333ms
|
||||
|
||||
Validation:
|
||||
✘ JSON.stringify (FAILED @ "initial copy")
|
||||
✘ fast-clone (FAILED @ "initial copy")
|
||||
✔ lodash
|
||||
✘ rfdc (FAILED @ "initial copy")
|
||||
✔ clone-deep
|
||||
✘ deep-copy (FAILED @ "initial copy")
|
||||
✔ klona
|
||||
|
||||
Benchmark:
|
||||
JSON.stringify x 36,628 ops/sec ±1.34% (89 runs sampled)
|
||||
fast-clone x 23,518 ops/sec ±1.18% (91 runs sampled)
|
||||
lodash x 33,810 ops/sec ±1.34% (94 runs sampled)
|
||||
rfdc x 181,634 ops/sec ±0.71% (95 runs sampled)
|
||||
clone-deep x 84,558 ops/sec ±0.19% (96 runs sampled)
|
||||
deep-copy x 112,866 ops/sec ±1.26% (94 runs sampled)
|
||||
klona x 220,356 ops/sec ±0.34% (97 runs sampled)
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
* [dlv](https://github.com/developit/dlv) – safely **read** from deep properties in 120 bytes
|
||||
* [dset](https://github.com/lukeed/dset) – safely **write** into deep properties in 160 bytes
|
||||
* [dequal](https://github.com/lukeed/dequal) – safely check for deep equality in 247 bytes
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
||||
7
conf/site/node_modules/sass-loader/CHANGELOG.md
generated
vendored
7
conf/site/node_modules/sass-loader/CHANGELOG.md
generated
vendored
@@ -2,6 +2,13 @@
|
||||
|
||||
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.
|
||||
|
||||
### [9.0.1](https://github.com/webpack-contrib/sass-loader/compare/v9.0.0...v9.0.1) (2020-07-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not crash on errors ([#860](https://github.com/webpack-contrib/sass-loader/issues/860)) ([e854933](https://github.com/webpack-contrib/sass-loader/commit/e8549330f8d9373ff8baccffbfd3e0c3b6f3ef61))
|
||||
|
||||
## [9.0.0](https://github.com/webpack-contrib/sass-loader/compare/v8.0.2...v9.0.0) (2020-07-02)
|
||||
|
||||
|
||||
|
||||
8
conf/site/node_modules/sass-loader/dist/index.js
generated
vendored
8
conf/site/node_modules/sass-loader/dist/index.js
generated
vendored
@@ -46,8 +46,12 @@ function loader(content) {
|
||||
const render = (0, _utils.getRenderFunctionFromSassImplementation)(implementation);
|
||||
render(sassOptions, (error, result) => {
|
||||
if (error) {
|
||||
// `node-sass` returns POSIX paths
|
||||
this.addDependency(_path.default.normalize(error.file));
|
||||
// There are situations when the `file` property do not exist
|
||||
if (error.file) {
|
||||
// `node-sass` returns POSIX paths
|
||||
this.addDependency(_path.default.normalize(error.file));
|
||||
}
|
||||
|
||||
callback(new _SassError.default(error));
|
||||
return;
|
||||
}
|
||||
|
||||
4
conf/site/node_modules/sass-loader/dist/utils.js
generated
vendored
4
conf/site/node_modules/sass-loader/dist/utils.js
generated
vendored
@@ -15,7 +15,7 @@ var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _semver = _interopRequireDefault(require("semver"));
|
||||
|
||||
var _cloneDeep = _interopRequireDefault(require("clone-deep"));
|
||||
var _klona = _interopRequireDefault(require("klona"));
|
||||
|
||||
var _loaderUtils = require("loader-utils");
|
||||
|
||||
@@ -107,7 +107,7 @@ function proxyCustomImporters(importers, loaderContext) {
|
||||
|
||||
|
||||
function getSassOptions(loaderContext, loaderOptions, content, implementation) {
|
||||
const options = (0, _cloneDeep.default)(loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === 'function' ? loaderOptions.sassOptions(loaderContext) || {} : loaderOptions.sassOptions : {});
|
||||
const options = (0, _klona.default)(loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === 'function' ? loaderOptions.sassOptions(loaderContext) || {} : loaderOptions.sassOptions : {});
|
||||
const isDartSass = implementation.info.includes('dart-sass');
|
||||
|
||||
if (isDartSass) {
|
||||
|
||||
182
conf/site/node_modules/sass-loader/node_modules/ajv/README.md
generated
vendored
182
conf/site/node_modules/sass-loader/node_modules/ajv/README.md
generated
vendored
@@ -1,21 +1,28 @@
|
||||
<img align="right" alt="Ajv logo" width="160" src="http://epoberezkin.github.io/ajv/images/ajv_logo.png">
|
||||
<img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/images/ajv_logo.png">
|
||||
|
||||
# Ajv: Another JSON Schema Validator
|
||||
|
||||
The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/07.
|
||||
|
||||
[](https://travis-ci.org/epoberezkin/ajv)
|
||||
[](https://travis-ci.org/ajv-validator/ajv)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://www.npmjs.com/package/ajv)
|
||||
[](https://coveralls.io/github/epoberezkin/ajv?branch=master)
|
||||
[](https://coveralls.io/github/ajv-validator/ajv?branch=master)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
[](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
## Please [sponsor Ajv](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
Dear Ajv users! ❤️
|
||||
## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
I ask you to support the development of Ajv with donations. 🙏
|
||||
I will get straight to the point - I need your support to ensure that the development of Ajv continues.
|
||||
|
||||
I have developed Ajv for 5 years in my free time, but it is not sustainable. I'd appreciate if you consider supporting its further development with donations:
|
||||
- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it)
|
||||
- [Ajv Open Collective️](https://opencollective.com/ajv)
|
||||
|
||||
There are many small and large improvements that are long due, including the support of the next versions of JSON Schema specification, improving website and documentation, and making Ajv more modular and maintainable to address its limitations - what Ajv needs to evolve is much more than what I can contribute in my free time.
|
||||
|
||||
I would also really appreciate any advice you could give on how to raise funds for Ajv development - whether some suitable open-source fund I could apply to or some sponsor I should approach.
|
||||
|
||||
Since 2015 Ajv has become widely used, thanks to your help and contributions:
|
||||
|
||||
@@ -25,17 +32,10 @@ Since 2015 Ajv has become widely used, thanks to your help and contributions:
|
||||
- **5,000,000** dependent repositories on GitHub 🚀
|
||||
- **120,000,000** npm downloads per month! 💯
|
||||
|
||||
Your donations will fund futher development - small and large improvements, support of the next versions of JSON Schema specification, and, possibly, the code should be migrated to TypeScript to make it more maintainable.
|
||||
I believe it would benefit all Ajv users to help put together the fund that will be used for its further development - it would allow to bring some additional maintainers to the project.
|
||||
|
||||
I will greatly appreciate anything you can help with to make it happen:
|
||||
Thank you
|
||||
|
||||
- a **personal** donation - from $2 ☕️
|
||||
- your **company** donation - from $10 🍔
|
||||
- a **sponsorship** to get promoted on Ajv or related packages - from $50 💰
|
||||
- an **introduction** to a sponsor who would benefit from the promotion on Ajv page 🤝
|
||||
|
||||
| Please [make donations via my GitHub sponsors page](https://github.com/sponsors/epoberezkin)<br>‼️ **GitHub will DOUBLE them** ‼️ |
|
||||
|---|
|
||||
|
||||
#### Open Collective sponsors
|
||||
|
||||
@@ -57,7 +57,7 @@ I will greatly appreciate anything you can help with to make it happen:
|
||||
|
||||
[JSON Schema draft-07](http://json-schema.org/latest/json-schema-validation.html) is published.
|
||||
|
||||
[Ajv version 6.0.0](https://github.com/epoberezkin/ajv/releases/tag/v6.0.0) that supports draft-07 is released. It may require either migrating your schemas or updating your code (to continue using draft-04 and v5 schemas, draft-06 schemas will be supported without changes).
|
||||
[Ajv version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0) that supports draft-07 is released. It may require either migrating your schemas or updating your code (to continue using draft-04 and v5 schemas, draft-06 schemas will be supported without changes).
|
||||
|
||||
__Please note__: To use Ajv with draft-06 schemas you need to explicitly add the meta-schema to the validator instance:
|
||||
|
||||
@@ -80,8 +80,9 @@ ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
|
||||
- [Performance](#performance)
|
||||
- [Features](#features)
|
||||
- [Getting started](#getting-started)
|
||||
- [Frequently Asked Questions](https://github.com/epoberezkin/ajv/blob/master/FAQ.md)
|
||||
- [Frequently Asked Questions](https://github.com/ajv-validator/ajv/blob/master/FAQ.md)
|
||||
- [Using in browser](#using-in-browser)
|
||||
- [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp)
|
||||
- [Command line interface](#command-line-interface)
|
||||
- Validation
|
||||
- [Keywords](#validation-keywords)
|
||||
@@ -110,7 +111,8 @@ ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
|
||||
- [Plugins](#plugins)
|
||||
- [Related packages](#related-packages)
|
||||
- [Some packages using Ajv](#some-packages-using-ajv)
|
||||
- [Tests, Contributing, History, Support, License](#tests)
|
||||
- [Tests, Contributing, Changes history](#tests)
|
||||
- [Support, Code of conduct, License](#open-source-software-support)
|
||||
|
||||
|
||||
## Performance
|
||||
@@ -133,24 +135,24 @@ Performance of different validators by [json-schema-benchmark](https://github.co
|
||||
## Features
|
||||
|
||||
- Ajv implements full JSON Schema [draft-06/07](http://json-schema.org/) and draft-04 standards:
|
||||
- all validation keywords (see [JSON Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md))
|
||||
- all validation keywords (see [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md))
|
||||
- full support of remote refs (remote schemas have to be added with `addSchema` or compiled to be available)
|
||||
- support of circular references between schemas
|
||||
- correct string lengths for strings with unicode pairs (can be turned off)
|
||||
- [formats](#formats) defined by JSON Schema draft-07 standard and custom formats (can be turned off)
|
||||
- [validates schemas against meta-schema](#api-validateschema)
|
||||
- supports [browsers](#using-in-browser) and Node.js 0.10-8.x
|
||||
- supports [browsers](#using-in-browser) and Node.js 0.10-14.x
|
||||
- [asynchronous loading](#asynchronous-schema-compilation) of referenced schemas during compilation
|
||||
- "All errors" validation mode with [option allErrors](#options)
|
||||
- [error messages with parameters](#validation-errors) describing error reasons to allow creating custom error messages
|
||||
- i18n error messages support with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package
|
||||
- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package
|
||||
- [filtering data](#filtering-data) from additional properties
|
||||
- [assigning defaults](#assigning-defaults) to missing properties and items
|
||||
- [coercing data](#coercing-data-types) to the types specified in `type` keywords
|
||||
- [custom keywords](#defining-custom-keywords)
|
||||
- draft-06/07 keywords `const`, `contains`, `propertyNames` and `if/then/else`
|
||||
- draft-06 boolean schemas (`true`/`false` as a schema to always pass/fail).
|
||||
- keywords `switch`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package
|
||||
- keywords `switch`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package
|
||||
- [$data reference](#data-reference) to use values from the validated data as values for the schema keywords
|
||||
- [asynchronous validation](#asynchronous-validation) of custom formats and keywords
|
||||
|
||||
@@ -234,21 +236,31 @@ Ajv is tested with these browsers:
|
||||
|
||||
[](https://saucelabs.com/u/epoberezkin)
|
||||
|
||||
__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/epoberezkin/ajv/issues/234)).
|
||||
__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/ajv-validator/ajv/issues/234)).
|
||||
|
||||
|
||||
### Ajv and Content Security Policies (CSP)
|
||||
|
||||
If you're using Ajv to compile a schema (the typical use) in a browser document that is loaded with a Content Security Policy (CSP), that policy will require a `script-src` directive that includes the value `'unsafe-eval'`.
|
||||
:warning: NOTE, however, that `unsafe-eval` is NOT recommended in a secure CSP[[1]](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval), as it has the potential to open the document to cross-site scripting (XSS) attacks.
|
||||
|
||||
In order to make use of Ajv without easing your CSP, you can [pre-compile a schema using the CLI](https://github.com/ajv-validator/ajv-cli#compile-schemas). This will transpile the schema JSON into a JavaScript file that exports a `validate` function that works simlarly to a schema compiled at runtime.
|
||||
|
||||
Note that pre-compilation of schemas is performed using [ajv-pack](https://github.com/ajv-validator/ajv-pack) and there are [some limitations to the schema features it can compile](https://github.com/ajv-validator/ajv-pack#limitations). A successfully pre-compiled schema is equivalent to the same schema compiled at runtime.
|
||||
|
||||
|
||||
## Command line interface
|
||||
|
||||
CLI is available as a separate npm package [ajv-cli](https://github.com/jessedc/ajv-cli). It supports:
|
||||
CLI is available as a separate npm package [ajv-cli](https://github.com/ajv-validator/ajv-cli). It supports:
|
||||
|
||||
- compiling JSON Schemas to test their validity
|
||||
- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/epoberezkin/ajv-pack))
|
||||
- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/ajv-validator/ajv-pack))
|
||||
- migrate schemas to draft-07 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate))
|
||||
- validating data file(s) against JSON Schema
|
||||
- testing expected validity of data against JSON Schema
|
||||
- referenced schemas
|
||||
- custom meta-schemas
|
||||
- files in JSON and JavaScript format
|
||||
- files in JSON, JSON5, YAML, and JavaScript format
|
||||
- all Ajv options
|
||||
- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format
|
||||
|
||||
@@ -257,20 +269,20 @@ CLI is available as a separate npm package [ajv-cli](https://github.com/jessedc/
|
||||
|
||||
Ajv supports all validation keywords from draft-07 of JSON Schema standard:
|
||||
|
||||
- [type](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#type)
|
||||
- [for numbers](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf
|
||||
- [for strings](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format
|
||||
- [for arrays](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#contains)
|
||||
- [for objects](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#propertynames)
|
||||
- [for all types](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#const)
|
||||
- [compound keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf, [if/then/else](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#ifthenelse)
|
||||
- [type](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#type)
|
||||
- [for numbers](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf
|
||||
- [for strings](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format
|
||||
- [for arrays](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#contains)
|
||||
- [for objects](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#propertynames)
|
||||
- [for all types](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#const)
|
||||
- [compound keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf, [if/then/else](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#ifthenelse)
|
||||
|
||||
With [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON Schema standard:
|
||||
With [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON Schema standard:
|
||||
|
||||
- [patternRequired](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match.
|
||||
- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc.
|
||||
- [patternRequired](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match.
|
||||
- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc.
|
||||
|
||||
See [JSON Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md) for more details.
|
||||
See [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md) for more details.
|
||||
|
||||
|
||||
## Annotation keywords
|
||||
@@ -320,7 +332,7 @@ You can add additional formats and replace any of the formats above using [addFo
|
||||
|
||||
The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can whitelist specific format(s) to be ignored. See [Options](#options) for details.
|
||||
|
||||
You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js).
|
||||
You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js).
|
||||
|
||||
|
||||
## <a name="ref"></a>Combining schemas with $ref
|
||||
@@ -429,7 +441,7 @@ var validData = {
|
||||
|
||||
## $merge and $patch keywords
|
||||
|
||||
With the package [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON Schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902).
|
||||
With the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON Schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902).
|
||||
|
||||
To add keywords `$merge` and `$patch` to Ajv instance use this code:
|
||||
|
||||
@@ -488,7 +500,7 @@ The schemas above are equivalent to this schema:
|
||||
|
||||
The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema.
|
||||
|
||||
See the package [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) for more information.
|
||||
See the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) for more information.
|
||||
|
||||
|
||||
## Defining custom keywords
|
||||
@@ -536,9 +548,9 @@ console.log(validate(2)); // false
|
||||
console.log(validate(4)); // false
|
||||
```
|
||||
|
||||
Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords.
|
||||
Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords.
|
||||
|
||||
See [Defining custom keywords](https://github.com/epoberezkin/ajv/blob/master/CUSTOM.md) for more details.
|
||||
See [Defining custom keywords](https://github.com/ajv-validator/ajv/blob/master/CUSTOM.md) for more details.
|
||||
|
||||
|
||||
## Asynchronous schema compilation
|
||||
@@ -637,7 +649,7 @@ validate({ userId: 1, postId: 19 })
|
||||
|
||||
### Using transpilers with asynchronous validation functions.
|
||||
|
||||
[ajv-async](https://github.com/epoberezkin/ajv-async) uses [nodent](https://github.com/MatAtBread/nodent) to transpile async functions. To use another transpiler you should separately install it (or load its bundle in the browser).
|
||||
[ajv-async](https://github.com/ajv-validator/ajv-async) uses [nodent](https://github.com/MatAtBread/nodent) to transpile async functions. To use another transpiler you should separately install it (or load its bundle in the browser).
|
||||
|
||||
|
||||
#### Using nodent
|
||||
@@ -681,7 +693,7 @@ Ajv treats JSON schemas as trusted as your application code. This security model
|
||||
|
||||
If your schemas are received from untrusted sources (or generated from untrusted data) there are several scenarios you need to prevent:
|
||||
- compiling schemas can cause stack overflow (if they are too deep)
|
||||
- compiling schemas can be slow (e.g. [#557](https://github.com/epoberezkin/ajv/issues/557))
|
||||
- compiling schemas can be slow (e.g. [#557](https://github.com/ajv-validator/ajv/issues/557))
|
||||
- validating certain data can be slow
|
||||
|
||||
It is difficult to predict all the scenarios, but at the very least it may help to limit the size of untrusted schemas (e.g. limit JSON string length) and also the maximum schema object depth (that can be high for relatively small JSON strings). You also may want to mitigate slow regular expressions in `pattern` and `patternProperties` keywords.
|
||||
@@ -691,7 +703,7 @@ Regardless the measures you take, using untrusted schemas increases security ris
|
||||
|
||||
##### Circular references in JavaScript objects
|
||||
|
||||
Ajv does not support schemas and validated data that have circular references in objects. See [issue #802](https://github.com/epoberezkin/ajv/issues/802).
|
||||
Ajv does not support schemas and validated data that have circular references in objects. See [issue #802](https://github.com/ajv-validator/ajv/issues/802).
|
||||
|
||||
An attempt to compile such schemas or validate such data would cause stack overflow (or will not complete in case of asynchronous validation). Depending on the parser you use, untrusted data can lead to circular references.
|
||||
|
||||
@@ -706,7 +718,7 @@ Some keywords in JSON Schemas can lead to very slow validation for certain data.
|
||||
|
||||
__Please note__: The suggestions above to prevent slow validation would only work if you do NOT use `allErrors: true` in production code (using it would continue validation after validation errors).
|
||||
|
||||
You can validate your JSON schemas against [this meta-schema](https://github.com/epoberezkin/ajv/blob/master/lib/refs/json-schema-secure.json) to check that these recommendations are followed:
|
||||
You can validate your JSON schemas against [this meta-schema](https://github.com/ajv-validator/ajv/blob/master/lib/refs/json-schema-secure.json) to check that these recommendations are followed:
|
||||
|
||||
```javascript
|
||||
const isSchemaSecure = ajv.compile(require('ajv/lib/refs/json-schema-secure.json'));
|
||||
@@ -721,13 +733,17 @@ isSchemaSecure(schema2); // true
|
||||
__Please note__: following all these recommendation is not a guarantee that validation of untrusted data is safe - it can still lead to some undesirable results.
|
||||
|
||||
|
||||
##### Content Security Policies (CSP)
|
||||
See [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp)
|
||||
|
||||
|
||||
## ReDoS attack
|
||||
|
||||
Certain regular expressions can lead to the exponential evaluation time even with relatively short strings.
|
||||
|
||||
Please assess the regular expressions you use in the schemas on their vulnerability to this attack - see [safe-regex](https://github.com/substack/safe-regex), for example.
|
||||
|
||||
__Please note__: some formats that Ajv implements use [regular expressions](https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js) that can be vulnerable to ReDoS attack, so if you use Ajv to validate data from untrusted sources __it is strongly recommended__ to consider the following:
|
||||
__Please note__: some formats that Ajv implements use [regular expressions](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js) that can be vulnerable to ReDoS attack, so if you use Ajv to validate data from untrusted sources __it is strongly recommended__ to consider the following:
|
||||
|
||||
- making assessment of "format" implementations in Ajv.
|
||||
- using `format: 'fast'` option that simplifies some of the regular expressions (although it does not guarantee that they are safe).
|
||||
@@ -807,7 +823,7 @@ The intention of the schema above is to allow objects with either the string pro
|
||||
|
||||
With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema).
|
||||
|
||||
While this behaviour is unexpected (issues [#129](https://github.com/epoberezkin/ajv/issues/129), [#134](https://github.com/epoberezkin/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way:
|
||||
While this behaviour is unexpected (issues [#129](https://github.com/ajv-validator/ajv/issues/129), [#134](https://github.com/ajv-validator/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -881,7 +897,7 @@ console.log(data); // [ 1, "foo" ]
|
||||
`default` keywords in other cases are ignored:
|
||||
|
||||
- not in `properties` or `items` subschemas
|
||||
- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/epoberezkin/ajv/issues/42))
|
||||
- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/ajv-validator/ajv/issues/42))
|
||||
- in `if` subschema of `switch` keyword
|
||||
- in schemas generated by custom macro keywords
|
||||
|
||||
@@ -939,7 +955,7 @@ console.log(data); // { "foo": [1], "bar": false }
|
||||
|
||||
The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords).
|
||||
|
||||
See [Coercion rules](https://github.com/epoberezkin/ajv/blob/master/COERCION.md) for details.
|
||||
See [Coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md) for details.
|
||||
|
||||
|
||||
## API
|
||||
@@ -1057,9 +1073,9 @@ Function should return validation result as `true` or `false`.
|
||||
If object is passed it should have properties `validate`, `compare` and `async`:
|
||||
|
||||
- _validate_: a string, RegExp or a function as described above.
|
||||
- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal.
|
||||
- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal.
|
||||
- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`.
|
||||
- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/epoberezkin/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass.
|
||||
- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/ajv-validator/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass.
|
||||
|
||||
Custom formats can be also added via `formats` option.
|
||||
|
||||
@@ -1155,6 +1171,7 @@ Defaults:
|
||||
// strict mode options
|
||||
strictDefaults: false,
|
||||
strictKeywords: false,
|
||||
strictNumbers: false,
|
||||
// asynchronous validation options:
|
||||
transpile: undefined, // requires ajv-async package
|
||||
// advanced options:
|
||||
@@ -1169,7 +1186,7 @@ Defaults:
|
||||
errorDataPath: 'object', // deprecated
|
||||
messages: true,
|
||||
sourceCode: false,
|
||||
processCode: undefined, // function (str: string): string {}
|
||||
processCode: undefined, // function (str: string, schema: object): string {}
|
||||
cache: new Cache,
|
||||
serialize: undefined
|
||||
}
|
||||
@@ -1233,7 +1250,7 @@ Defaults:
|
||||
- `true` - insert defaults by value (object literal is used).
|
||||
- `"empty"` - in addition to missing or undefined, use defaults for properties and items that are equal to `null` or `""` (an empty string).
|
||||
- `"shared"` (deprecated) - insert defaults by reference. If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well.
|
||||
- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/epoberezkin/ajv/blob/master/COERCION.md). Option values:
|
||||
- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md). Option values:
|
||||
- `false` (default) - no type coercion.
|
||||
- `true` - coerce scalar data types.
|
||||
- `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema).
|
||||
@@ -1249,11 +1266,13 @@ Defaults:
|
||||
- `false` (default) - unknown keywords are not reported
|
||||
- `true` - if an unknown keyword is present, throw an error
|
||||
- `"log"` - if an unknown keyword is present, log warning
|
||||
|
||||
- _strictNumbers_: validate numbers strictly, failing validation for NaN and Infinity. Option values:
|
||||
- `false` (default) - NaN or Infinity will pass validation for numeric types
|
||||
- `true` - NaN or Infinity will not pass validation for numeric types
|
||||
|
||||
##### Asynchronous validation options
|
||||
|
||||
- _transpile_: Requires [ajv-async](https://github.com/epoberezkin/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values:
|
||||
- _transpile_: Requires [ajv-async](https://github.com/ajv-validator/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values:
|
||||
- `undefined` (default) - transpile with [nodent](https://github.com/MatAtBread/nodent) if async functions are not supported.
|
||||
- `true` - always transpile with nodent.
|
||||
- `false` - do not transpile; if async functions are not supported an exception will be thrown.
|
||||
@@ -1274,13 +1293,13 @@ Defaults:
|
||||
- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance.
|
||||
- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance.
|
||||
- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst.
|
||||
- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/epoberezkin/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations).
|
||||
- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/ajv-validator/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations).
|
||||
- _errorDataPath_ (deprecated): set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`.
|
||||
- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n)).
|
||||
- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n)).
|
||||
- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call).
|
||||
- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options:
|
||||
- `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass `require('js-beautify').js_beautify`.
|
||||
- `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/epoberezkin/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information.
|
||||
- `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass a function calling `require('js-beautify').js_beautify` as `processCode: code => js_beautify(code)`.
|
||||
- `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/ajv-validator/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information.
|
||||
- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`.
|
||||
- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used.
|
||||
|
||||
@@ -1297,7 +1316,7 @@ Each error is an object with the following properties:
|
||||
- _keyword_: validation keyword.
|
||||
- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`).
|
||||
- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation.
|
||||
- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package). See below for parameters set by all keywords.
|
||||
- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package). See below for parameters set by all keywords.
|
||||
- _message_: the standard error message (can be excluded with option `messages` set to false).
|
||||
- _schema_: the schema of the keyword (added with `verbose` option).
|
||||
- _parentSchema_: the schema containing the keyword (added with `verbose` option)
|
||||
@@ -1372,15 +1391,15 @@ If you have published a useful plugin please submit a PR to add it to the next s
|
||||
|
||||
## Related packages
|
||||
|
||||
- [ajv-async](https://github.com/epoberezkin/ajv-async) - plugin to configure async validation mode
|
||||
- [ajv-async](https://github.com/ajv-validator/ajv-async) - plugin to configure async validation mode
|
||||
- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats
|
||||
- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface
|
||||
- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - plugin for custom error messages
|
||||
- [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) - internationalised error messages
|
||||
- [ajv-istanbul](https://github.com/epoberezkin/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas
|
||||
- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.)
|
||||
- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - plugin with keywords $merge and $patch
|
||||
- [ajv-pack](https://github.com/epoberezkin/ajv-pack) - produces a compact module exporting validation functions
|
||||
- [ajv-errors](https://github.com/ajv-validator/ajv-errors) - plugin for custom error messages
|
||||
- [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) - internationalised error messages
|
||||
- [ajv-istanbul](https://github.com/ajv-validator/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas
|
||||
- [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.)
|
||||
- [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) - plugin with keywords $merge and $patch
|
||||
- [ajv-pack](https://github.com/ajv-validator/ajv-pack) - produces a compact module exporting validation functions
|
||||
- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't already included in ajv (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`).
|
||||
|
||||
## Some packages using Ajv
|
||||
@@ -1418,28 +1437,35 @@ npm test
|
||||
|
||||
## Contributing
|
||||
|
||||
All validation functions are generated using doT templates in [dot](https://github.com/epoberezkin/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency.
|
||||
All validation functions are generated using doT templates in [dot](https://github.com/ajv-validator/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency.
|
||||
|
||||
`npm run build` - compiles templates to [dotjs](https://github.com/epoberezkin/ajv/tree/master/lib/dotjs) folder.
|
||||
`npm run build` - compiles templates to [dotjs](https://github.com/ajv-validator/ajv/tree/master/lib/dotjs) folder.
|
||||
|
||||
`npm run watch` - automatically compiles templates when files in dot folder change
|
||||
|
||||
Please see [Contributing guidelines](https://github.com/epoberezkin/ajv/blob/master/CONTRIBUTING.md)
|
||||
Please see [Contributing guidelines](https://github.com/ajv-validator/ajv/blob/master/CONTRIBUTING.md)
|
||||
|
||||
|
||||
## Changes history
|
||||
|
||||
See https://github.com/epoberezkin/ajv/releases
|
||||
See https://github.com/ajv-validator/ajv/releases
|
||||
|
||||
__Please note__: [Changes in version 6.0.0](https://github.com/epoberezkin/ajv/releases/tag/v6.0.0).
|
||||
__Please note__: [Changes in version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
|
||||
|
||||
[Version 5.0.0](https://github.com/epoberezkin/ajv/releases/tag/5.0.0).
|
||||
[Version 5.0.0](https://github.com/ajv-validator/ajv/releases/tag/5.0.0).
|
||||
|
||||
[Version 4.0.0](https://github.com/epoberezkin/ajv/releases/tag/4.0.0).
|
||||
[Version 4.0.0](https://github.com/ajv-validator/ajv/releases/tag/4.0.0).
|
||||
|
||||
[Version 3.0.0](https://github.com/epoberezkin/ajv/releases/tag/3.0.0).
|
||||
[Version 3.0.0](https://github.com/ajv-validator/ajv/releases/tag/3.0.0).
|
||||
|
||||
[Version 2.0.0](https://github.com/epoberezkin/ajv/releases/tag/2.0.0).
|
||||
[Version 2.0.0](https://github.com/ajv-validator/ajv/releases/tag/2.0.0).
|
||||
|
||||
|
||||
## Code of conduct
|
||||
|
||||
Please review and follow the [Code of conduct](https://github.com/ajv-validator/ajv/blob/master/CODE_OF_CONDUCT.md).
|
||||
|
||||
Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team.
|
||||
|
||||
|
||||
## Open-source software support
|
||||
@@ -1449,4 +1475,4 @@ Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/n
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/epoberezkin/ajv/blob/master/LICENSE)
|
||||
[MIT](https://github.com/ajv-validator/ajv/blob/master/LICENSE)
|
||||
|
||||
112
conf/site/node_modules/sass-loader/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
112
conf/site/node_modules/sass-loader/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
@@ -414,7 +414,7 @@ function compile(schema, root, localRefs, baseId) {
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode);
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
||||
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
||||
var validate;
|
||||
try {
|
||||
@@ -1076,8 +1076,6 @@ module.exports = {
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
cleanUpCode: cleanUpCode,
|
||||
finalCleanUpCode: finalCleanUpCode,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
schemaUnknownRules: schemaUnknownRules,
|
||||
@@ -1099,7 +1097,7 @@ function copy(o, to) {
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, negate) {
|
||||
function checkDataType(dataType, data, strictNumbers, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
@@ -1112,15 +1110,18 @@ function checkDataType(dataType, data, negate) {
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data + ')';
|
||||
AND + data + EQUAL + data +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data) {
|
||||
function checkDataTypes(dataTypes, data, strictNumbers) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, true);
|
||||
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
@@ -1133,7 +1134,7 @@ function checkDataTypes(dataTypes, data) {
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
@@ -1199,42 +1200,6 @@ function varReplace(str, dataVar, expr) {
|
||||
}
|
||||
|
||||
|
||||
var EMPTY_ELSE = /else\s*{\s*}/g
|
||||
, EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
|
||||
, EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
|
||||
function cleanUpCode(out) {
|
||||
return out.replace(EMPTY_ELSE, '')
|
||||
.replace(EMPTY_IF_NO_ELSE, '')
|
||||
.replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
|
||||
}
|
||||
|
||||
|
||||
var ERRORS_REGEXP = /[^v.]errors/g
|
||||
, REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
|
||||
, REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
|
||||
, RETURN_VALID = 'return errors === 0;'
|
||||
, RETURN_TRUE = 'validate.errors = null; return true;'
|
||||
, RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
|
||||
, RETURN_DATA_ASYNC = 'return data;'
|
||||
, ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
|
||||
, REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
|
||||
|
||||
function finalCleanUpCode(out, async) {
|
||||
var matches = out.match(ERRORS_REGEXP);
|
||||
if (matches && matches.length == 2) {
|
||||
out = async
|
||||
? out.replace(REMOVE_ERRORS_ASYNC, '')
|
||||
.replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
|
||||
: out.replace(REMOVE_ERRORS, '')
|
||||
.replace(RETURN_VALID, RETURN_TRUE);
|
||||
}
|
||||
|
||||
matches = out.match(ROOTDATA_REGEXP);
|
||||
if (!matches || matches.length !== 3) return out;
|
||||
return out.replace(REMOVE_ROOTDATA, '');
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return !schema;
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
@@ -1313,7 +1278,7 @@ function getData($data, lvl, paths) {
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/' \+ '/g, '');
|
||||
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
|
||||
}
|
||||
|
||||
|
||||
@@ -1377,7 +1342,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -1393,7 +1358,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
|
||||
module.exports = {
|
||||
$id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js',
|
||||
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
||||
definitions: {
|
||||
simpleTypes: metaSchema.definitions.simpleTypes
|
||||
},
|
||||
@@ -1453,6 +1418,12 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
$op = $isMax ? '<' : '>',
|
||||
$notOp = $isMax ? '>' : '<',
|
||||
$errorKeyword = undefined;
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
@@ -1605,6 +1576,9 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxItems' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
@@ -1684,6 +1658,9 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxLength' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
@@ -1768,6 +1745,9 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
@@ -1868,7 +1848,6 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -1939,7 +1918,6 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
@@ -2102,7 +2080,6 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -2356,6 +2333,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
$propertyDeps = {},
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
for ($property in $schema) {
|
||||
if ($property == '__proto__') continue;
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
@@ -2502,7 +2480,6 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -2823,7 +2800,6 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
@@ -3006,7 +2982,6 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -3029,6 +3004,9 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
out += 'var division' + ($lvl) + ';if (';
|
||||
if ($isData) {
|
||||
out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
|
||||
@@ -3348,9 +3326,9 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$dataProperties = 'dataProperties' + $lvl;
|
||||
var $schemaKeys = Object.keys($schema || {}),
|
||||
var $schemaKeys = Object.keys($schema || {}).filter(notProto),
|
||||
$pProperties = it.schema.patternProperties || {},
|
||||
$pPropertyKeys = Object.keys($pProperties),
|
||||
$pPropertyKeys = Object.keys($pProperties).filter(notProto),
|
||||
$aProperties = it.schema.additionalProperties,
|
||||
$someProperties = $schemaKeys.length || $pPropertyKeys.length,
|
||||
$noAdditional = $aProperties === false,
|
||||
@@ -3360,7 +3338,13 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$ownProperties = it.opts.ownProperties,
|
||||
$currentBaseId = it.baseId;
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}
|
||||
|
||||
function notProto(p) {
|
||||
return p !== '__proto__';
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
|
||||
if ($ownProperties) {
|
||||
out += ' var ' + ($dataProperties) + ' = undefined;';
|
||||
@@ -3655,7 +3639,6 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -3739,7 +3722,6 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -4173,7 +4155,7 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
|
||||
var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
|
||||
out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
|
||||
out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
|
||||
if ($typeIsArray) {
|
||||
out += ' if (typeof item == \'string\') item = \'"\' + item; ';
|
||||
}
|
||||
@@ -4381,7 +4363,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
var $schemaPath = it.schemaPath + '.type',
|
||||
$errSchemaPath = it.errSchemaPath + '/type',
|
||||
$method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
|
||||
out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
|
||||
if ($coerceToTypes) {
|
||||
var $dataType = 'dataType' + $lvl,
|
||||
$coerced = 'coerced' + $lvl;
|
||||
@@ -4534,7 +4516,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
$rulesGroup = arr2[i2 += 1];
|
||||
if ($shouldUseGroup($rulesGroup)) {
|
||||
if ($rulesGroup.type) {
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
|
||||
}
|
||||
if (it.opts.useDefaults) {
|
||||
if ($rulesGroup.type == 'object' && it.schema.properties) {
|
||||
@@ -4702,10 +4684,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
if ($top) {
|
||||
out = it.util.finalCleanUpCode(out, $async);
|
||||
}
|
||||
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
var rules = $rulesGroup.rules;
|
||||
@@ -4774,7 +4752,7 @@ function addKeyword(keyword, definition) {
|
||||
metaSchema = {
|
||||
anyOf: [
|
||||
metaSchema,
|
||||
{ '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
{ '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -4876,7 +4854,7 @@ function validateKeyword(definition, throwError) {
|
||||
},{"./definition_schema":12,"./dotjs/custom":22}],40:[function(require,module,exports){
|
||||
module.exports={
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#",
|
||||
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
||||
"description": "Meta-schema for $data reference (JSON Schema extension proposal)",
|
||||
"type": "object",
|
||||
"required": [ "$data" ],
|
||||
|
||||
4
conf/site/node_modules/sass-loader/node_modules/ajv/dist/ajv.min.js
generated
vendored
4
conf/site/node_modules/sass-loader/node_modules/ajv/dist/ajv.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
conf/site/node_modules/sass-loader/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/ajv.d.ts
generated
vendored
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/ajv.d.ts
generated
vendored
@@ -183,6 +183,7 @@ declare namespace ajv {
|
||||
coerceTypes?: boolean | 'array';
|
||||
strictDefaults?: boolean | 'log';
|
||||
strictKeywords?: boolean | 'log';
|
||||
strictNumbers?: boolean;
|
||||
async?: boolean | string;
|
||||
transpile?: string | ((code: string) => string);
|
||||
meta?: boolean | object;
|
||||
@@ -196,7 +197,7 @@ declare namespace ajv {
|
||||
errorDataPath?: string,
|
||||
messages?: boolean;
|
||||
sourceCode?: boolean;
|
||||
processCode?: (code: string) => string;
|
||||
processCode?: (code: string, schema: object) => string;
|
||||
cache?: object;
|
||||
logger?: CustomLogger | false;
|
||||
nullable?: boolean;
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/compile/equal.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/compile/equal.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// do NOT remove this file - it would break pre-compiled schemas
|
||||
// https://github.com/epoberezkin/ajv/issues/889
|
||||
// https://github.com/ajv-validator/ajv/issues/889
|
||||
module.exports = require('fast-deep-equal');
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/compile/index.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/compile/index.js
generated
vendored
@@ -113,7 +113,7 @@ function compile(schema, root, localRefs, baseId) {
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode);
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
||||
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
||||
var validate;
|
||||
try {
|
||||
|
||||
53
conf/site/node_modules/sass-loader/node_modules/ajv/lib/compile/util.js
generated
vendored
53
conf/site/node_modules/sass-loader/node_modules/ajv/lib/compile/util.js
generated
vendored
@@ -13,8 +13,6 @@ module.exports = {
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
cleanUpCode: cleanUpCode,
|
||||
finalCleanUpCode: finalCleanUpCode,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
schemaUnknownRules: schemaUnknownRules,
|
||||
@@ -36,7 +34,7 @@ function copy(o, to) {
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, negate) {
|
||||
function checkDataType(dataType, data, strictNumbers, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
@@ -49,15 +47,18 @@ function checkDataType(dataType, data, negate) {
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data + ')';
|
||||
AND + data + EQUAL + data +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data) {
|
||||
function checkDataTypes(dataTypes, data, strictNumbers) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, true);
|
||||
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
@@ -70,7 +71,7 @@ function checkDataTypes(dataTypes, data) {
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
@@ -136,42 +137,6 @@ function varReplace(str, dataVar, expr) {
|
||||
}
|
||||
|
||||
|
||||
var EMPTY_ELSE = /else\s*{\s*}/g
|
||||
, EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
|
||||
, EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
|
||||
function cleanUpCode(out) {
|
||||
return out.replace(EMPTY_ELSE, '')
|
||||
.replace(EMPTY_IF_NO_ELSE, '')
|
||||
.replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
|
||||
}
|
||||
|
||||
|
||||
var ERRORS_REGEXP = /[^v.]errors/g
|
||||
, REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
|
||||
, REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
|
||||
, RETURN_VALID = 'return errors === 0;'
|
||||
, RETURN_TRUE = 'validate.errors = null; return true;'
|
||||
, RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
|
||||
, RETURN_DATA_ASYNC = 'return data;'
|
||||
, ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
|
||||
, REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
|
||||
|
||||
function finalCleanUpCode(out, async) {
|
||||
var matches = out.match(ERRORS_REGEXP);
|
||||
if (matches && matches.length == 2) {
|
||||
out = async
|
||||
? out.replace(REMOVE_ERRORS_ASYNC, '')
|
||||
.replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
|
||||
: out.replace(REMOVE_ERRORS, '')
|
||||
.replace(RETURN_VALID, RETURN_TRUE);
|
||||
}
|
||||
|
||||
matches = out.match(ROOTDATA_REGEXP);
|
||||
if (!matches || matches.length !== 3) return out;
|
||||
return out.replace(REMOVE_ROOTDATA, '');
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return !schema;
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
@@ -250,7 +215,7 @@ function getData($data, lvl, paths) {
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/' \+ '/g, '');
|
||||
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/data.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/data.js
generated
vendored
@@ -38,7 +38,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/definition_schema.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/definition_schema.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
|
||||
module.exports = {
|
||||
$id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js',
|
||||
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
||||
definitions: {
|
||||
simpleTypes: metaSchema.definitions.simpleTypes
|
||||
},
|
||||
|
||||
9
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
9
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
@@ -17,6 +17,15 @@
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $notOp = $isMax ? '>' : '<'
|
||||
, $errorKeyword = undefined;
|
||||
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined
|
||||
|| typeof $schemaExcl == 'number'
|
||||
|| typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
}}
|
||||
|
||||
{{? $isDataExcl }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
@@ -3,6 +3,8 @@
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
@@ -3,6 +3,8 @@
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
@@ -3,6 +3,8 @@
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
@@ -30,5 +30,3 @@
|
||||
{{= $closingBraces.slice(0,-1) }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
@@ -39,8 +39,6 @@
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/contains.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/contains.jst
generated
vendored
@@ -53,5 +53,3 @@ var {{=$valid}};
|
||||
{{# def.resetErrors }}
|
||||
{{?}}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
13
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/definitions.def
generated
vendored
13
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/definitions.def
generated
vendored
@@ -112,12 +112,6 @@
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}}
|
||||
|
||||
|
||||
{{## def.finalCleanUp: {{ out = it.util.finalCleanUpCode(out, $async); }} #}}
|
||||
|
||||
|
||||
{{## def.$data:
|
||||
{{
|
||||
var $isData = it.opts.$data && $schema && $schema.$data
|
||||
@@ -144,6 +138,13 @@
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.numberKeyword:
|
||||
{{? !($isData || typeof $schema == 'number') }}
|
||||
{{ throw new Error($keyword + ' must be number'); }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.beginDefOut:
|
||||
{{
|
||||
var $$outStack = $$outStack || [];
|
||||
|
||||
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
@@ -19,6 +19,7 @@
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
|
||||
for ($property in $schema) {
|
||||
if ($property == '__proto__') continue;
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
@@ -76,5 +77,3 @@ var missing{{=$lvl}};
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/if.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/if.jst
generated
vendored
@@ -65,8 +65,6 @@
|
||||
{{# def.extraError:'if' }}
|
||||
}
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/items.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/items.jst
generated
vendored
@@ -96,5 +96,3 @@ var {{=$valid}};
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
@@ -3,6 +3,8 @@
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
var division{{=$lvl}};
|
||||
if ({{?$isData}}
|
||||
{{=$schemaValue}} !== undefined && (
|
||||
|
||||
11
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/properties.jst
generated
vendored
11
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/properties.jst
generated
vendored
@@ -28,9 +28,9 @@
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl;
|
||||
|
||||
var $schemaKeys = Object.keys($schema || {})
|
||||
var $schemaKeys = Object.keys($schema || {}).filter(notProto)
|
||||
, $pProperties = it.schema.patternProperties || {}
|
||||
, $pPropertyKeys = Object.keys($pProperties)
|
||||
, $pPropertyKeys = Object.keys($pProperties).filter(notProto)
|
||||
, $aProperties = it.schema.additionalProperties
|
||||
, $someProperties = $schemaKeys.length || $pPropertyKeys.length
|
||||
, $noAdditional = $aProperties === false
|
||||
@@ -42,8 +42,11 @@
|
||||
, $currentBaseId = it.baseId;
|
||||
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired)
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}
|
||||
|
||||
function notProto(p) { return p !== '__proto__'; }
|
||||
}}
|
||||
|
||||
|
||||
@@ -240,5 +243,3 @@ var {{=$nextValid}} = true;
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/propertyNames.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/propertyNames.jst
generated
vendored
@@ -50,5 +50,3 @@ var {{=$errs}} = errors;
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/uniqueItems.jst
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/uniqueItems.jst
generated
vendored
@@ -38,7 +38,7 @@
|
||||
for (;i--;) {
|
||||
var item = {{=$data}}[i];
|
||||
{{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }}
|
||||
if ({{= it.util[$method]($itemType, 'item', true) }}) continue;
|
||||
if ({{= it.util[$method]($itemType, 'item', it.opts.strictNumbers, true) }}) continue;
|
||||
{{? $typeIsArray}}
|
||||
if (typeof item == 'string') item = '"' + item;
|
||||
{{?}}
|
||||
|
||||
10
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/validate.jst
generated
vendored
10
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dot/validate.jst
generated
vendored
@@ -140,7 +140,7 @@
|
||||
, $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
}}
|
||||
|
||||
if ({{= it.util[$method]($typeSchema, $data, true) }}) {
|
||||
if ({{= it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) }}) {
|
||||
#}}
|
||||
|
||||
{{? it.schema.$ref && $refKeywords }}
|
||||
@@ -192,7 +192,7 @@
|
||||
{{~ it.RULES:$rulesGroup }}
|
||||
{{? $shouldUseGroup($rulesGroup) }}
|
||||
{{? $rulesGroup.type }}
|
||||
if ({{= it.util.checkDataType($rulesGroup.type, $data) }}) {
|
||||
if ({{= it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) }}) {
|
||||
{{?}}
|
||||
{{? it.opts.useDefaults }}
|
||||
{{? $rulesGroup.type == 'object' && it.schema.properties }}
|
||||
@@ -254,12 +254,6 @@
|
||||
var {{=$valid}} = errors === errs_{{=$lvl}};
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
{{? $top }}
|
||||
{{# def.finalCleanUp }}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
var rules = $rulesGroup.rules;
|
||||
|
||||
6
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
6
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
@@ -24,6 +24,12 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
$op = $isMax ? '<' : '>',
|
||||
$notOp = $isMax ? '>' : '<',
|
||||
$errorKeyword = undefined;
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
|
||||
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
@@ -17,6 +17,9 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxItems' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
|
||||
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
@@ -17,6 +17,9 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxLength' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
|
||||
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
@@ -17,6 +17,9 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
|
||||
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
@@ -38,6 +38,5 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
@@ -64,7 +64,6 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
|
||||
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/contains.js
generated
vendored
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/contains.js
generated
vendored
@@ -77,6 +77,5 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
@@ -17,6 +17,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
$propertyDeps = {},
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
for ($property in $schema) {
|
||||
if ($property == '__proto__') continue;
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
@@ -163,6 +164,5 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/if.js
generated
vendored
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/if.js
generated
vendored
@@ -94,7 +94,6 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
|
||||
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/items.js
generated
vendored
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/items.js
generated
vendored
@@ -136,6 +136,5 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
3
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
@@ -16,6 +16,9 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
out += 'var division' + ($lvl) + ';if (';
|
||||
if ($isData) {
|
||||
out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
|
||||
|
||||
13
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/properties.js
generated
vendored
13
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/properties.js
generated
vendored
@@ -18,9 +18,9 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$dataProperties = 'dataProperties' + $lvl;
|
||||
var $schemaKeys = Object.keys($schema || {}),
|
||||
var $schemaKeys = Object.keys($schema || {}).filter(notProto),
|
||||
$pProperties = it.schema.patternProperties || {},
|
||||
$pPropertyKeys = Object.keys($pProperties),
|
||||
$pPropertyKeys = Object.keys($pProperties).filter(notProto),
|
||||
$aProperties = it.schema.additionalProperties,
|
||||
$someProperties = $schemaKeys.length || $pPropertyKeys.length,
|
||||
$noAdditional = $aProperties === false,
|
||||
@@ -30,7 +30,13 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
$ownProperties = it.opts.ownProperties,
|
||||
$currentBaseId = it.baseId;
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}
|
||||
|
||||
function notProto(p) {
|
||||
return p !== '__proto__';
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
|
||||
if ($ownProperties) {
|
||||
out += ' var ' + ($dataProperties) + ' = undefined;';
|
||||
@@ -325,6 +331,5 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/propertyNames.js
generated
vendored
1
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/propertyNames.js
generated
vendored
@@ -77,6 +77,5 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/uniqueItems.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/uniqueItems.js
generated
vendored
@@ -29,7 +29,7 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
|
||||
var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
|
||||
out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
|
||||
out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
|
||||
if ($typeIsArray) {
|
||||
out += ' if (typeof item == \'string\') item = \'"\' + item; ';
|
||||
}
|
||||
|
||||
8
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/validate.js
generated
vendored
8
conf/site/node_modules/sass-loader/node_modules/ajv/lib/dotjs/validate.js
generated
vendored
@@ -149,7 +149,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
var $schemaPath = it.schemaPath + '.type',
|
||||
$errSchemaPath = it.errSchemaPath + '/type',
|
||||
$method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
|
||||
out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
|
||||
if ($coerceToTypes) {
|
||||
var $dataType = 'dataType' + $lvl,
|
||||
$coerced = 'coerced' + $lvl;
|
||||
@@ -302,7 +302,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
$rulesGroup = arr2[i2 += 1];
|
||||
if ($shouldUseGroup($rulesGroup)) {
|
||||
if ($rulesGroup.type) {
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
|
||||
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
|
||||
}
|
||||
if (it.opts.useDefaults) {
|
||||
if ($rulesGroup.type == 'object' && it.schema.properties) {
|
||||
@@ -470,10 +470,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
|
||||
} else {
|
||||
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
if ($top) {
|
||||
out = it.util.finalCleanUpCode(out, $async);
|
||||
}
|
||||
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
var rules = $rulesGroup.rules;
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/keyword.js
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/keyword.js
generated
vendored
@@ -46,7 +46,7 @@ function addKeyword(keyword, definition) {
|
||||
metaSchema = {
|
||||
anyOf: [
|
||||
metaSchema,
|
||||
{ '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
{ '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/refs/data.json
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/refs/data.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#",
|
||||
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
||||
"description": "Meta-schema for $data reference (JSON Schema extension proposal)",
|
||||
"type": "object",
|
||||
"required": [ "$data" ],
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/refs/json-schema-secure.json
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/lib/refs/json-schema-secure.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-secure.json#",
|
||||
"$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#",
|
||||
"title": "Meta-schema for the security assessment of JSON Schemas",
|
||||
"description": "If a JSON Schema fails validation against this meta-schema, it may be unsafe to validate untrusted data",
|
||||
"definitions": {
|
||||
|
||||
36
conf/site/node_modules/sass-loader/node_modules/ajv/package.json
generated
vendored
36
conf/site/node_modules/sass-loader/node_modules/ajv/package.json
generated
vendored
@@ -1,38 +1,38 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"ajv@6.12.2",
|
||||
"ajv@6.12.3",
|
||||
"/home/henry/Documents/git/Speedtest-tracker-docker/conf/site"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "ajv@6.12.2",
|
||||
"_id": "ajv@6.12.2",
|
||||
"_from": "ajv@6.12.3",
|
||||
"_id": "ajv@6.12.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
|
||||
"_integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
|
||||
"_location": "/sass-loader/ajv",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "ajv@6.12.2",
|
||||
"raw": "ajv@6.12.3",
|
||||
"name": "ajv",
|
||||
"escapedName": "ajv",
|
||||
"rawSpec": "6.12.2",
|
||||
"rawSpec": "6.12.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.12.2"
|
||||
"fetchSpec": "6.12.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sass-loader/schema-utils"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
|
||||
"_spec": "6.12.2",
|
||||
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
|
||||
"_spec": "6.12.3",
|
||||
"_where": "/home/henry/Documents/git/Speedtest-tracker-docker/conf/site",
|
||||
"author": {
|
||||
"name": "Evgeny Poberezkin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/epoberezkin/ajv/issues"
|
||||
"url": "https://github.com/ajv-validator/ajv/issues"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
@@ -54,7 +54,7 @@
|
||||
"coveralls": "^3.0.1",
|
||||
"del-cli": "^3.0.0",
|
||||
"dot": "^1.0.3",
|
||||
"eslint": "^6.0.0",
|
||||
"eslint": "^7.3.1",
|
||||
"gh-pages-generator": "^0.2.3",
|
||||
"glob": "^7.0.0",
|
||||
"if-node-version": "^1.0.0",
|
||||
@@ -65,11 +65,11 @@
|
||||
"karma-chrome-launcher": "^3.0.0",
|
||||
"karma-mocha": "^2.0.0",
|
||||
"karma-sauce-launcher": "^4.1.3",
|
||||
"mocha": "^7.0.1",
|
||||
"mocha": "^8.0.1",
|
||||
"nyc": "^15.0.0",
|
||||
"pre-commit": "^1.1.1",
|
||||
"require-globify": "^1.3.0",
|
||||
"typescript": "^2.8.3",
|
||||
"typescript": "^3.9.5",
|
||||
"uglify-js": "^3.6.9",
|
||||
"watch": "^1.0.0"
|
||||
},
|
||||
@@ -80,7 +80,11 @@
|
||||
"LICENSE",
|
||||
".tonic_example.js"
|
||||
],
|
||||
"homepage": "https://github.com/epoberezkin/ajv",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
},
|
||||
"homepage": "https://github.com/ajv-validator/ajv",
|
||||
"keywords": [
|
||||
"JSON",
|
||||
"schema",
|
||||
@@ -106,7 +110,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/epoberezkin/ajv.git"
|
||||
"url": "git+https://github.com/ajv-validator/ajv.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js",
|
||||
@@ -129,5 +133,5 @@
|
||||
},
|
||||
"tonicExampleFilename": ".tonic_example.js",
|
||||
"typings": "lib/ajv.d.ts",
|
||||
"version": "6.12.2"
|
||||
"version": "6.12.3"
|
||||
}
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/scripts/publish-built-version
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/scripts/publish-built-version
generated
vendored
@@ -8,7 +8,7 @@ if [[ -n $TRAVIS_TAG && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
|
||||
git config user.email "$GIT_USER_EMAIL"
|
||||
git config user.name "$GIT_USER_NAME"
|
||||
|
||||
git clone https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv-dist.git ../ajv-dist
|
||||
git clone https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv-dist.git ../ajv-dist
|
||||
|
||||
rm -rf ../ajv-dist/dist
|
||||
mkdir ../ajv-dist/dist
|
||||
|
||||
2
conf/site/node_modules/sass-loader/node_modules/ajv/scripts/travis-gh-pages
generated
vendored
2
conf/site/node_modules/sass-loader/node_modules/ajv/scripts/travis-gh-pages
generated
vendored
@@ -5,7 +5,7 @@ set -e
|
||||
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
|
||||
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && {
|
||||
rm -rf ../gh-pages
|
||||
git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages
|
||||
git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv.git ../gh-pages
|
||||
mkdir -p ../gh-pages/_source
|
||||
cp *.md ../gh-pages/_source
|
||||
cp LICENSE ../gh-pages/_source
|
||||
|
||||
22
conf/site/node_modules/sass-loader/package.json
generated
vendored
22
conf/site/node_modules/sass-loader/package.json
generated
vendored
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"sass-loader@9.0.0",
|
||||
"sass-loader@9.0.1",
|
||||
"/home/henry/Documents/git/Speedtest-tracker-docker/conf/site"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "sass-loader@9.0.0",
|
||||
"_id": "sass-loader@9.0.0",
|
||||
"_from": "sass-loader@9.0.1",
|
||||
"_id": "sass-loader@9.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-GRHB5AT35QXVKbdqKMSU29x0tVDIFSUZeTzK7SGlHu4sm2dhRqGfMx5HnIdiMyRvLJJHaWmmabR1h0gNSHipPw==",
|
||||
"_integrity": "sha512-wXFo2VAAzAUsUApOXr5PkGXDa1ad20RYhdJTubopY04i+Suk8b8g3Vtobu3kfMk48S0n5rQyAQeGBdg8WzL8gA==",
|
||||
"_location": "/sass-loader",
|
||||
"_phantomChildren": {
|
||||
"@types/json-schema": "7.0.5",
|
||||
@@ -25,18 +25,18 @@
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "sass-loader@9.0.0",
|
||||
"raw": "sass-loader@9.0.1",
|
||||
"name": "sass-loader",
|
||||
"escapedName": "sass-loader",
|
||||
"rawSpec": "9.0.0",
|
||||
"rawSpec": "9.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "9.0.0"
|
||||
"fetchSpec": "9.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.0.tgz",
|
||||
"_spec": "9.0.0",
|
||||
"_resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.1.tgz",
|
||||
"_spec": "9.0.1",
|
||||
"_where": "/home/henry/Documents/git/Speedtest-tracker-docker/conf/site",
|
||||
"author": {
|
||||
"name": "J. Tangelder"
|
||||
@@ -45,7 +45,7 @@
|
||||
"url": "https://github.com/webpack-contrib/sass-loader/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"clone-deep": "^4.0.1",
|
||||
"klona": "^1.1.1",
|
||||
"loader-utils": "^2.0.0",
|
||||
"neo-async": "^2.6.1",
|
||||
"schema-utils": "^2.7.0",
|
||||
@@ -147,5 +147,5 @@
|
||||
"test:only": "cross-env NODE_ENV=test jest",
|
||||
"test:watch": "npm run test:only -- --watch"
|
||||
},
|
||||
"version": "9.0.0"
|
||||
"version": "9.0.1"
|
||||
}
|
||||
|
||||
21
conf/site/node_modules/shallow-clone/LICENSE
generated
vendored
21
conf/site/node_modules/shallow-clone/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
153
conf/site/node_modules/shallow-clone/README.md
generated
vendored
153
conf/site/node_modules/shallow-clone/README.md
generated
vendored
@@ -1,153 +0,0 @@
|
||||
# shallow-clone [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/shallow-clone) [](https://npmjs.org/package/shallow-clone) [](https://npmjs.org/package/shallow-clone) [](https://travis-ci.org/jonschlinkert/shallow-clone)
|
||||
|
||||
> Creates a shallow clone of any JavaScript value.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save shallow-clone
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const clone = require('shallow-clone');
|
||||
```
|
||||
|
||||
**Supports**
|
||||
|
||||
* array buffers
|
||||
* arrays
|
||||
* buffers
|
||||
* dates
|
||||
* errors
|
||||
* float32 arrays
|
||||
* float64 arrays
|
||||
* int16 arrays
|
||||
* int32 arrays
|
||||
* int8 arrays
|
||||
* maps
|
||||
* objects
|
||||
* primitives
|
||||
* regular expressions
|
||||
* sets
|
||||
* symbols
|
||||
* uint16 arrays
|
||||
* uint32 arrays
|
||||
* uint8 arrays
|
||||
* uint8clamped arrays
|
||||
|
||||
## Arrays
|
||||
|
||||
By default, only the array itself is cloned (shallow), use [clone-deep](https://github.com/jonschlinkert/clone-deep) if you also need the elements in the array to be cloned.
|
||||
|
||||
```js
|
||||
const arr = [{ a: 0 }, { b: 1 }];
|
||||
const foo = clone(arr);
|
||||
// foo => [{ 'a': 0 }, { 'b': 1 }]
|
||||
|
||||
// array is cloned
|
||||
assert(actual === expected); // false
|
||||
|
||||
// array elements are not
|
||||
assert.deepEqual(actual[0], expected[0]); // true
|
||||
```
|
||||
|
||||
## Objects
|
||||
|
||||
Only the object is shallow cloned, use [clone-deep](https://github.com/jonschlinkert/clone-deep) if you also need the values in the object to be cloned.
|
||||
|
||||
```js
|
||||
console.log(clone({ a: 1, b: 2, c: 3 }));
|
||||
//=> {a: 1, b: 2, c: 3 }
|
||||
```
|
||||
|
||||
## RegExp
|
||||
|
||||
Clones regular expressions and flags, and preserves the `.lastIndex`.
|
||||
|
||||
```js
|
||||
const regex = clone(/foo/g); //=> /foo/g
|
||||
// you can manually reset lastIndex if necessary
|
||||
regex.lastIndex = 0;
|
||||
```
|
||||
|
||||
## Primitives
|
||||
|
||||
Simply returns primitives unchanged.
|
||||
|
||||
```js
|
||||
clone(0); //=> 0
|
||||
clone('foo'); //=> 'foo'
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects to a target object. Returns the target object.")
|
||||
* [clone-deep](https://www.npmjs.com/package/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. | [homepage](https://github.com/jonschlinkert/clone-deep "Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.")
|
||||
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
|
||||
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 20 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 2 | [doowb](https://github.com/doowb) |
|
||||
| 1 | [jakub-g](https://github.com/jakub-g) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 15, 2019._
|
||||
83
conf/site/node_modules/shallow-clone/index.js
generated
vendored
83
conf/site/node_modules/shallow-clone/index.js
generated
vendored
@@ -1,83 +0,0 @@
|
||||
/*!
|
||||
* shallow-clone <https://github.com/jonschlinkert/shallow-clone>
|
||||
*
|
||||
* Copyright (c) 2015-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const valueOf = Symbol.prototype.valueOf;
|
||||
const typeOf = require('kind-of');
|
||||
|
||||
function clone(val, deep) {
|
||||
switch (typeOf(val)) {
|
||||
case 'array':
|
||||
return val.slice();
|
||||
case 'object':
|
||||
return Object.assign({}, val);
|
||||
case 'date':
|
||||
return new val.constructor(Number(val));
|
||||
case 'map':
|
||||
return new Map(val);
|
||||
case 'set':
|
||||
return new Set(val);
|
||||
case 'buffer':
|
||||
return cloneBuffer(val);
|
||||
case 'symbol':
|
||||
return cloneSymbol(val);
|
||||
case 'arraybuffer':
|
||||
return cloneArrayBuffer(val);
|
||||
case 'float32array':
|
||||
case 'float64array':
|
||||
case 'int16array':
|
||||
case 'int32array':
|
||||
case 'int8array':
|
||||
case 'uint16array':
|
||||
case 'uint32array':
|
||||
case 'uint8clampedarray':
|
||||
case 'uint8array':
|
||||
return cloneTypedArray(val);
|
||||
case 'regexp':
|
||||
return cloneRegExp(val);
|
||||
case 'error':
|
||||
return Object.create(val);
|
||||
default: {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cloneRegExp(val) {
|
||||
const flags = val.flags !== void 0 ? val.flags : (/\w+$/.exec(val) || void 0);
|
||||
const re = new val.constructor(val.source, flags);
|
||||
re.lastIndex = val.lastIndex;
|
||||
return re;
|
||||
}
|
||||
|
||||
function cloneArrayBuffer(val) {
|
||||
const res = new val.constructor(val.byteLength);
|
||||
new Uint8Array(res).set(new Uint8Array(val));
|
||||
return res;
|
||||
}
|
||||
|
||||
function cloneTypedArray(val, deep) {
|
||||
return new val.constructor(val.buffer, val.byteOffset, val.length);
|
||||
}
|
||||
|
||||
function cloneBuffer(val) {
|
||||
const len = val.length;
|
||||
const buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
|
||||
val.copy(buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
function cloneSymbol(val) {
|
||||
return valueOf ? Object(valueOf.call(val)) : {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `clone`
|
||||
*/
|
||||
|
||||
module.exports = clone;
|
||||
105
conf/site/node_modules/shallow-clone/package.json
generated
vendored
105
conf/site/node_modules/shallow-clone/package.json
generated
vendored
@@ -1,105 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"shallow-clone@3.0.1",
|
||||
"/home/henry/Documents/git/Speedtest-tracker-docker/conf/site"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "shallow-clone@3.0.1",
|
||||
"_id": "shallow-clone@3.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
|
||||
"_location": "/shallow-clone",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "shallow-clone@3.0.1",
|
||||
"name": "shallow-clone",
|
||||
"escapedName": "shallow-clone",
|
||||
"rawSpec": "3.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/clone-deep"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
|
||||
"_spec": "3.0.1",
|
||||
"_where": "/home/henry/Documents/git/Speedtest-tracker-docker/conf/site",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/shallow-clone/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Brian Woodward",
|
||||
"url": "https://twitter.com/doowb"
|
||||
},
|
||||
{
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "http://twitter.com/jonschlinkert"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"kind-of": "^6.0.2"
|
||||
},
|
||||
"description": "Creates a shallow clone of any JavaScript value.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^6.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/shallow-clone",
|
||||
"keywords": [
|
||||
"array",
|
||||
"clone",
|
||||
"copy",
|
||||
"extend",
|
||||
"mixin",
|
||||
"object",
|
||||
"primitive",
|
||||
"shallow"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "shallow-clone",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/shallow-clone.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"related": {
|
||||
"list": [
|
||||
"assign-deep",
|
||||
"clone-deep",
|
||||
"is-plain-object",
|
||||
"kind-of"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "3.0.1"
|
||||
}
|
||||
40
conf/site/package-lock.json
generated
40
conf/site/package-lock.json
generated
@@ -2763,17 +2763,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"clone-deep": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
|
||||
"integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-plain-object": "^2.0.4",
|
||||
"kind-of": "^6.0.2",
|
||||
"shallow-clone": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"coa": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz",
|
||||
@@ -6218,6 +6207,12 @@
|
||||
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
||||
"dev": true
|
||||
},
|
||||
"klona": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/klona/-/klona-1.1.2.tgz",
|
||||
"integrity": "sha512-xf88rTeHiXk+XE2Vhi6yj8Wm3gMZrygGdKjJqN8HkV+PwF/t50/LdAKHoHpPcxFAlmQszTZ1CugrK25S7qDRLA==",
|
||||
"dev": true
|
||||
},
|
||||
"laravel-mix": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/laravel-mix/-/laravel-mix-5.0.4.tgz",
|
||||
@@ -8931,12 +8926,12 @@
|
||||
}
|
||||
},
|
||||
"sass-loader": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.0.tgz",
|
||||
"integrity": "sha512-GRHB5AT35QXVKbdqKMSU29x0tVDIFSUZeTzK7SGlHu4sm2dhRqGfMx5HnIdiMyRvLJJHaWmmabR1h0gNSHipPw==",
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.1.tgz",
|
||||
"integrity": "sha512-wXFo2VAAzAUsUApOXr5PkGXDa1ad20RYhdJTubopY04i+Suk8b8g3Vtobu3kfMk48S0n5rQyAQeGBdg8WzL8gA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"clone-deep": "^4.0.1",
|
||||
"klona": "^1.1.1",
|
||||
"loader-utils": "^2.0.0",
|
||||
"neo-async": "^2.6.1",
|
||||
"schema-utils": "^2.7.0",
|
||||
@@ -8944,9 +8939,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "6.12.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz",
|
||||
"integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==",
|
||||
"version": "6.12.3",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
|
||||
"integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
@@ -9203,15 +9198,6 @@
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"shallow-clone": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
|
||||
"integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "^6.0.2"
|
||||
}
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"react-dom": "^16.2.0",
|
||||
"resolve-url-loader": "^3.1.0",
|
||||
"sass": "^1.26.9",
|
||||
"sass-loader": "^9.0.0"
|
||||
"sass-loader": "^9.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
|
||||
4
conf/site/public/css/main.css
vendored
4
conf/site/public/css/main.css
vendored
@@ -55,3 +55,7 @@
|
||||
.setting-card {
|
||||
height: 270px;
|
||||
}
|
||||
|
||||
.home-graph {
|
||||
height: 480px;
|
||||
}
|
||||
|
||||
2
conf/site/public/js/app.js
vendored
2
conf/site/public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -16,8 +16,16 @@ export default class HistoryGraph extends Component {
|
||||
duOptions: {},
|
||||
pingData: {},
|
||||
pingOptions: {},
|
||||
failData: {},
|
||||
failOptions: {},
|
||||
loading: true,
|
||||
interval: null,
|
||||
graph_ul_dl_enabled: true,
|
||||
graph_ul_dl_width: 6,
|
||||
graph_failure_enabled: true,
|
||||
graph_failure_width: 6,
|
||||
graph_ping_enabled: true,
|
||||
graph_ping_width: 6,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +37,7 @@ export default class HistoryGraph extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
getData = (days = this.state.days) => {
|
||||
getDLULPing = (days) => {
|
||||
var url = 'api/speedtest/time/' + days;
|
||||
|
||||
Axios.get(url)
|
||||
@@ -52,6 +60,7 @@ export default class HistoryGraph extends Component {
|
||||
],
|
||||
};
|
||||
var duOptions = {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
label: (item) => `${item.yLabel} Mbit/s`,
|
||||
@@ -90,6 +99,7 @@ export default class HistoryGraph extends Component {
|
||||
],
|
||||
};
|
||||
var pingOptions = {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
label: (item) => `${item.yLabel} ms`,
|
||||
@@ -149,6 +159,97 @@ export default class HistoryGraph extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
getFailure = (days) => {
|
||||
var url = 'api/speedtest/fail/' + days;
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
var failData = {
|
||||
labels: [],
|
||||
datasets:[
|
||||
{
|
||||
data: [],
|
||||
label: 'Failure',
|
||||
borderColor: "#E74C3C",
|
||||
fill: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
var failOptions = {
|
||||
maintainAspectRatio: false,
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
label: (item) => `${item.yLabel} %`,
|
||||
},
|
||||
},
|
||||
title: {
|
||||
display: false,
|
||||
text: 'Ping results for the last ' + days + ' days',
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
display: false,
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: 'DateTime'
|
||||
}
|
||||
}],
|
||||
},
|
||||
elements: {
|
||||
point:{
|
||||
radius: 0,
|
||||
hitRadius: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resp.data.data.forEach(e => {
|
||||
var date = new Date(e.date);
|
||||
var fail = {
|
||||
t: date,
|
||||
y: e.rate
|
||||
};
|
||||
failData.datasets[0].data.push(fail);
|
||||
failData.labels.push(date.getFullYear() + '/' + ('0' + (date.getMonth() + 1)).slice(-2) + '/' + ('0' + date.getDay()).slice(-2));
|
||||
});
|
||||
|
||||
this.setState({
|
||||
failData: failData,
|
||||
failOptions: failOptions
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
|
||||
getData = (days = this.state.days) => {
|
||||
Axios.get('api/settings/config')
|
||||
.then((resp) => {
|
||||
var data = resp.data;
|
||||
console.log(data)
|
||||
this.setState({
|
||||
graph_ul_dl_enabled: Boolean(Number(data.download_upload_graph_enabled.value)),
|
||||
graph_ul_dl_width: data.download_upload_graph_width.value,
|
||||
graph_ping_enabled: Boolean(Number(data.ping_graph_enabled.value)),
|
||||
graph_ping_width: data.ping_graph_width.value,
|
||||
graph_failure_enabled: Boolean(Number(data.failure_graph_enabled.value)),
|
||||
graph_failure_width: data.failure_graph_width.value,
|
||||
});
|
||||
|
||||
if(this.state.graph_ul_dl_enabled || this.state.graph_ping_enabled) {
|
||||
this.getDLULPing(days);
|
||||
}
|
||||
|
||||
if(this.state.graph_failure_enabled) {
|
||||
this.getFailure(days);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('Couldn\'t get the site config');
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
|
||||
updateDays = (e) => {
|
||||
var days = e.target.value;
|
||||
if(days) {
|
||||
@@ -169,8 +270,44 @@ export default class HistoryGraph extends Component {
|
||||
var duOptions = this.state.duOptions;
|
||||
var pingData = this.state.pingData;
|
||||
var pingOptions = this.state.pingOptions;
|
||||
var failData = this.state.failData;
|
||||
var failOptions = this.state.failOptions;
|
||||
var days = this.state.days;
|
||||
|
||||
console.log(failData);
|
||||
console.log(failOptions);
|
||||
console.log(pingData);
|
||||
console.log(pingOptions);
|
||||
|
||||
var graph_ul_dl_enabled = this.state.graph_ul_dl_enabled;
|
||||
var graph_ul_dl_width = this.state.graph_ul_dl_width;
|
||||
var graph_ping_enabled = this.state.graph_ping_enabled;
|
||||
var graph_ping_width = this.state.graph_ping_width;
|
||||
var graph_failure_enabled = this.state.graph_failure_enabled;
|
||||
var graph_failure_width = this.state.graph_failure_width;
|
||||
|
||||
var dlClasses = 'my-2 home-graph ';
|
||||
var pingClasses = 'my-2 home-graph ';
|
||||
var failureClasses = 'my-2 home-graph ';
|
||||
|
||||
if(graph_ul_dl_enabled == true) {
|
||||
//
|
||||
} else {
|
||||
dlClasses += 'd-none ';
|
||||
}
|
||||
|
||||
if(graph_ping_enabled == true) {
|
||||
//
|
||||
} else {
|
||||
pingClasses += 'd-none ';
|
||||
}
|
||||
|
||||
if(graph_failure_enabled == true) {
|
||||
//
|
||||
} else {
|
||||
failureClasses += 'd-none ';
|
||||
}
|
||||
|
||||
if(loading) {
|
||||
return (
|
||||
<div>
|
||||
@@ -180,31 +317,43 @@ export default class HistoryGraph extends Component {
|
||||
} else {
|
||||
return (
|
||||
<Container className="mb-4 mt-1" fluid>
|
||||
|
||||
<Row>
|
||||
<Col
|
||||
lg={{ span: 6 }}
|
||||
md={{ span: 12 }}
|
||||
lg={{ span: graph_ul_dl_width }}
|
||||
md={{ span: graph_ul_dl_width }}
|
||||
sm={{ span: 12 }}
|
||||
xs={{ span: 12 }}
|
||||
className="my-2"
|
||||
className={dlClasses}
|
||||
>
|
||||
<Card className="shadow-sm">
|
||||
<Card.Body>
|
||||
<Line data={duData} options={duOptions} />
|
||||
<Line data={duData} options={duOptions} height={440} />
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col
|
||||
lg={{ span: 6 }}
|
||||
md={{ span: 12 }}
|
||||
lg={{ span: graph_ping_width }}
|
||||
md={{ span: graph_ping_width }}
|
||||
sm={{ span: 12 }}
|
||||
xs={{ span: 12 }}
|
||||
className="my-2"
|
||||
className={pingClasses}
|
||||
>
|
||||
<Card className="shadow-sm">
|
||||
<Card.Body>
|
||||
<Line data={pingData} options={pingOptions} />
|
||||
<Line data={pingData} options={pingOptions} height={440} />
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col
|
||||
lg={{ span: graph_failure_width }}
|
||||
md={{ span: graph_failure_width }}
|
||||
sm={{ span: 12 }}
|
||||
xs={{ span: 12 }}
|
||||
className={failureClasses}
|
||||
>
|
||||
<Card className="shadow-sm">
|
||||
<Card.Body>
|
||||
<Line data={failData} options={pingOptions} height={440} />
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Col>
|
||||
@@ -217,7 +366,6 @@ export default class HistoryGraph extends Component {
|
||||
<Form.Control id="duDaysInput" className="d-inline-block mx-2" defaultValue={days} onInput={this.updateDays}></Form.Control>
|
||||
<h4 className="d-inline mb-0">days</h4>
|
||||
</div>
|
||||
{/* <p className="text-muted">This data refreshes every 10 seconds</p> */}
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -116,7 +116,7 @@ export default class SettingWithModal extends Component {
|
||||
<Row key={e.obj.id} className="d-flex align-items-center">
|
||||
<Col md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<Form.Group controlId={e.obj.name}>
|
||||
<Form.Check type="checkbox" label={name} defaultChecked={e.obj.value} onInput={this.updateValue} />
|
||||
<Form.Check type="checkbox" label={name} defaultChecked={Boolean(Number(e.obj.value))} onInput={this.updateValue} />
|
||||
</Form.Group>
|
||||
</Col>
|
||||
<Col md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
@@ -138,6 +138,26 @@ export default class SettingWithModal extends Component {
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
} else if(e.type == 'select') {
|
||||
return (
|
||||
<Row key={e.obj.id}>
|
||||
<Col md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<Form.Group controlId={e.obj.name}>
|
||||
<Form.Label>{name}</Form.Label>
|
||||
<Form.Control as="select" defaultValue={e.obj.value} onInput={this.updateValue}>
|
||||
{e.options.map((e,i) => {
|
||||
return (
|
||||
<option key={i} value={e.value}>{e.name}</option>
|
||||
)
|
||||
})}
|
||||
</Form.Control>
|
||||
</Form.Group>
|
||||
</Col>
|
||||
<Col md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<p>{e.obj.description}</p>
|
||||
</Col>
|
||||
</Row>
|
||||
)
|
||||
}
|
||||
})}
|
||||
<Button variant="primary" type="submit" onClick={this.update} >Save</Button>
|
||||
|
||||
@@ -60,6 +60,64 @@ export default class Settings extends Component {
|
||||
<Col lg={{ span: 4 }} md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<Setting name={e.server.name} value={e.server.value} description={e.server.description} />
|
||||
</Col>
|
||||
<Col lg={{ span: 4 }} md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<SettingWithModal title="Graph settings" description="Control settings for the graphs." settings={[
|
||||
{
|
||||
obj: e.download_upload_graph_enabled,
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
obj: e.download_upload_graph_width,
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
name: 'Full-width',
|
||||
'value': 12
|
||||
},
|
||||
{
|
||||
name: 'Half-width',
|
||||
'value': 6
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
obj: e.ping_graph_enabled,
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
obj: e.ping_graph_width,
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
name: 'Full-width',
|
||||
'value': 12
|
||||
},
|
||||
{
|
||||
name: 'Half-width',
|
||||
'value': 6
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
obj: e.failure_graph_enabled,
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
obj: e.failure_graph_width,
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
name: 'Full-width',
|
||||
'value': 12
|
||||
},
|
||||
{
|
||||
name: 'Half-width',
|
||||
'value': 6
|
||||
}
|
||||
],
|
||||
}
|
||||
]} />
|
||||
</Col>
|
||||
<Col lg={{ span: 4 }} md={{ span: 6 }} sm={{ span: 12 }}>
|
||||
<SettingWithModal title="Notification settings" description="Control which types of notifications the server sends." settings={[
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@ Route::group([
|
||||
->name('speedtest.latest');
|
||||
Route::get('time/{time}', 'SpeedtestController@time')
|
||||
->name('speedtest.time');
|
||||
Route::get('fail/{time}', 'SpeedtestController@fail')
|
||||
->name('speedtest.fail');
|
||||
Route::get('run', 'SpeedtestController@run')
|
||||
->name('speedtest.run');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user