Showing
610 changed files
with
4800 additions
and
0 deletions
LINE-js/app.js
0 → 100644
1 | +// 모듈을 읽어 들입니다. | ||
2 | +const request = require('request') | ||
3 | +// 요청을 위한 상수를 선언합니다: TOKEN은 자신의 것을 입력해주세요. | ||
4 | +const TARGET_URL = 'https://notify-api.line.me/api/notify' | ||
5 | +const TOKEN = 'u0JFOmNvNn80Ns9yY6WCiRLUiXCMv3CZ60YvkaDfy3A' | ||
6 | +// 요청합니다. | ||
7 | +request.post({ | ||
8 | + url: TARGET_URL, | ||
9 | + headers: { | ||
10 | + 'Authorization': `Bearer ${TOKEN}` | ||
11 | + }, | ||
12 | + form: { | ||
13 | + message: '안녕하세요. LINE Notify 테스트입니다.' | ||
14 | + } | ||
15 | +}, (error, response, body) => { | ||
16 | + // 요청 완료 | ||
17 | + console.log(body) | ||
18 | +}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
LINE-js/node_modules/.bin/sshpk-conv
0 → 100644
1 | +#!/bin/sh | ||
2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | + | ||
4 | +case `uname` in | ||
5 | + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | +esac | ||
7 | + | ||
8 | +if [ -x "$basedir/node" ]; then | ||
9 | + "$basedir/node" "$basedir/../sshpk/bin/sshpk-conv" "$@" | ||
10 | + ret=$? | ||
11 | +else | ||
12 | + node "$basedir/../sshpk/bin/sshpk-conv" "$@" | ||
13 | + ret=$? | ||
14 | +fi | ||
15 | +exit $ret |
LINE-js/node_modules/.bin/sshpk-conv.cmd
0 → 100644
1 | +@ECHO off | ||
2 | +SETLOCAL | ||
3 | +CALL :find_dp0 | ||
4 | + | ||
5 | +IF EXIST "%dp0%\node.exe" ( | ||
6 | + SET "_prog=%dp0%\node.exe" | ||
7 | +) ELSE ( | ||
8 | + SET "_prog=node" | ||
9 | + SET PATHEXT=%PATHEXT:;.JS;=;% | ||
10 | +) | ||
11 | + | ||
12 | +"%_prog%" "%dp0%\..\sshpk\bin\sshpk-conv" %* | ||
13 | +ENDLOCAL | ||
14 | +EXIT /b %errorlevel% | ||
15 | +:find_dp0 | ||
16 | +SET dp0=%~dp0 | ||
17 | +EXIT /b |
LINE-js/node_modules/.bin/sshpk-conv.ps1
0 → 100644
1 | +#!/usr/bin/env pwsh | ||
2 | +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent | ||
3 | + | ||
4 | +$exe="" | ||
5 | +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { | ||
6 | + # Fix case when both the Windows and Linux builds of Node | ||
7 | + # are installed in the same directory | ||
8 | + $exe=".exe" | ||
9 | +} | ||
10 | +$ret=0 | ||
11 | +if (Test-Path "$basedir/node$exe") { | ||
12 | + & "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args | ||
13 | + $ret=$LASTEXITCODE | ||
14 | +} else { | ||
15 | + & "node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args | ||
16 | + $ret=$LASTEXITCODE | ||
17 | +} | ||
18 | +exit $ret |
LINE-js/node_modules/.bin/sshpk-sign
0 → 100644
1 | +#!/bin/sh | ||
2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | + | ||
4 | +case `uname` in | ||
5 | + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | +esac | ||
7 | + | ||
8 | +if [ -x "$basedir/node" ]; then | ||
9 | + "$basedir/node" "$basedir/../sshpk/bin/sshpk-sign" "$@" | ||
10 | + ret=$? | ||
11 | +else | ||
12 | + node "$basedir/../sshpk/bin/sshpk-sign" "$@" | ||
13 | + ret=$? | ||
14 | +fi | ||
15 | +exit $ret |
LINE-js/node_modules/.bin/sshpk-sign.cmd
0 → 100644
1 | +@ECHO off | ||
2 | +SETLOCAL | ||
3 | +CALL :find_dp0 | ||
4 | + | ||
5 | +IF EXIST "%dp0%\node.exe" ( | ||
6 | + SET "_prog=%dp0%\node.exe" | ||
7 | +) ELSE ( | ||
8 | + SET "_prog=node" | ||
9 | + SET PATHEXT=%PATHEXT:;.JS;=;% | ||
10 | +) | ||
11 | + | ||
12 | +"%_prog%" "%dp0%\..\sshpk\bin\sshpk-sign" %* | ||
13 | +ENDLOCAL | ||
14 | +EXIT /b %errorlevel% | ||
15 | +:find_dp0 | ||
16 | +SET dp0=%~dp0 | ||
17 | +EXIT /b |
LINE-js/node_modules/.bin/sshpk-sign.ps1
0 → 100644
1 | +#!/usr/bin/env pwsh | ||
2 | +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent | ||
3 | + | ||
4 | +$exe="" | ||
5 | +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { | ||
6 | + # Fix case when both the Windows and Linux builds of Node | ||
7 | + # are installed in the same directory | ||
8 | + $exe=".exe" | ||
9 | +} | ||
10 | +$ret=0 | ||
11 | +if (Test-Path "$basedir/node$exe") { | ||
12 | + & "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args | ||
13 | + $ret=$LASTEXITCODE | ||
14 | +} else { | ||
15 | + & "node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args | ||
16 | + $ret=$LASTEXITCODE | ||
17 | +} | ||
18 | +exit $ret |
LINE-js/node_modules/.bin/sshpk-verify
0 → 100644
1 | +#!/bin/sh | ||
2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | + | ||
4 | +case `uname` in | ||
5 | + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | +esac | ||
7 | + | ||
8 | +if [ -x "$basedir/node" ]; then | ||
9 | + "$basedir/node" "$basedir/../sshpk/bin/sshpk-verify" "$@" | ||
10 | + ret=$? | ||
11 | +else | ||
12 | + node "$basedir/../sshpk/bin/sshpk-verify" "$@" | ||
13 | + ret=$? | ||
14 | +fi | ||
15 | +exit $ret |
LINE-js/node_modules/.bin/sshpk-verify.cmd
0 → 100644
1 | +@ECHO off | ||
2 | +SETLOCAL | ||
3 | +CALL :find_dp0 | ||
4 | + | ||
5 | +IF EXIST "%dp0%\node.exe" ( | ||
6 | + SET "_prog=%dp0%\node.exe" | ||
7 | +) ELSE ( | ||
8 | + SET "_prog=node" | ||
9 | + SET PATHEXT=%PATHEXT:;.JS;=;% | ||
10 | +) | ||
11 | + | ||
12 | +"%_prog%" "%dp0%\..\sshpk\bin\sshpk-verify" %* | ||
13 | +ENDLOCAL | ||
14 | +EXIT /b %errorlevel% | ||
15 | +:find_dp0 | ||
16 | +SET dp0=%~dp0 | ||
17 | +EXIT /b |
LINE-js/node_modules/.bin/sshpk-verify.ps1
0 → 100644
1 | +#!/usr/bin/env pwsh | ||
2 | +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent | ||
3 | + | ||
4 | +$exe="" | ||
5 | +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { | ||
6 | + # Fix case when both the Windows and Linux builds of Node | ||
7 | + # are installed in the same directory | ||
8 | + $exe=".exe" | ||
9 | +} | ||
10 | +$ret=0 | ||
11 | +if (Test-Path "$basedir/node$exe") { | ||
12 | + & "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args | ||
13 | + $ret=$LASTEXITCODE | ||
14 | +} else { | ||
15 | + & "node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args | ||
16 | + $ret=$LASTEXITCODE | ||
17 | +} | ||
18 | +exit $ret |
LINE-js/node_modules/.bin/uuid
0 → 100644
1 | +#!/bin/sh | ||
2 | +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | + | ||
4 | +case `uname` in | ||
5 | + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | +esac | ||
7 | + | ||
8 | +if [ -x "$basedir/node" ]; then | ||
9 | + "$basedir/node" "$basedir/../uuid/bin/uuid" "$@" | ||
10 | + ret=$? | ||
11 | +else | ||
12 | + node "$basedir/../uuid/bin/uuid" "$@" | ||
13 | + ret=$? | ||
14 | +fi | ||
15 | +exit $ret |
LINE-js/node_modules/.bin/uuid.cmd
0 → 100644
1 | +@ECHO off | ||
2 | +SETLOCAL | ||
3 | +CALL :find_dp0 | ||
4 | + | ||
5 | +IF EXIST "%dp0%\node.exe" ( | ||
6 | + SET "_prog=%dp0%\node.exe" | ||
7 | +) ELSE ( | ||
8 | + SET "_prog=node" | ||
9 | + SET PATHEXT=%PATHEXT:;.JS;=;% | ||
10 | +) | ||
11 | + | ||
12 | +"%_prog%" "%dp0%\..\uuid\bin\uuid" %* | ||
13 | +ENDLOCAL | ||
14 | +EXIT /b %errorlevel% | ||
15 | +:find_dp0 | ||
16 | +SET dp0=%~dp0 | ||
17 | +EXIT /b |
LINE-js/node_modules/.bin/uuid.ps1
0 → 100644
1 | +#!/usr/bin/env pwsh | ||
2 | +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent | ||
3 | + | ||
4 | +$exe="" | ||
5 | +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { | ||
6 | + # Fix case when both the Windows and Linux builds of Node | ||
7 | + # are installed in the same directory | ||
8 | + $exe=".exe" | ||
9 | +} | ||
10 | +$ret=0 | ||
11 | +if (Test-Path "$basedir/node$exe") { | ||
12 | + & "$basedir/node$exe" "$basedir/../uuid/bin/uuid" $args | ||
13 | + $ret=$LASTEXITCODE | ||
14 | +} else { | ||
15 | + & "node$exe" "$basedir/../uuid/bin/uuid" $args | ||
16 | + $ret=$LASTEXITCODE | ||
17 | +} | ||
18 | +exit $ret |
LINE-js/node_modules/ajv/.tonic_example.js
0 → 100644
1 | +var Ajv = require('ajv'); | ||
2 | +var ajv = new Ajv({allErrors: true}); | ||
3 | + | ||
4 | +var schema = { | ||
5 | + "properties": { | ||
6 | + "foo": { "type": "string" }, | ||
7 | + "bar": { "type": "number", "maximum": 3 } | ||
8 | + } | ||
9 | +}; | ||
10 | + | ||
11 | +var validate = ajv.compile(schema); | ||
12 | + | ||
13 | +test({"foo": "abc", "bar": 2}); | ||
14 | +test({"foo": 2, "bar": 4}); | ||
15 | + | ||
16 | +function test(data) { | ||
17 | + var valid = validate(data); | ||
18 | + if (valid) console.log('Valid!'); | ||
19 | + else console.log('Invalid: ' + ajv.errorsText(validate.errors)); | ||
20 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
LINE-js/node_modules/ajv/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2015-2017 Evgeny Poberezkin | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | +of this software and associated documentation files (the "Software"), to deal | ||
7 | +in the Software without restriction, including without limitation the rights | ||
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | +copies of the Software, and to permit persons to whom the Software is | ||
10 | +furnished to do so, subject to the following conditions: | ||
11 | + | ||
12 | +The above copyright notice and this permission notice shall be included in all | ||
13 | +copies or substantial portions of the Software. | ||
14 | + | ||
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | +SOFTWARE. | ||
22 | + |
LINE-js/node_modules/ajv/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/dist/ajv.bundle.js
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/ajv/dist/ajv.min.js
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/ajv/dist/ajv.min.js.map
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/ajv/lib/ajv.d.ts
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/ajv.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/cache.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | + | ||
4 | +var Cache = module.exports = function Cache() { | ||
5 | + this._cache = {}; | ||
6 | +}; | ||
7 | + | ||
8 | + | ||
9 | +Cache.prototype.put = function Cache_put(key, value) { | ||
10 | + this._cache[key] = value; | ||
11 | +}; | ||
12 | + | ||
13 | + | ||
14 | +Cache.prototype.get = function Cache_get(key) { | ||
15 | + return this._cache[key]; | ||
16 | +}; | ||
17 | + | ||
18 | + | ||
19 | +Cache.prototype.del = function Cache_del(key) { | ||
20 | + delete this._cache[key]; | ||
21 | +}; | ||
22 | + | ||
23 | + | ||
24 | +Cache.prototype.clear = function Cache_clear() { | ||
25 | + this._cache = {}; | ||
26 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var MissingRefError = require('./error_classes').MissingRef; | ||
4 | + | ||
5 | +module.exports = compileAsync; | ||
6 | + | ||
7 | + | ||
8 | +/** | ||
9 | + * Creates validating function for passed schema with asynchronous loading of missing schemas. | ||
10 | + * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. | ||
11 | + * @this Ajv | ||
12 | + * @param {Object} schema schema object | ||
13 | + * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped | ||
14 | + * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function. | ||
15 | + * @return {Promise} promise that resolves with a validating function. | ||
16 | + */ | ||
17 | +function compileAsync(schema, meta, callback) { | ||
18 | + /* eslint no-shadow: 0 */ | ||
19 | + /* global Promise */ | ||
20 | + /* jshint validthis: true */ | ||
21 | + var self = this; | ||
22 | + if (typeof this._opts.loadSchema != 'function') | ||
23 | + throw new Error('options.loadSchema should be a function'); | ||
24 | + | ||
25 | + if (typeof meta == 'function') { | ||
26 | + callback = meta; | ||
27 | + meta = undefined; | ||
28 | + } | ||
29 | + | ||
30 | + var p = loadMetaSchemaOf(schema).then(function () { | ||
31 | + var schemaObj = self._addSchema(schema, undefined, meta); | ||
32 | + return schemaObj.validate || _compileAsync(schemaObj); | ||
33 | + }); | ||
34 | + | ||
35 | + if (callback) { | ||
36 | + p.then( | ||
37 | + function(v) { callback(null, v); }, | ||
38 | + callback | ||
39 | + ); | ||
40 | + } | ||
41 | + | ||
42 | + return p; | ||
43 | + | ||
44 | + | ||
45 | + function loadMetaSchemaOf(sch) { | ||
46 | + var $schema = sch.$schema; | ||
47 | + return $schema && !self.getSchema($schema) | ||
48 | + ? compileAsync.call(self, { $ref: $schema }, true) | ||
49 | + : Promise.resolve(); | ||
50 | + } | ||
51 | + | ||
52 | + | ||
53 | + function _compileAsync(schemaObj) { | ||
54 | + try { return self._compile(schemaObj); } | ||
55 | + catch(e) { | ||
56 | + if (e instanceof MissingRefError) return loadMissingSchema(e); | ||
57 | + throw e; | ||
58 | + } | ||
59 | + | ||
60 | + | ||
61 | + function loadMissingSchema(e) { | ||
62 | + var ref = e.missingSchema; | ||
63 | + if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved'); | ||
64 | + | ||
65 | + var schemaPromise = self._loadingSchemas[ref]; | ||
66 | + if (!schemaPromise) { | ||
67 | + schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref); | ||
68 | + schemaPromise.then(removePromise, removePromise); | ||
69 | + } | ||
70 | + | ||
71 | + return schemaPromise.then(function (sch) { | ||
72 | + if (!added(ref)) { | ||
73 | + return loadMetaSchemaOf(sch).then(function () { | ||
74 | + if (!added(ref)) self.addSchema(sch, ref, undefined, meta); | ||
75 | + }); | ||
76 | + } | ||
77 | + }).then(function() { | ||
78 | + return _compileAsync(schemaObj); | ||
79 | + }); | ||
80 | + | ||
81 | + function removePromise() { | ||
82 | + delete self._loadingSchemas[ref]; | ||
83 | + } | ||
84 | + | ||
85 | + function added(ref) { | ||
86 | + return self._refs[ref] || self._schemas[ref]; | ||
87 | + } | ||
88 | + } | ||
89 | + } | ||
90 | +} |
1 | +'use strict'; | ||
2 | + | ||
3 | +var resolve = require('./resolve'); | ||
4 | + | ||
5 | +module.exports = { | ||
6 | + Validation: errorSubclass(ValidationError), | ||
7 | + MissingRef: errorSubclass(MissingRefError) | ||
8 | +}; | ||
9 | + | ||
10 | + | ||
11 | +function ValidationError(errors) { | ||
12 | + this.message = 'validation failed'; | ||
13 | + this.errors = errors; | ||
14 | + this.ajv = this.validation = true; | ||
15 | +} | ||
16 | + | ||
17 | + | ||
18 | +MissingRefError.message = function (baseId, ref) { | ||
19 | + return 'can\'t resolve reference ' + ref + ' from id ' + baseId; | ||
20 | +}; | ||
21 | + | ||
22 | + | ||
23 | +function MissingRefError(baseId, ref, message) { | ||
24 | + this.message = message || MissingRefError.message(baseId, ref); | ||
25 | + this.missingRef = resolve.url(baseId, ref); | ||
26 | + this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef)); | ||
27 | +} | ||
28 | + | ||
29 | + | ||
30 | +function errorSubclass(Subclass) { | ||
31 | + Subclass.prototype = Object.create(Error.prototype); | ||
32 | + Subclass.prototype.constructor = Subclass; | ||
33 | + return Subclass; | ||
34 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +'use strict'; | ||
2 | + | ||
3 | +var URI = require('uri-js') | ||
4 | + , equal = require('fast-deep-equal') | ||
5 | + , util = require('./util') | ||
6 | + , SchemaObject = require('./schema_obj') | ||
7 | + , traverse = require('json-schema-traverse'); | ||
8 | + | ||
9 | +module.exports = resolve; | ||
10 | + | ||
11 | +resolve.normalizeId = normalizeId; | ||
12 | +resolve.fullPath = getFullPath; | ||
13 | +resolve.url = resolveUrl; | ||
14 | +resolve.ids = resolveIds; | ||
15 | +resolve.inlineRef = inlineRef; | ||
16 | +resolve.schema = resolveSchema; | ||
17 | + | ||
18 | +/** | ||
19 | + * [resolve and compile the references ($ref)] | ||
20 | + * @this Ajv | ||
21 | + * @param {Function} compile reference to schema compilation funciton (localCompile) | ||
22 | + * @param {Object} root object with information about the root schema for the current schema | ||
23 | + * @param {String} ref reference to resolve | ||
24 | + * @return {Object|Function} schema object (if the schema can be inlined) or validation function | ||
25 | + */ | ||
26 | +function resolve(compile, root, ref) { | ||
27 | + /* jshint validthis: true */ | ||
28 | + var refVal = this._refs[ref]; | ||
29 | + if (typeof refVal == 'string') { | ||
30 | + if (this._refs[refVal]) refVal = this._refs[refVal]; | ||
31 | + else return resolve.call(this, compile, root, refVal); | ||
32 | + } | ||
33 | + | ||
34 | + refVal = refVal || this._schemas[ref]; | ||
35 | + if (refVal instanceof SchemaObject) { | ||
36 | + return inlineRef(refVal.schema, this._opts.inlineRefs) | ||
37 | + ? refVal.schema | ||
38 | + : refVal.validate || this._compile(refVal); | ||
39 | + } | ||
40 | + | ||
41 | + var res = resolveSchema.call(this, root, ref); | ||
42 | + var schema, v, baseId; | ||
43 | + if (res) { | ||
44 | + schema = res.schema; | ||
45 | + root = res.root; | ||
46 | + baseId = res.baseId; | ||
47 | + } | ||
48 | + | ||
49 | + if (schema instanceof SchemaObject) { | ||
50 | + v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId); | ||
51 | + } else if (schema !== undefined) { | ||
52 | + v = inlineRef(schema, this._opts.inlineRefs) | ||
53 | + ? schema | ||
54 | + : compile.call(this, schema, root, undefined, baseId); | ||
55 | + } | ||
56 | + | ||
57 | + return v; | ||
58 | +} | ||
59 | + | ||
60 | + | ||
61 | +/** | ||
62 | + * Resolve schema, its root and baseId | ||
63 | + * @this Ajv | ||
64 | + * @param {Object} root root object with properties schema, refVal, refs | ||
65 | + * @param {String} ref reference to resolve | ||
66 | + * @return {Object} object with properties schema, root, baseId | ||
67 | + */ | ||
68 | +function resolveSchema(root, ref) { | ||
69 | + /* jshint validthis: true */ | ||
70 | + var p = URI.parse(ref) | ||
71 | + , refPath = _getFullPath(p) | ||
72 | + , baseId = getFullPath(this._getId(root.schema)); | ||
73 | + if (Object.keys(root.schema).length === 0 || refPath !== baseId) { | ||
74 | + var id = normalizeId(refPath); | ||
75 | + var refVal = this._refs[id]; | ||
76 | + if (typeof refVal == 'string') { | ||
77 | + return resolveRecursive.call(this, root, refVal, p); | ||
78 | + } else if (refVal instanceof SchemaObject) { | ||
79 | + if (!refVal.validate) this._compile(refVal); | ||
80 | + root = refVal; | ||
81 | + } else { | ||
82 | + refVal = this._schemas[id]; | ||
83 | + if (refVal instanceof SchemaObject) { | ||
84 | + if (!refVal.validate) this._compile(refVal); | ||
85 | + if (id == normalizeId(ref)) | ||
86 | + return { schema: refVal, root: root, baseId: baseId }; | ||
87 | + root = refVal; | ||
88 | + } else { | ||
89 | + return; | ||
90 | + } | ||
91 | + } | ||
92 | + if (!root.schema) return; | ||
93 | + baseId = getFullPath(this._getId(root.schema)); | ||
94 | + } | ||
95 | + return getJsonPointer.call(this, p, baseId, root.schema, root); | ||
96 | +} | ||
97 | + | ||
98 | + | ||
99 | +/* @this Ajv */ | ||
100 | +function resolveRecursive(root, ref, parsedRef) { | ||
101 | + /* jshint validthis: true */ | ||
102 | + var res = resolveSchema.call(this, root, ref); | ||
103 | + if (res) { | ||
104 | + var schema = res.schema; | ||
105 | + var baseId = res.baseId; | ||
106 | + root = res.root; | ||
107 | + var id = this._getId(schema); | ||
108 | + if (id) baseId = resolveUrl(baseId, id); | ||
109 | + return getJsonPointer.call(this, parsedRef, baseId, schema, root); | ||
110 | + } | ||
111 | +} | ||
112 | + | ||
113 | + | ||
114 | +var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']); | ||
115 | +/* @this Ajv */ | ||
116 | +function getJsonPointer(parsedRef, baseId, schema, root) { | ||
117 | + /* jshint validthis: true */ | ||
118 | + parsedRef.fragment = parsedRef.fragment || ''; | ||
119 | + if (parsedRef.fragment.slice(0,1) != '/') return; | ||
120 | + var parts = parsedRef.fragment.split('/'); | ||
121 | + | ||
122 | + for (var i = 1; i < parts.length; i++) { | ||
123 | + var part = parts[i]; | ||
124 | + if (part) { | ||
125 | + part = util.unescapeFragment(part); | ||
126 | + schema = schema[part]; | ||
127 | + if (schema === undefined) break; | ||
128 | + var id; | ||
129 | + if (!PREVENT_SCOPE_CHANGE[part]) { | ||
130 | + id = this._getId(schema); | ||
131 | + if (id) baseId = resolveUrl(baseId, id); | ||
132 | + if (schema.$ref) { | ||
133 | + var $ref = resolveUrl(baseId, schema.$ref); | ||
134 | + var res = resolveSchema.call(this, root, $ref); | ||
135 | + if (res) { | ||
136 | + schema = res.schema; | ||
137 | + root = res.root; | ||
138 | + baseId = res.baseId; | ||
139 | + } | ||
140 | + } | ||
141 | + } | ||
142 | + } | ||
143 | + } | ||
144 | + if (schema !== undefined && schema !== root.schema) | ||
145 | + return { schema: schema, root: root, baseId: baseId }; | ||
146 | +} | ||
147 | + | ||
148 | + | ||
149 | +var SIMPLE_INLINED = util.toHash([ | ||
150 | + 'type', 'format', 'pattern', | ||
151 | + 'maxLength', 'minLength', | ||
152 | + 'maxProperties', 'minProperties', | ||
153 | + 'maxItems', 'minItems', | ||
154 | + 'maximum', 'minimum', | ||
155 | + 'uniqueItems', 'multipleOf', | ||
156 | + 'required', 'enum' | ||
157 | +]); | ||
158 | +function inlineRef(schema, limit) { | ||
159 | + if (limit === false) return false; | ||
160 | + if (limit === undefined || limit === true) return checkNoRef(schema); | ||
161 | + else if (limit) return countKeys(schema) <= limit; | ||
162 | +} | ||
163 | + | ||
164 | + | ||
165 | +function checkNoRef(schema) { | ||
166 | + var item; | ||
167 | + if (Array.isArray(schema)) { | ||
168 | + for (var i=0; i<schema.length; i++) { | ||
169 | + item = schema[i]; | ||
170 | + if (typeof item == 'object' && !checkNoRef(item)) return false; | ||
171 | + } | ||
172 | + } else { | ||
173 | + for (var key in schema) { | ||
174 | + if (key == '$ref') return false; | ||
175 | + item = schema[key]; | ||
176 | + if (typeof item == 'object' && !checkNoRef(item)) return false; | ||
177 | + } | ||
178 | + } | ||
179 | + return true; | ||
180 | +} | ||
181 | + | ||
182 | + | ||
183 | +function countKeys(schema) { | ||
184 | + var count = 0, item; | ||
185 | + if (Array.isArray(schema)) { | ||
186 | + for (var i=0; i<schema.length; i++) { | ||
187 | + item = schema[i]; | ||
188 | + if (typeof item == 'object') count += countKeys(item); | ||
189 | + if (count == Infinity) return Infinity; | ||
190 | + } | ||
191 | + } else { | ||
192 | + for (var key in schema) { | ||
193 | + if (key == '$ref') return Infinity; | ||
194 | + if (SIMPLE_INLINED[key]) { | ||
195 | + count++; | ||
196 | + } else { | ||
197 | + item = schema[key]; | ||
198 | + if (typeof item == 'object') count += countKeys(item) + 1; | ||
199 | + if (count == Infinity) return Infinity; | ||
200 | + } | ||
201 | + } | ||
202 | + } | ||
203 | + return count; | ||
204 | +} | ||
205 | + | ||
206 | + | ||
207 | +function getFullPath(id, normalize) { | ||
208 | + if (normalize !== false) id = normalizeId(id); | ||
209 | + var p = URI.parse(id); | ||
210 | + return _getFullPath(p); | ||
211 | +} | ||
212 | + | ||
213 | + | ||
214 | +function _getFullPath(p) { | ||
215 | + return URI.serialize(p).split('#')[0] + '#'; | ||
216 | +} | ||
217 | + | ||
218 | + | ||
219 | +var TRAILING_SLASH_HASH = /#\/?$/; | ||
220 | +function normalizeId(id) { | ||
221 | + return id ? id.replace(TRAILING_SLASH_HASH, '') : ''; | ||
222 | +} | ||
223 | + | ||
224 | + | ||
225 | +function resolveUrl(baseId, id) { | ||
226 | + id = normalizeId(id); | ||
227 | + return URI.resolve(baseId, id); | ||
228 | +} | ||
229 | + | ||
230 | + | ||
231 | +/* @this Ajv */ | ||
232 | +function resolveIds(schema) { | ||
233 | + var schemaId = normalizeId(this._getId(schema)); | ||
234 | + var baseIds = {'': schemaId}; | ||
235 | + var fullPaths = {'': getFullPath(schemaId, false)}; | ||
236 | + var localRefs = {}; | ||
237 | + var self = this; | ||
238 | + | ||
239 | + traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { | ||
240 | + if (jsonPtr === '') return; | ||
241 | + var id = self._getId(sch); | ||
242 | + var baseId = baseIds[parentJsonPtr]; | ||
243 | + var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword; | ||
244 | + if (keyIndex !== undefined) | ||
245 | + fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex)); | ||
246 | + | ||
247 | + if (typeof id == 'string') { | ||
248 | + id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id); | ||
249 | + | ||
250 | + var refVal = self._refs[id]; | ||
251 | + if (typeof refVal == 'string') refVal = self._refs[refVal]; | ||
252 | + if (refVal && refVal.schema) { | ||
253 | + if (!equal(sch, refVal.schema)) | ||
254 | + throw new Error('id "' + id + '" resolves to more than one schema'); | ||
255 | + } else if (id != normalizeId(fullPath)) { | ||
256 | + if (id[0] == '#') { | ||
257 | + if (localRefs[id] && !equal(sch, localRefs[id])) | ||
258 | + throw new Error('id "' + id + '" resolves to more than one schema'); | ||
259 | + localRefs[id] = sch; | ||
260 | + } else { | ||
261 | + self._refs[id] = fullPath; | ||
262 | + } | ||
263 | + } | ||
264 | + } | ||
265 | + baseIds[jsonPtr] = baseId; | ||
266 | + fullPaths[jsonPtr] = fullPath; | ||
267 | + }); | ||
268 | + | ||
269 | + return localRefs; | ||
270 | +} |
1 | +'use strict'; | ||
2 | + | ||
3 | +var ruleModules = require('../dotjs') | ||
4 | + , toHash = require('./util').toHash; | ||
5 | + | ||
6 | +module.exports = function rules() { | ||
7 | + var RULES = [ | ||
8 | + { type: 'number', | ||
9 | + rules: [ { 'maximum': ['exclusiveMaximum'] }, | ||
10 | + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, | ||
11 | + { type: 'string', | ||
12 | + rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, | ||
13 | + { type: 'array', | ||
14 | + rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] }, | ||
15 | + { type: 'object', | ||
16 | + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', | ||
17 | + { 'properties': ['additionalProperties', 'patternProperties'] } ] }, | ||
18 | + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] } | ||
19 | + ]; | ||
20 | + | ||
21 | + var ALL = [ 'type', '$comment' ]; | ||
22 | + var KEYWORDS = [ | ||
23 | + '$schema', '$id', 'id', '$data', '$async', 'title', | ||
24 | + 'description', 'default', 'definitions', | ||
25 | + 'examples', 'readOnly', 'writeOnly', | ||
26 | + 'contentMediaType', 'contentEncoding', | ||
27 | + 'additionalItems', 'then', 'else' | ||
28 | + ]; | ||
29 | + var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; | ||
30 | + RULES.all = toHash(ALL); | ||
31 | + RULES.types = toHash(TYPES); | ||
32 | + | ||
33 | + RULES.forEach(function (group) { | ||
34 | + group.rules = group.rules.map(function (keyword) { | ||
35 | + var implKeywords; | ||
36 | + if (typeof keyword == 'object') { | ||
37 | + var key = Object.keys(keyword)[0]; | ||
38 | + implKeywords = keyword[key]; | ||
39 | + keyword = key; | ||
40 | + implKeywords.forEach(function (k) { | ||
41 | + ALL.push(k); | ||
42 | + RULES.all[k] = true; | ||
43 | + }); | ||
44 | + } | ||
45 | + ALL.push(keyword); | ||
46 | + var rule = RULES.all[keyword] = { | ||
47 | + keyword: keyword, | ||
48 | + code: ruleModules[keyword], | ||
49 | + implements: implKeywords | ||
50 | + }; | ||
51 | + return rule; | ||
52 | + }); | ||
53 | + | ||
54 | + RULES.all.$comment = { | ||
55 | + keyword: '$comment', | ||
56 | + code: ruleModules.$comment | ||
57 | + }; | ||
58 | + | ||
59 | + if (group.type) RULES.types[group.type] = group; | ||
60 | + }); | ||
61 | + | ||
62 | + RULES.keywords = toHash(ALL.concat(KEYWORDS)); | ||
63 | + RULES.custom = {}; | ||
64 | + | ||
65 | + return RULES; | ||
66 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +// https://mathiasbynens.be/notes/javascript-encoding | ||
4 | +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode | ||
5 | +module.exports = function ucs2length(str) { | ||
6 | + var length = 0 | ||
7 | + , len = str.length | ||
8 | + , pos = 0 | ||
9 | + , value; | ||
10 | + while (pos < len) { | ||
11 | + length++; | ||
12 | + value = str.charCodeAt(pos++); | ||
13 | + if (value >= 0xD800 && value <= 0xDBFF && pos < len) { | ||
14 | + // high surrogate, and there is a next character | ||
15 | + value = str.charCodeAt(pos); | ||
16 | + if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate | ||
17 | + } | ||
18 | + } | ||
19 | + return length; | ||
20 | +}; |
LINE-js/node_modules/ajv/lib/compile/util.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | + | ||
4 | +module.exports = { | ||
5 | + copy: copy, | ||
6 | + checkDataType: checkDataType, | ||
7 | + checkDataTypes: checkDataTypes, | ||
8 | + coerceToTypes: coerceToTypes, | ||
9 | + toHash: toHash, | ||
10 | + getProperty: getProperty, | ||
11 | + escapeQuotes: escapeQuotes, | ||
12 | + equal: require('fast-deep-equal'), | ||
13 | + ucs2length: require('./ucs2length'), | ||
14 | + varOccurences: varOccurences, | ||
15 | + varReplace: varReplace, | ||
16 | + cleanUpCode: cleanUpCode, | ||
17 | + finalCleanUpCode: finalCleanUpCode, | ||
18 | + schemaHasRules: schemaHasRules, | ||
19 | + schemaHasRulesExcept: schemaHasRulesExcept, | ||
20 | + schemaUnknownRules: schemaUnknownRules, | ||
21 | + toQuotedString: toQuotedString, | ||
22 | + getPathExpr: getPathExpr, | ||
23 | + getPath: getPath, | ||
24 | + getData: getData, | ||
25 | + unescapeFragment: unescapeFragment, | ||
26 | + unescapeJsonPointer: unescapeJsonPointer, | ||
27 | + escapeFragment: escapeFragment, | ||
28 | + escapeJsonPointer: escapeJsonPointer | ||
29 | +}; | ||
30 | + | ||
31 | + | ||
32 | +function copy(o, to) { | ||
33 | + to = to || {}; | ||
34 | + for (var key in o) to[key] = o[key]; | ||
35 | + return to; | ||
36 | +} | ||
37 | + | ||
38 | + | ||
39 | +function checkDataType(dataType, data, negate) { | ||
40 | + var EQUAL = negate ? ' !== ' : ' === ' | ||
41 | + , AND = negate ? ' || ' : ' && ' | ||
42 | + , OK = negate ? '!' : '' | ||
43 | + , NOT = negate ? '' : '!'; | ||
44 | + switch (dataType) { | ||
45 | + case 'null': return data + EQUAL + 'null'; | ||
46 | + case 'array': return OK + 'Array.isArray(' + data + ')'; | ||
47 | + case 'object': return '(' + OK + data + AND + | ||
48 | + 'typeof ' + data + EQUAL + '"object"' + AND + | ||
49 | + NOT + 'Array.isArray(' + data + '))'; | ||
50 | + case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + | ||
51 | + NOT + '(' + data + ' % 1)' + | ||
52 | + AND + data + EQUAL + data + ')'; | ||
53 | + default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; | ||
54 | + } | ||
55 | +} | ||
56 | + | ||
57 | + | ||
58 | +function checkDataTypes(dataTypes, data) { | ||
59 | + switch (dataTypes.length) { | ||
60 | + case 1: return checkDataType(dataTypes[0], data, true); | ||
61 | + default: | ||
62 | + var code = ''; | ||
63 | + var types = toHash(dataTypes); | ||
64 | + if (types.array && types.object) { | ||
65 | + code = types.null ? '(': '(!' + data + ' || '; | ||
66 | + code += 'typeof ' + data + ' !== "object")'; | ||
67 | + delete types.null; | ||
68 | + delete types.array; | ||
69 | + delete types.object; | ||
70 | + } | ||
71 | + if (types.number) delete types.integer; | ||
72 | + for (var t in types) | ||
73 | + code += (code ? ' && ' : '' ) + checkDataType(t, data, true); | ||
74 | + | ||
75 | + return code; | ||
76 | + } | ||
77 | +} | ||
78 | + | ||
79 | + | ||
80 | +var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); | ||
81 | +function coerceToTypes(optionCoerceTypes, dataTypes) { | ||
82 | + if (Array.isArray(dataTypes)) { | ||
83 | + var types = []; | ||
84 | + for (var i=0; i<dataTypes.length; i++) { | ||
85 | + var t = dataTypes[i]; | ||
86 | + if (COERCE_TO_TYPES[t]) types[types.length] = t; | ||
87 | + else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t; | ||
88 | + } | ||
89 | + if (types.length) return types; | ||
90 | + } else if (COERCE_TO_TYPES[dataTypes]) { | ||
91 | + return [dataTypes]; | ||
92 | + } else if (optionCoerceTypes === 'array' && dataTypes === 'array') { | ||
93 | + return ['array']; | ||
94 | + } | ||
95 | +} | ||
96 | + | ||
97 | + | ||
98 | +function toHash(arr) { | ||
99 | + var hash = {}; | ||
100 | + for (var i=0; i<arr.length; i++) hash[arr[i]] = true; | ||
101 | + return hash; | ||
102 | +} | ||
103 | + | ||
104 | + | ||
105 | +var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; | ||
106 | +var SINGLE_QUOTE = /'|\\/g; | ||
107 | +function getProperty(key) { | ||
108 | + return typeof key == 'number' | ||
109 | + ? '[' + key + ']' | ||
110 | + : IDENTIFIER.test(key) | ||
111 | + ? '.' + key | ||
112 | + : "['" + escapeQuotes(key) + "']"; | ||
113 | +} | ||
114 | + | ||
115 | + | ||
116 | +function escapeQuotes(str) { | ||
117 | + return str.replace(SINGLE_QUOTE, '\\$&') | ||
118 | + .replace(/\n/g, '\\n') | ||
119 | + .replace(/\r/g, '\\r') | ||
120 | + .replace(/\f/g, '\\f') | ||
121 | + .replace(/\t/g, '\\t'); | ||
122 | +} | ||
123 | + | ||
124 | + | ||
125 | +function varOccurences(str, dataVar) { | ||
126 | + dataVar += '[^0-9]'; | ||
127 | + var matches = str.match(new RegExp(dataVar, 'g')); | ||
128 | + return matches ? matches.length : 0; | ||
129 | +} | ||
130 | + | ||
131 | + | ||
132 | +function varReplace(str, dataVar, expr) { | ||
133 | + dataVar += '([^0-9])'; | ||
134 | + expr = expr.replace(/\$/g, '$$$$'); | ||
135 | + return str.replace(new RegExp(dataVar, 'g'), expr + '$1'); | ||
136 | +} | ||
137 | + | ||
138 | + | ||
139 | +var EMPTY_ELSE = /else\s*{\s*}/g | ||
140 | + , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g | ||
141 | + , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g; | ||
142 | +function cleanUpCode(out) { | ||
143 | + return out.replace(EMPTY_ELSE, '') | ||
144 | + .replace(EMPTY_IF_NO_ELSE, '') | ||
145 | + .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))'); | ||
146 | +} | ||
147 | + | ||
148 | + | ||
149 | +var ERRORS_REGEXP = /[^v.]errors/g | ||
150 | + , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g | ||
151 | + , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g | ||
152 | + , RETURN_VALID = 'return errors === 0;' | ||
153 | + , RETURN_TRUE = 'validate.errors = null; return true;' | ||
154 | + , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/ | ||
155 | + , RETURN_DATA_ASYNC = 'return data;' | ||
156 | + , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g | ||
157 | + , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/; | ||
158 | + | ||
159 | +function finalCleanUpCode(out, async) { | ||
160 | + var matches = out.match(ERRORS_REGEXP); | ||
161 | + if (matches && matches.length == 2) { | ||
162 | + out = async | ||
163 | + ? out.replace(REMOVE_ERRORS_ASYNC, '') | ||
164 | + .replace(RETURN_ASYNC, RETURN_DATA_ASYNC) | ||
165 | + : out.replace(REMOVE_ERRORS, '') | ||
166 | + .replace(RETURN_VALID, RETURN_TRUE); | ||
167 | + } | ||
168 | + | ||
169 | + matches = out.match(ROOTDATA_REGEXP); | ||
170 | + if (!matches || matches.length !== 3) return out; | ||
171 | + return out.replace(REMOVE_ROOTDATA, ''); | ||
172 | +} | ||
173 | + | ||
174 | + | ||
175 | +function schemaHasRules(schema, rules) { | ||
176 | + if (typeof schema == 'boolean') return !schema; | ||
177 | + for (var key in schema) if (rules[key]) return true; | ||
178 | +} | ||
179 | + | ||
180 | + | ||
181 | +function schemaHasRulesExcept(schema, rules, exceptKeyword) { | ||
182 | + if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not'; | ||
183 | + for (var key in schema) if (key != exceptKeyword && rules[key]) return true; | ||
184 | +} | ||
185 | + | ||
186 | + | ||
187 | +function schemaUnknownRules(schema, rules) { | ||
188 | + if (typeof schema == 'boolean') return; | ||
189 | + for (var key in schema) if (!rules[key]) return key; | ||
190 | +} | ||
191 | + | ||
192 | + | ||
193 | +function toQuotedString(str) { | ||
194 | + return '\'' + escapeQuotes(str) + '\''; | ||
195 | +} | ||
196 | + | ||
197 | + | ||
198 | +function getPathExpr(currentPath, expr, jsonPointers, isNumber) { | ||
199 | + var path = jsonPointers // false by default | ||
200 | + ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')') | ||
201 | + : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\''); | ||
202 | + return joinPaths(currentPath, path); | ||
203 | +} | ||
204 | + | ||
205 | + | ||
206 | +function getPath(currentPath, prop, jsonPointers) { | ||
207 | + var path = jsonPointers // false by default | ||
208 | + ? toQuotedString('/' + escapeJsonPointer(prop)) | ||
209 | + : toQuotedString(getProperty(prop)); | ||
210 | + return joinPaths(currentPath, path); | ||
211 | +} | ||
212 | + | ||
213 | + | ||
214 | +var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; | ||
215 | +var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; | ||
216 | +function getData($data, lvl, paths) { | ||
217 | + var up, jsonPointer, data, matches; | ||
218 | + if ($data === '') return 'rootData'; | ||
219 | + if ($data[0] == '/') { | ||
220 | + if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data); | ||
221 | + jsonPointer = $data; | ||
222 | + data = 'rootData'; | ||
223 | + } else { | ||
224 | + matches = $data.match(RELATIVE_JSON_POINTER); | ||
225 | + if (!matches) throw new Error('Invalid JSON-pointer: ' + $data); | ||
226 | + up = +matches[1]; | ||
227 | + jsonPointer = matches[2]; | ||
228 | + if (jsonPointer == '#') { | ||
229 | + if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); | ||
230 | + return paths[lvl - up]; | ||
231 | + } | ||
232 | + | ||
233 | + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); | ||
234 | + data = 'data' + ((lvl - up) || ''); | ||
235 | + if (!jsonPointer) return data; | ||
236 | + } | ||
237 | + | ||
238 | + var expr = data; | ||
239 | + var segments = jsonPointer.split('/'); | ||
240 | + for (var i=0; i<segments.length; i++) { | ||
241 | + var segment = segments[i]; | ||
242 | + if (segment) { | ||
243 | + data += getProperty(unescapeJsonPointer(segment)); | ||
244 | + expr += ' && ' + data; | ||
245 | + } | ||
246 | + } | ||
247 | + return expr; | ||
248 | +} | ||
249 | + | ||
250 | + | ||
251 | +function joinPaths (a, b) { | ||
252 | + if (a == '""') return b; | ||
253 | + return (a + ' + ' + b).replace(/' \+ '/g, ''); | ||
254 | +} | ||
255 | + | ||
256 | + | ||
257 | +function unescapeFragment(str) { | ||
258 | + return unescapeJsonPointer(decodeURIComponent(str)); | ||
259 | +} | ||
260 | + | ||
261 | + | ||
262 | +function escapeFragment(str) { | ||
263 | + return encodeURIComponent(escapeJsonPointer(str)); | ||
264 | +} | ||
265 | + | ||
266 | + | ||
267 | +function escapeJsonPointer(str) { | ||
268 | + return str.replace(/~/g, '~0').replace(/\//g, '~1'); | ||
269 | +} | ||
270 | + | ||
271 | + | ||
272 | +function unescapeJsonPointer(str) { | ||
273 | + return str.replace(/~1/g, '/').replace(/~0/g, '~'); | ||
274 | +} |
LINE-js/node_modules/ajv/lib/data.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var KEYWORDS = [ | ||
4 | + 'multipleOf', | ||
5 | + 'maximum', | ||
6 | + 'exclusiveMaximum', | ||
7 | + 'minimum', | ||
8 | + 'exclusiveMinimum', | ||
9 | + 'maxLength', | ||
10 | + 'minLength', | ||
11 | + 'pattern', | ||
12 | + 'additionalItems', | ||
13 | + 'maxItems', | ||
14 | + 'minItems', | ||
15 | + 'uniqueItems', | ||
16 | + 'maxProperties', | ||
17 | + 'minProperties', | ||
18 | + 'required', | ||
19 | + 'additionalProperties', | ||
20 | + 'enum', | ||
21 | + 'format', | ||
22 | + 'const' | ||
23 | +]; | ||
24 | + | ||
25 | +module.exports = function (metaSchema, keywordsJsonPointers) { | ||
26 | + for (var i=0; i<keywordsJsonPointers.length; i++) { | ||
27 | + metaSchema = JSON.parse(JSON.stringify(metaSchema)); | ||
28 | + var segments = keywordsJsonPointers[i].split('/'); | ||
29 | + var keywords = metaSchema; | ||
30 | + var j; | ||
31 | + for (j=1; j<segments.length; j++) | ||
32 | + keywords = keywords[segments[j]]; | ||
33 | + | ||
34 | + for (j=0; j<KEYWORDS.length; j++) { | ||
35 | + var key = KEYWORDS[j]; | ||
36 | + var schema = keywords[key]; | ||
37 | + if (schema) { | ||
38 | + keywords[key] = { | ||
39 | + anyOf: [ | ||
40 | + schema, | ||
41 | + { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' } | ||
42 | + ] | ||
43 | + }; | ||
44 | + } | ||
45 | + } | ||
46 | + } | ||
47 | + | ||
48 | + return metaSchema; | ||
49 | +}; |
1 | +'use strict'; | ||
2 | + | ||
3 | +var metaSchema = require('./refs/json-schema-draft-07.json'); | ||
4 | + | ||
5 | +module.exports = { | ||
6 | + $id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js', | ||
7 | + definitions: { | ||
8 | + simpleTypes: metaSchema.definitions.simpleTypes | ||
9 | + }, | ||
10 | + type: 'object', | ||
11 | + dependencies: { | ||
12 | + schema: ['validate'], | ||
13 | + $data: ['validate'], | ||
14 | + statements: ['inline'], | ||
15 | + valid: {not: {required: ['macro']}} | ||
16 | + }, | ||
17 | + properties: { | ||
18 | + type: metaSchema.properties.type, | ||
19 | + schema: {type: 'boolean'}, | ||
20 | + statements: {type: 'boolean'}, | ||
21 | + dependencies: { | ||
22 | + type: 'array', | ||
23 | + items: {type: 'string'} | ||
24 | + }, | ||
25 | + metaSchema: {type: 'object'}, | ||
26 | + modifying: {type: 'boolean'}, | ||
27 | + valid: {type: 'boolean'}, | ||
28 | + $data: {type: 'boolean'}, | ||
29 | + async: {type: 'boolean'}, | ||
30 | + errors: { | ||
31 | + anyOf: [ | ||
32 | + {type: 'boolean'}, | ||
33 | + {const: 'full'} | ||
34 | + ] | ||
35 | + } | ||
36 | + } | ||
37 | +}; |
LINE-js/node_modules/ajv/lib/dot/_limit.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{## def.setExclusiveLimit: | ||
7 | + $exclusive = true; | ||
8 | + $errorKeyword = $exclusiveKeyword; | ||
9 | + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; | ||
10 | +#}} | ||
11 | + | ||
12 | +{{ | ||
13 | + var $isMax = $keyword == 'maximum' | ||
14 | + , $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum' | ||
15 | + , $schemaExcl = it.schema[$exclusiveKeyword] | ||
16 | + , $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data | ||
17 | + , $op = $isMax ? '<' : '>' | ||
18 | + , $notOp = $isMax ? '>' : '<' | ||
19 | + , $errorKeyword = undefined; | ||
20 | +}} | ||
21 | + | ||
22 | +{{? $isDataExcl }} | ||
23 | + {{ | ||
24 | + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr) | ||
25 | + , $exclusive = 'exclusive' + $lvl | ||
26 | + , $exclType = 'exclType' + $lvl | ||
27 | + , $exclIsNumber = 'exclIsNumber' + $lvl | ||
28 | + , $opExpr = 'op' + $lvl | ||
29 | + , $opStr = '\' + ' + $opExpr + ' + \''; | ||
30 | + }} | ||
31 | + var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}}; | ||
32 | + {{ $schemaValueExcl = 'schemaExcl' + $lvl; }} | ||
33 | + | ||
34 | + var {{=$exclusive}}; | ||
35 | + var {{=$exclType}} = typeof {{=$schemaValueExcl}}; | ||
36 | + if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') { | ||
37 | + {{ var $errorKeyword = $exclusiveKeyword; }} | ||
38 | + {{# def.error:'_exclusiveLimit' }} | ||
39 | + } else if ({{# def.$dataNotType:'number' }} | ||
40 | + {{=$exclType}} == 'number' | ||
41 | + ? ( | ||
42 | + ({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}}) | ||
43 | + ? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}} | ||
44 | + : {{=$data}} {{=$notOp}} {{=$schemaValue}} | ||
45 | + ) | ||
46 | + : ( | ||
47 | + ({{=$exclusive}} = {{=$schemaValueExcl}} === true) | ||
48 | + ? {{=$data}} {{=$notOp}}= {{=$schemaValue}} | ||
49 | + : {{=$data}} {{=$notOp}} {{=$schemaValue}} | ||
50 | + ) | ||
51 | + || {{=$data}} !== {{=$data}}) { | ||
52 | + var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}='; | ||
53 | + {{ | ||
54 | + if ($schema === undefined) { | ||
55 | + $errorKeyword = $exclusiveKeyword; | ||
56 | + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; | ||
57 | + $schemaValue = $schemaValueExcl; | ||
58 | + $isData = $isDataExcl; | ||
59 | + } | ||
60 | + }} | ||
61 | +{{??}} | ||
62 | + {{ | ||
63 | + var $exclIsNumber = typeof $schemaExcl == 'number' | ||
64 | + , $opStr = $op; /*used in error*/ | ||
65 | + }} | ||
66 | + | ||
67 | + {{? $exclIsNumber && $isData }} | ||
68 | + {{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }} | ||
69 | + if ({{# def.$dataNotType:'number' }} | ||
70 | + ( {{=$schemaValue}} === undefined | ||
71 | + || {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}} | ||
72 | + ? {{=$data}} {{=$notOp}}= {{=$schemaExcl}} | ||
73 | + : {{=$data}} {{=$notOp}} {{=$schemaValue}} ) | ||
74 | + || {{=$data}} !== {{=$data}}) { | ||
75 | + {{??}} | ||
76 | + {{ | ||
77 | + if ($exclIsNumber && $schema === undefined) { | ||
78 | + {{# def.setExclusiveLimit }} | ||
79 | + $schemaValue = $schemaExcl; | ||
80 | + $notOp += '='; | ||
81 | + } else { | ||
82 | + if ($exclIsNumber) | ||
83 | + $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); | ||
84 | + | ||
85 | + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { | ||
86 | + {{# def.setExclusiveLimit }} | ||
87 | + $notOp += '='; | ||
88 | + } else { | ||
89 | + $exclusive = false; | ||
90 | + $opStr += '='; | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + var $opExpr = '\'' + $opStr + '\''; /*used in error*/ | ||
95 | + }} | ||
96 | + | ||
97 | + if ({{# def.$dataNotType:'number' }} | ||
98 | + {{=$data}} {{=$notOp}} {{=$schemaValue}} | ||
99 | + || {{=$data}} !== {{=$data}}) { | ||
100 | + {{?}} | ||
101 | +{{?}} | ||
102 | + {{ $errorKeyword = $errorKeyword || $keyword; }} | ||
103 | + {{# def.error:'_limit' }} | ||
104 | + } {{? $breakOnError }} else { {{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }} | ||
7 | +if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) { | ||
8 | + {{ var $errorKeyword = $keyword; }} | ||
9 | + {{# def.error:'_limitItems' }} | ||
10 | +} {{? $breakOnError }} else { {{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }} | ||
7 | +if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) { | ||
8 | + {{ var $errorKeyword = $keyword; }} | ||
9 | + {{# def.error:'_limitLength' }} | ||
10 | +} {{? $breakOnError }} else { {{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }} | ||
7 | +if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) { | ||
8 | + {{ var $errorKeyword = $keyword; }} | ||
9 | + {{# def.error:'_limitProperties' }} | ||
10 | +} {{? $breakOnError }} else { {{?}} |
LINE-js/node_modules/ajv/lib/dot/allOf.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | +{{ | ||
7 | + var $currentBaseId = $it.baseId | ||
8 | + , $allSchemasEmpty = true; | ||
9 | +}} | ||
10 | + | ||
11 | +{{~ $schema:$sch:$i }} | ||
12 | + {{? {{# def.nonEmptySchema:$sch }} }} | ||
13 | + {{ | ||
14 | + $allSchemasEmpty = false; | ||
15 | + $it.schema = $sch; | ||
16 | + $it.schemaPath = $schemaPath + '[' + $i + ']'; | ||
17 | + $it.errSchemaPath = $errSchemaPath + '/' + $i; | ||
18 | + }} | ||
19 | + | ||
20 | + {{# def.insertSubschemaCode }} | ||
21 | + | ||
22 | + {{# def.ifResultValid }} | ||
23 | + {{?}} | ||
24 | +{{~}} | ||
25 | + | ||
26 | +{{? $breakOnError }} | ||
27 | + {{? $allSchemasEmpty }} | ||
28 | + if (true) { | ||
29 | + {{??}} | ||
30 | + {{= $closingBraces.slice(0,-1) }} | ||
31 | + {{?}} | ||
32 | +{{?}} | ||
33 | + | ||
34 | +{{# def.cleanUp }} |
LINE-js/node_modules/ajv/lib/dot/anyOf.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | +{{ | ||
7 | + var $noEmptySchema = $schema.every(function($sch) { | ||
8 | + return {{# def.nonEmptySchema:$sch }}; | ||
9 | + }); | ||
10 | +}} | ||
11 | +{{? $noEmptySchema }} | ||
12 | + {{ var $currentBaseId = $it.baseId; }} | ||
13 | + var {{=$errs}} = errors; | ||
14 | + var {{=$valid}} = false; | ||
15 | + | ||
16 | + {{# def.setCompositeRule }} | ||
17 | + | ||
18 | + {{~ $schema:$sch:$i }} | ||
19 | + {{ | ||
20 | + $it.schema = $sch; | ||
21 | + $it.schemaPath = $schemaPath + '[' + $i + ']'; | ||
22 | + $it.errSchemaPath = $errSchemaPath + '/' + $i; | ||
23 | + }} | ||
24 | + | ||
25 | + {{# def.insertSubschemaCode }} | ||
26 | + | ||
27 | + {{=$valid}} = {{=$valid}} || {{=$nextValid}}; | ||
28 | + | ||
29 | + if (!{{=$valid}}) { | ||
30 | + {{ $closingBraces += '}'; }} | ||
31 | + {{~}} | ||
32 | + | ||
33 | + {{# def.resetCompositeRule }} | ||
34 | + | ||
35 | + {{= $closingBraces }} | ||
36 | + | ||
37 | + if (!{{=$valid}}) { | ||
38 | + {{# def.extraError:'anyOf' }} | ||
39 | + } else { | ||
40 | + {{# def.resetErrors }} | ||
41 | + {{? it.opts.allErrors }} } {{?}} | ||
42 | + | ||
43 | + {{# def.cleanUp }} | ||
44 | +{{??}} | ||
45 | + {{? $breakOnError }} | ||
46 | + if (true) { | ||
47 | + {{?}} | ||
48 | +{{?}} |
LINE-js/node_modules/ajv/lib/dot/coerce.def
0 → 100644
1 | +{{## def.coerceType: | ||
2 | + {{ | ||
3 | + var $dataType = 'dataType' + $lvl | ||
4 | + , $coerced = 'coerced' + $lvl; | ||
5 | + }} | ||
6 | + var {{=$dataType}} = typeof {{=$data}}; | ||
7 | + {{? it.opts.coerceTypes == 'array'}} | ||
8 | + if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array'; | ||
9 | + {{?}} | ||
10 | + | ||
11 | + var {{=$coerced}} = undefined; | ||
12 | + | ||
13 | + {{ var $bracesCoercion = ''; }} | ||
14 | + {{~ $coerceToTypes:$type:$i }} | ||
15 | + {{? $i }} | ||
16 | + if ({{=$coerced}} === undefined) { | ||
17 | + {{ $bracesCoercion += '}'; }} | ||
18 | + {{?}} | ||
19 | + | ||
20 | + {{? it.opts.coerceTypes == 'array' && $type != 'array' }} | ||
21 | + if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) { | ||
22 | + {{=$coerced}} = {{=$data}} = {{=$data}}[0]; | ||
23 | + {{=$dataType}} = typeof {{=$data}}; | ||
24 | + /*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/ | ||
25 | + } | ||
26 | + {{?}} | ||
27 | + | ||
28 | + {{? $type == 'string' }} | ||
29 | + if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean') | ||
30 | + {{=$coerced}} = '' + {{=$data}}; | ||
31 | + else if ({{=$data}} === null) {{=$coerced}} = ''; | ||
32 | + {{?? $type == 'number' || $type == 'integer' }} | ||
33 | + if ({{=$dataType}} == 'boolean' || {{=$data}} === null | ||
34 | + || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}} | ||
35 | + {{? $type == 'integer' }} && !({{=$data}} % 1){{?}})) | ||
36 | + {{=$coerced}} = +{{=$data}}; | ||
37 | + {{?? $type == 'boolean' }} | ||
38 | + if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null) | ||
39 | + {{=$coerced}} = false; | ||
40 | + else if ({{=$data}} === 'true' || {{=$data}} === 1) | ||
41 | + {{=$coerced}} = true; | ||
42 | + {{?? $type == 'null' }} | ||
43 | + if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false) | ||
44 | + {{=$coerced}} = null; | ||
45 | + {{?? it.opts.coerceTypes == 'array' && $type == 'array' }} | ||
46 | + if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null) | ||
47 | + {{=$coerced}} = [{{=$data}}]; | ||
48 | + {{?}} | ||
49 | + {{~}} | ||
50 | + | ||
51 | + {{= $bracesCoercion }} | ||
52 | + | ||
53 | + if ({{=$coerced}} === undefined) { | ||
54 | + {{# def.error:'type' }} | ||
55 | + } else { | ||
56 | + {{# def.setParentData }} | ||
57 | + {{=$data}} = {{=$coerced}}; | ||
58 | + {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}} | ||
59 | + {{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}}; | ||
60 | + } | ||
61 | +#}} |
LINE-js/node_modules/ajv/lib/dot/comment.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.setupKeyword }} | ||
3 | + | ||
4 | +{{ var $comment = it.util.toQuotedString($schema); }} | ||
5 | +{{? it.opts.$comment === true }} | ||
6 | + console.log({{=$comment}}); | ||
7 | +{{?? typeof it.opts.$comment == 'function' }} | ||
8 | + self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema); | ||
9 | +{{?}} |
LINE-js/node_modules/ajv/lib/dot/const.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{? !$isData }} | ||
7 | + var schema{{=$lvl}} = validate.schema{{=$schemaPath}}; | ||
8 | +{{?}} | ||
9 | +var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}}); | ||
10 | +{{# def.checkError:'const' }} | ||
11 | +{{? $breakOnError }} else { {{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | + | ||
7 | +{{ | ||
8 | + var $idx = 'i' + $lvl | ||
9 | + , $dataNxt = $it.dataLevel = it.dataLevel + 1 | ||
10 | + , $nextData = 'data' + $dataNxt | ||
11 | + , $currentBaseId = it.baseId | ||
12 | + , $nonEmptySchema = {{# def.nonEmptySchema:$schema }}; | ||
13 | +}} | ||
14 | + | ||
15 | +var {{=$errs}} = errors; | ||
16 | +var {{=$valid}}; | ||
17 | + | ||
18 | +{{? $nonEmptySchema }} | ||
19 | + {{# def.setCompositeRule }} | ||
20 | + | ||
21 | + {{ | ||
22 | + $it.schema = $schema; | ||
23 | + $it.schemaPath = $schemaPath; | ||
24 | + $it.errSchemaPath = $errSchemaPath; | ||
25 | + }} | ||
26 | + | ||
27 | + var {{=$nextValid}} = false; | ||
28 | + | ||
29 | + for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { | ||
30 | + {{ | ||
31 | + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); | ||
32 | + var $passData = $data + '[' + $idx + ']'; | ||
33 | + $it.dataPathArr[$dataNxt] = $idx; | ||
34 | + }} | ||
35 | + | ||
36 | + {{# def.generateSubschemaCode }} | ||
37 | + {{# def.optimizeValidate }} | ||
38 | + | ||
39 | + if ({{=$nextValid}}) break; | ||
40 | + } | ||
41 | + | ||
42 | + {{# def.resetCompositeRule }} | ||
43 | + {{= $closingBraces }} | ||
44 | + | ||
45 | + if (!{{=$nextValid}}) { | ||
46 | +{{??}} | ||
47 | + if ({{=$data}}.length == 0) { | ||
48 | +{{?}} | ||
49 | + | ||
50 | + {{# def.error:'contains' }} | ||
51 | + } else { | ||
52 | + {{? $nonEmptySchema }} | ||
53 | + {{# def.resetErrors }} | ||
54 | + {{?}} | ||
55 | + {{? it.opts.allErrors }} } {{?}} | ||
56 | + | ||
57 | +{{# def.cleanUp }} |
LINE-js/node_modules/ajv/lib/dot/custom.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{ | ||
7 | + var $rule = this | ||
8 | + , $definition = 'definition' + $lvl | ||
9 | + , $rDef = $rule.definition | ||
10 | + , $closingBraces = ''; | ||
11 | + var $validate = $rDef.validate; | ||
12 | + var $compile, $inline, $macro, $ruleValidate, $validateCode; | ||
13 | +}} | ||
14 | + | ||
15 | +{{? $isData && $rDef.$data }} | ||
16 | + {{ | ||
17 | + $validateCode = 'keywordValidate' + $lvl; | ||
18 | + var $validateSchema = $rDef.validateSchema; | ||
19 | + }} | ||
20 | + var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition; | ||
21 | + var {{=$validateCode}} = {{=$definition}}.validate; | ||
22 | +{{??}} | ||
23 | + {{ | ||
24 | + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); | ||
25 | + if (!$ruleValidate) return; | ||
26 | + $schemaValue = 'validate.schema' + $schemaPath; | ||
27 | + $validateCode = $ruleValidate.code; | ||
28 | + $compile = $rDef.compile; | ||
29 | + $inline = $rDef.inline; | ||
30 | + $macro = $rDef.macro; | ||
31 | + }} | ||
32 | +{{?}} | ||
33 | + | ||
34 | +{{ | ||
35 | + var $ruleErrs = $validateCode + '.errors' | ||
36 | + , $i = 'i' + $lvl | ||
37 | + , $ruleErr = 'ruleErr' + $lvl | ||
38 | + , $asyncKeyword = $rDef.async; | ||
39 | + | ||
40 | + if ($asyncKeyword && !it.async) | ||
41 | + throw new Error('async keyword in sync schema'); | ||
42 | +}} | ||
43 | + | ||
44 | + | ||
45 | +{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}} | ||
46 | +var {{=$errs}} = errors; | ||
47 | +var {{=$valid}}; | ||
48 | + | ||
49 | +{{## def.callRuleValidate: | ||
50 | + {{=$validateCode}}.call( | ||
51 | + {{? it.opts.passContext }}this{{??}}self{{?}} | ||
52 | + {{? $compile || $rDef.schema === false }} | ||
53 | + , {{=$data}} | ||
54 | + {{??}} | ||
55 | + , {{=$schemaValue}} | ||
56 | + , {{=$data}} | ||
57 | + , validate.schema{{=it.schemaPath}} | ||
58 | + {{?}} | ||
59 | + , {{# def.dataPath }} | ||
60 | + {{# def.passParentData }} | ||
61 | + , rootData | ||
62 | + ) | ||
63 | +#}} | ||
64 | + | ||
65 | +{{## def.extendErrors:_inline: | ||
66 | + for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) { | ||
67 | + var {{=$ruleErr}} = vErrors[{{=$i}}]; | ||
68 | + if ({{=$ruleErr}}.dataPath === undefined) | ||
69 | + {{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }}; | ||
70 | + {{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }} | ||
71 | + {{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}"; | ||
72 | + {{# _inline ? '}' : '' }} | ||
73 | + {{? it.opts.verbose }} | ||
74 | + {{=$ruleErr}}.schema = {{=$schemaValue}}; | ||
75 | + {{=$ruleErr}}.data = {{=$data}}; | ||
76 | + {{?}} | ||
77 | + } | ||
78 | +#}} | ||
79 | + | ||
80 | + | ||
81 | +{{? $isData && $rDef.$data }} | ||
82 | + {{ $closingBraces += '}'; }} | ||
83 | + if ({{=$schemaValue}} === undefined) { | ||
84 | + {{=$valid}} = true; | ||
85 | + } else { | ||
86 | + {{? $validateSchema }} | ||
87 | + {{ $closingBraces += '}'; }} | ||
88 | + {{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}}); | ||
89 | + if ({{=$valid}}) { | ||
90 | + {{?}} | ||
91 | +{{?}} | ||
92 | + | ||
93 | +{{? $inline }} | ||
94 | + {{? $rDef.statements }} | ||
95 | + {{= $ruleValidate.validate }} | ||
96 | + {{??}} | ||
97 | + {{=$valid}} = {{= $ruleValidate.validate }}; | ||
98 | + {{?}} | ||
99 | +{{?? $macro }} | ||
100 | + {{# def.setupNextLevel }} | ||
101 | + {{ | ||
102 | + $it.schema = $ruleValidate.validate; | ||
103 | + $it.schemaPath = ''; | ||
104 | + }} | ||
105 | + {{# def.setCompositeRule }} | ||
106 | + {{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }} | ||
107 | + {{# def.resetCompositeRule }} | ||
108 | + {{= $code }} | ||
109 | +{{??}} | ||
110 | + {{# def.beginDefOut}} | ||
111 | + {{# def.callRuleValidate }} | ||
112 | + {{# def.storeDefOut:def_callRuleValidate }} | ||
113 | + | ||
114 | + {{? $rDef.errors === false }} | ||
115 | + {{=$valid}} = {{? $asyncKeyword }}await {{?}}{{= def_callRuleValidate }}; | ||
116 | + {{??}} | ||
117 | + {{? $asyncKeyword }} | ||
118 | + {{ $ruleErrs = 'customErrors' + $lvl; }} | ||
119 | + var {{=$ruleErrs}} = null; | ||
120 | + try { | ||
121 | + {{=$valid}} = await {{= def_callRuleValidate }}; | ||
122 | + } catch (e) { | ||
123 | + {{=$valid}} = false; | ||
124 | + if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors; | ||
125 | + else throw e; | ||
126 | + } | ||
127 | + {{??}} | ||
128 | + {{=$ruleErrs}} = null; | ||
129 | + {{=$valid}} = {{= def_callRuleValidate }}; | ||
130 | + {{?}} | ||
131 | + {{?}} | ||
132 | +{{?}} | ||
133 | + | ||
134 | +{{? $rDef.modifying }} | ||
135 | + if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}]; | ||
136 | +{{?}} | ||
137 | + | ||
138 | +{{= $closingBraces }} | ||
139 | + | ||
140 | +{{## def.notValidationResult: | ||
141 | + {{? $rDef.valid === undefined }} | ||
142 | + !{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}} | ||
143 | + {{??}} | ||
144 | + {{= !$rDef.valid }} | ||
145 | + {{?}} | ||
146 | +#}} | ||
147 | + | ||
148 | +{{? $rDef.valid }} | ||
149 | + {{? $breakOnError }} if (true) { {{?}} | ||
150 | +{{??}} | ||
151 | + if ({{# def.notValidationResult }}) { | ||
152 | + {{ $errorKeyword = $rule.keyword; }} | ||
153 | + {{# def.beginDefOut}} | ||
154 | + {{# def.error:'custom' }} | ||
155 | + {{# def.storeDefOut:def_customError }} | ||
156 | + | ||
157 | + {{? $inline }} | ||
158 | + {{? $rDef.errors }} | ||
159 | + {{? $rDef.errors != 'full' }} | ||
160 | + {{# def.extendErrors:true }} | ||
161 | + {{?}} | ||
162 | + {{??}} | ||
163 | + {{? $rDef.errors === false}} | ||
164 | + {{= def_customError }} | ||
165 | + {{??}} | ||
166 | + if ({{=$errs}} == errors) { | ||
167 | + {{= def_customError }} | ||
168 | + } else { | ||
169 | + {{# def.extendErrors:true }} | ||
170 | + } | ||
171 | + {{?}} | ||
172 | + {{?}} | ||
173 | + {{?? $macro }} | ||
174 | + {{# def.extraError:'custom' }} | ||
175 | + {{??}} | ||
176 | + {{? $rDef.errors === false}} | ||
177 | + {{= def_customError }} | ||
178 | + {{??}} | ||
179 | + if (Array.isArray({{=$ruleErrs}})) { | ||
180 | + if (vErrors === null) vErrors = {{=$ruleErrs}}; | ||
181 | + else vErrors = vErrors.concat({{=$ruleErrs}}); | ||
182 | + errors = vErrors.length; | ||
183 | + {{# def.extendErrors:false }} | ||
184 | + } else { | ||
185 | + {{= def_customError }} | ||
186 | + } | ||
187 | + {{?}} | ||
188 | + {{?}} | ||
189 | + | ||
190 | + } {{? $breakOnError }} else { {{?}} | ||
191 | +{{?}} |
1 | +{{## def.assignDefault: | ||
2 | + {{? it.compositeRule }} | ||
3 | + {{ | ||
4 | + if (it.opts.strictDefaults) { | ||
5 | + var $defaultMsg = 'default is ignored for: ' + $passData; | ||
6 | + if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); | ||
7 | + else throw new Error($defaultMsg); | ||
8 | + } | ||
9 | + }} | ||
10 | + {{??}} | ||
11 | + if ({{=$passData}} === undefined | ||
12 | + {{? it.opts.useDefaults == 'empty' }} | ||
13 | + || {{=$passData}} === null | ||
14 | + || {{=$passData}} === '' | ||
15 | + {{?}} | ||
16 | + ) | ||
17 | + {{=$passData}} = {{? it.opts.useDefaults == 'shared' }} | ||
18 | + {{= it.useDefault($sch.default) }} | ||
19 | + {{??}} | ||
20 | + {{= JSON.stringify($sch.default) }} | ||
21 | + {{?}}; | ||
22 | + {{?}} | ||
23 | +#}} | ||
24 | + | ||
25 | + | ||
26 | +{{## def.defaultProperties: | ||
27 | + {{ | ||
28 | + var $schema = it.schema.properties | ||
29 | + , $schemaKeys = Object.keys($schema); }} | ||
30 | + {{~ $schemaKeys:$propertyKey }} | ||
31 | + {{ var $sch = $schema[$propertyKey]; }} | ||
32 | + {{? $sch.default !== undefined }} | ||
33 | + {{ var $passData = $data + it.util.getProperty($propertyKey); }} | ||
34 | + {{# def.assignDefault }} | ||
35 | + {{?}} | ||
36 | + {{~}} | ||
37 | +#}} | ||
38 | + | ||
39 | + | ||
40 | +{{## def.defaultItems: | ||
41 | + {{~ it.schema.items:$sch:$i }} | ||
42 | + {{? $sch.default !== undefined }} | ||
43 | + {{ var $passData = $data + '[' + $i + ']'; }} | ||
44 | + {{# def.assignDefault }} | ||
45 | + {{?}} | ||
46 | + {{~}} | ||
47 | +#}} |
1 | +{{## def.setupKeyword: | ||
2 | + {{ | ||
3 | + var $lvl = it.level; | ||
4 | + var $dataLvl = it.dataLevel; | ||
5 | + var $schema = it.schema[$keyword]; | ||
6 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
7 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
8 | + var $breakOnError = !it.opts.allErrors; | ||
9 | + var $errorKeyword; | ||
10 | + | ||
11 | + var $data = 'data' + ($dataLvl || ''); | ||
12 | + var $valid = 'valid' + $lvl; | ||
13 | + var $errs = 'errs__' + $lvl; | ||
14 | + }} | ||
15 | +#}} | ||
16 | + | ||
17 | + | ||
18 | +{{## def.setCompositeRule: | ||
19 | + {{ | ||
20 | + var $wasComposite = it.compositeRule; | ||
21 | + it.compositeRule = $it.compositeRule = true; | ||
22 | + }} | ||
23 | +#}} | ||
24 | + | ||
25 | + | ||
26 | +{{## def.resetCompositeRule: | ||
27 | + {{ it.compositeRule = $it.compositeRule = $wasComposite; }} | ||
28 | +#}} | ||
29 | + | ||
30 | + | ||
31 | +{{## def.setupNextLevel: | ||
32 | + {{ | ||
33 | + var $it = it.util.copy(it); | ||
34 | + var $closingBraces = ''; | ||
35 | + $it.level++; | ||
36 | + var $nextValid = 'valid' + $it.level; | ||
37 | + }} | ||
38 | +#}} | ||
39 | + | ||
40 | + | ||
41 | +{{## def.ifValid: | ||
42 | + {{? $breakOnError }} | ||
43 | + if ({{=$valid}}) { | ||
44 | + {{ $closingBraces += '}'; }} | ||
45 | + {{?}} | ||
46 | +#}} | ||
47 | + | ||
48 | + | ||
49 | +{{## def.ifResultValid: | ||
50 | + {{? $breakOnError }} | ||
51 | + if ({{=$nextValid}}) { | ||
52 | + {{ $closingBraces += '}'; }} | ||
53 | + {{?}} | ||
54 | +#}} | ||
55 | + | ||
56 | + | ||
57 | +{{## def.elseIfValid: | ||
58 | + {{? $breakOnError }} | ||
59 | + {{ $closingBraces += '}'; }} | ||
60 | + else { | ||
61 | + {{?}} | ||
62 | +#}} | ||
63 | + | ||
64 | + | ||
65 | +{{## def.nonEmptySchema:_schema: | ||
66 | + (it.opts.strictKeywords | ||
67 | + ? typeof _schema == 'object' && Object.keys(_schema).length > 0 | ||
68 | + : it.util.schemaHasRules(_schema, it.RULES.all)) | ||
69 | +#}} | ||
70 | + | ||
71 | + | ||
72 | +{{## def.strLength: | ||
73 | + {{? it.opts.unicode === false }} | ||
74 | + {{=$data}}.length | ||
75 | + {{??}} | ||
76 | + ucs2length({{=$data}}) | ||
77 | + {{?}} | ||
78 | +#}} | ||
79 | + | ||
80 | + | ||
81 | +{{## def.willOptimize: | ||
82 | + it.util.varOccurences($code, $nextData) < 2 | ||
83 | +#}} | ||
84 | + | ||
85 | + | ||
86 | +{{## def.generateSubschemaCode: | ||
87 | + {{ | ||
88 | + var $code = it.validate($it); | ||
89 | + $it.baseId = $currentBaseId; | ||
90 | + }} | ||
91 | +#}} | ||
92 | + | ||
93 | + | ||
94 | +{{## def.insertSubschemaCode: | ||
95 | + {{= it.validate($it) }} | ||
96 | + {{ $it.baseId = $currentBaseId; }} | ||
97 | +#}} | ||
98 | + | ||
99 | + | ||
100 | +{{## def._optimizeValidate: | ||
101 | + it.util.varReplace($code, $nextData, $passData) | ||
102 | +#}} | ||
103 | + | ||
104 | + | ||
105 | +{{## def.optimizeValidate: | ||
106 | + {{? {{# def.willOptimize}} }} | ||
107 | + {{= {{# def._optimizeValidate }} }} | ||
108 | + {{??}} | ||
109 | + var {{=$nextData}} = {{=$passData}}; | ||
110 | + {{= $code }} | ||
111 | + {{?}} | ||
112 | +#}} | ||
113 | + | ||
114 | + | ||
115 | +{{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}} | ||
116 | + | ||
117 | + | ||
118 | +{{## def.finalCleanUp: {{ out = it.util.finalCleanUpCode(out, $async); }} #}} | ||
119 | + | ||
120 | + | ||
121 | +{{## def.$data: | ||
122 | + {{ | ||
123 | + var $isData = it.opts.$data && $schema && $schema.$data | ||
124 | + , $schemaValue; | ||
125 | + }} | ||
126 | + {{? $isData }} | ||
127 | + var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }}; | ||
128 | + {{ $schemaValue = 'schema' + $lvl; }} | ||
129 | + {{??}} | ||
130 | + {{ $schemaValue = $schema; }} | ||
131 | + {{?}} | ||
132 | +#}} | ||
133 | + | ||
134 | + | ||
135 | +{{## def.$dataNotType:_type: | ||
136 | + {{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}} | ||
137 | +#}} | ||
138 | + | ||
139 | + | ||
140 | +{{## def.check$dataIsArray: | ||
141 | + if (schema{{=$lvl}} === undefined) {{=$valid}} = true; | ||
142 | + else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false; | ||
143 | + else { | ||
144 | +#}} | ||
145 | + | ||
146 | + | ||
147 | +{{## def.beginDefOut: | ||
148 | + {{ | ||
149 | + var $$outStack = $$outStack || []; | ||
150 | + $$outStack.push(out); | ||
151 | + out = ''; | ||
152 | + }} | ||
153 | +#}} | ||
154 | + | ||
155 | + | ||
156 | +{{## def.storeDefOut:_variable: | ||
157 | + {{ | ||
158 | + var _variable = out; | ||
159 | + out = $$outStack.pop(); | ||
160 | + }} | ||
161 | +#}} | ||
162 | + | ||
163 | + | ||
164 | +{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}} | ||
165 | + | ||
166 | +{{## def.setParentData: | ||
167 | + {{ | ||
168 | + var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData' | ||
169 | + , $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; | ||
170 | + }} | ||
171 | +#}} | ||
172 | + | ||
173 | +{{## def.passParentData: | ||
174 | + {{# def.setParentData }} | ||
175 | + , {{= $parentData }} | ||
176 | + , {{= $parentDataProperty }} | ||
177 | +#}} | ||
178 | + | ||
179 | + | ||
180 | +{{## def.iterateProperties: | ||
181 | + {{? $ownProperties }} | ||
182 | + {{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}}); | ||
183 | + for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) { | ||
184 | + var {{=$key}} = {{=$dataProperties}}[{{=$idx}}]; | ||
185 | + {{??}} | ||
186 | + for (var {{=$key}} in {{=$data}}) { | ||
187 | + {{?}} | ||
188 | +#}} | ||
189 | + | ||
190 | + | ||
191 | +{{## def.noPropertyInData: | ||
192 | + {{=$useData}} === undefined | ||
193 | + {{? $ownProperties }} | ||
194 | + || !{{# def.isOwnProperty }} | ||
195 | + {{?}} | ||
196 | +#}} | ||
197 | + | ||
198 | + | ||
199 | +{{## def.isOwnProperty: | ||
200 | + Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}') | ||
201 | +#}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.missing }} | ||
4 | +{{# def.setupKeyword }} | ||
5 | +{{# def.setupNextLevel }} | ||
6 | + | ||
7 | + | ||
8 | +{{## def.propertyInData: | ||
9 | + {{=$data}}{{= it.util.getProperty($property) }} !== undefined | ||
10 | + {{? $ownProperties }} | ||
11 | + && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}') | ||
12 | + {{?}} | ||
13 | +#}} | ||
14 | + | ||
15 | + | ||
16 | +{{ | ||
17 | + var $schemaDeps = {} | ||
18 | + , $propertyDeps = {} | ||
19 | + , $ownProperties = it.opts.ownProperties; | ||
20 | + | ||
21 | + for ($property in $schema) { | ||
22 | + var $sch = $schema[$property]; | ||
23 | + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; | ||
24 | + $deps[$property] = $sch; | ||
25 | + } | ||
26 | +}} | ||
27 | + | ||
28 | +var {{=$errs}} = errors; | ||
29 | + | ||
30 | +{{ var $currentErrorPath = it.errorPath; }} | ||
31 | + | ||
32 | +var missing{{=$lvl}}; | ||
33 | +{{ for (var $property in $propertyDeps) { }} | ||
34 | + {{ $deps = $propertyDeps[$property]; }} | ||
35 | + {{? $deps.length }} | ||
36 | + if ({{# def.propertyInData }} | ||
37 | + {{? $breakOnError }} | ||
38 | + && ({{# def.checkMissingProperty:$deps }})) { | ||
39 | + {{# def.errorMissingProperty:'dependencies' }} | ||
40 | + {{??}} | ||
41 | + ) { | ||
42 | + {{~ $deps:$propertyKey }} | ||
43 | + {{# def.allErrorsMissingProperty:'dependencies' }} | ||
44 | + {{~}} | ||
45 | + {{?}} | ||
46 | + } {{# def.elseIfValid }} | ||
47 | + {{?}} | ||
48 | +{{ } }} | ||
49 | + | ||
50 | +{{ | ||
51 | + it.errorPath = $currentErrorPath; | ||
52 | + var $currentBaseId = $it.baseId; | ||
53 | +}} | ||
54 | + | ||
55 | + | ||
56 | +{{ for (var $property in $schemaDeps) { }} | ||
57 | + {{ var $sch = $schemaDeps[$property]; }} | ||
58 | + {{? {{# def.nonEmptySchema:$sch }} }} | ||
59 | + {{=$nextValid}} = true; | ||
60 | + | ||
61 | + if ({{# def.propertyInData }}) { | ||
62 | + {{ | ||
63 | + $it.schema = $sch; | ||
64 | + $it.schemaPath = $schemaPath + it.util.getProperty($property); | ||
65 | + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); | ||
66 | + }} | ||
67 | + | ||
68 | + {{# def.insertSubschemaCode }} | ||
69 | + } | ||
70 | + | ||
71 | + {{# def.ifResultValid }} | ||
72 | + {{?}} | ||
73 | +{{ } }} | ||
74 | + | ||
75 | +{{? $breakOnError }} | ||
76 | + {{= $closingBraces }} | ||
77 | + if ({{=$errs}} == errors) { | ||
78 | +{{?}} | ||
79 | + | ||
80 | +{{# def.cleanUp }} |
LINE-js/node_modules/ajv/lib/dot/enum.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{ | ||
7 | + var $i = 'i' + $lvl | ||
8 | + , $vSchema = 'schema' + $lvl; | ||
9 | +}} | ||
10 | + | ||
11 | +{{? !$isData }} | ||
12 | + var {{=$vSchema}} = validate.schema{{=$schemaPath}}; | ||
13 | +{{?}} | ||
14 | +var {{=$valid}}; | ||
15 | + | ||
16 | +{{?$isData}}{{# def.check$dataIsArray }}{{?}} | ||
17 | + | ||
18 | +{{=$valid}} = false; | ||
19 | + | ||
20 | +for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++) | ||
21 | + if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) { | ||
22 | + {{=$valid}} = true; | ||
23 | + break; | ||
24 | + } | ||
25 | + | ||
26 | +{{? $isData }} } {{?}} | ||
27 | + | ||
28 | +{{# def.checkError:'enum' }} | ||
29 | + | ||
30 | +{{? $breakOnError }} else { {{?}} |
LINE-js/node_modules/ajv/lib/dot/errors.def
0 → 100644
1 | +{{# def.definitions }} | ||
2 | + | ||
3 | +{{## def._error:_rule: | ||
4 | + {{ 'istanbul ignore else'; }} | ||
5 | + {{? it.createErrors !== false }} | ||
6 | + { | ||
7 | + keyword: '{{= $errorKeyword || _rule }}' | ||
8 | + , dataPath: (dataPath || '') + {{= it.errorPath }} | ||
9 | + , schemaPath: {{=it.util.toQuotedString($errSchemaPath)}} | ||
10 | + , params: {{# def._errorParams[_rule] }} | ||
11 | + {{? it.opts.messages !== false }} | ||
12 | + , message: {{# def._errorMessages[_rule] }} | ||
13 | + {{?}} | ||
14 | + {{? it.opts.verbose }} | ||
15 | + , schema: {{# def._errorSchemas[_rule] }} | ||
16 | + , parentSchema: validate.schema{{=it.schemaPath}} | ||
17 | + , data: {{=$data}} | ||
18 | + {{?}} | ||
19 | + } | ||
20 | + {{??}} | ||
21 | + {} | ||
22 | + {{?}} | ||
23 | +#}} | ||
24 | + | ||
25 | + | ||
26 | +{{## def._addError:_rule: | ||
27 | + if (vErrors === null) vErrors = [err]; | ||
28 | + else vErrors.push(err); | ||
29 | + errors++; | ||
30 | +#}} | ||
31 | + | ||
32 | + | ||
33 | +{{## def.addError:_rule: | ||
34 | + var err = {{# def._error:_rule }}; | ||
35 | + {{# def._addError:_rule }} | ||
36 | +#}} | ||
37 | + | ||
38 | + | ||
39 | +{{## def.error:_rule: | ||
40 | + {{# def.beginDefOut}} | ||
41 | + {{# def._error:_rule }} | ||
42 | + {{# def.storeDefOut:__err }} | ||
43 | + | ||
44 | + {{? !it.compositeRule && $breakOnError }} | ||
45 | + {{ 'istanbul ignore if'; }} | ||
46 | + {{? it.async }} | ||
47 | + throw new ValidationError([{{=__err}}]); | ||
48 | + {{??}} | ||
49 | + validate.errors = [{{=__err}}]; | ||
50 | + return false; | ||
51 | + {{?}} | ||
52 | + {{??}} | ||
53 | + var err = {{=__err}}; | ||
54 | + {{# def._addError:_rule }} | ||
55 | + {{?}} | ||
56 | +#}} | ||
57 | + | ||
58 | + | ||
59 | +{{## def.extraError:_rule: | ||
60 | + {{# def.addError:_rule}} | ||
61 | + {{? !it.compositeRule && $breakOnError }} | ||
62 | + {{ 'istanbul ignore if'; }} | ||
63 | + {{? it.async }} | ||
64 | + throw new ValidationError(vErrors); | ||
65 | + {{??}} | ||
66 | + validate.errors = vErrors; | ||
67 | + return false; | ||
68 | + {{?}} | ||
69 | + {{?}} | ||
70 | +#}} | ||
71 | + | ||
72 | + | ||
73 | +{{## def.checkError:_rule: | ||
74 | + if (!{{=$valid}}) { | ||
75 | + {{# def.error:_rule }} | ||
76 | + } | ||
77 | +#}} | ||
78 | + | ||
79 | + | ||
80 | +{{## def.resetErrors: | ||
81 | + errors = {{=$errs}}; | ||
82 | + if (vErrors !== null) { | ||
83 | + if ({{=$errs}}) vErrors.length = {{=$errs}}; | ||
84 | + else vErrors = null; | ||
85 | + } | ||
86 | +#}} | ||
87 | + | ||
88 | + | ||
89 | +{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}} | ||
90 | +{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}} | ||
91 | +{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}} | ||
92 | + | ||
93 | +{{## def._errorMessages = { | ||
94 | + 'false schema': "'boolean schema is false'", | ||
95 | + $ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'", | ||
96 | + additionalItems: "'should NOT have more than {{=$schema.length}} items'", | ||
97 | + additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'", | ||
98 | + anyOf: "'should match some schema in anyOf'", | ||
99 | + const: "'should be equal to constant'", | ||
100 | + contains: "'should contain a valid item'", | ||
101 | + dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'", | ||
102 | + 'enum': "'should be equal to one of the allowed values'", | ||
103 | + format: "'should match format \"{{#def.concatSchemaEQ}}\"'", | ||
104 | + 'if': "'should match \"' + {{=$ifClause}} + '\" schema'", | ||
105 | + _limit: "'should be {{=$opStr}} {{#def.appendSchema}}", | ||
106 | + _exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'", | ||
107 | + _limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'", | ||
108 | + _limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'", | ||
109 | + _limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'", | ||
110 | + multipleOf: "'should be multiple of {{#def.appendSchema}}", | ||
111 | + not: "'should NOT be valid'", | ||
112 | + oneOf: "'should match exactly one schema in oneOf'", | ||
113 | + pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'", | ||
114 | + propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'", | ||
115 | + required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'", | ||
116 | + type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'", | ||
117 | + uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'", | ||
118 | + custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'", | ||
119 | + patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''", | ||
120 | + switch: "'should pass \"switch\" keyword validation'", | ||
121 | + _formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'", | ||
122 | + _formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'" | ||
123 | +} #}} | ||
124 | + | ||
125 | + | ||
126 | +{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}} | ||
127 | +{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} | ||
128 | + | ||
129 | +{{## def._errorSchemas = { | ||
130 | + 'false schema': "false", | ||
131 | + $ref: "{{=it.util.toQuotedString($schema)}}", | ||
132 | + additionalItems: "false", | ||
133 | + additionalProperties: "false", | ||
134 | + anyOf: "validate.schema{{=$schemaPath}}", | ||
135 | + const: "validate.schema{{=$schemaPath}}", | ||
136 | + contains: "validate.schema{{=$schemaPath}}", | ||
137 | + dependencies: "validate.schema{{=$schemaPath}}", | ||
138 | + 'enum': "validate.schema{{=$schemaPath}}", | ||
139 | + format: "{{#def.schemaRefOrQS}}", | ||
140 | + 'if': "validate.schema{{=$schemaPath}}", | ||
141 | + _limit: "{{#def.schemaRefOrVal}}", | ||
142 | + _exclusiveLimit: "validate.schema{{=$schemaPath}}", | ||
143 | + _limitItems: "{{#def.schemaRefOrVal}}", | ||
144 | + _limitLength: "{{#def.schemaRefOrVal}}", | ||
145 | + _limitProperties:"{{#def.schemaRefOrVal}}", | ||
146 | + multipleOf: "{{#def.schemaRefOrVal}}", | ||
147 | + not: "validate.schema{{=$schemaPath}}", | ||
148 | + oneOf: "validate.schema{{=$schemaPath}}", | ||
149 | + pattern: "{{#def.schemaRefOrQS}}", | ||
150 | + propertyNames: "validate.schema{{=$schemaPath}}", | ||
151 | + required: "validate.schema{{=$schemaPath}}", | ||
152 | + type: "validate.schema{{=$schemaPath}}", | ||
153 | + uniqueItems: "{{#def.schemaRefOrVal}}", | ||
154 | + custom: "validate.schema{{=$schemaPath}}", | ||
155 | + patternRequired: "validate.schema{{=$schemaPath}}", | ||
156 | + switch: "validate.schema{{=$schemaPath}}", | ||
157 | + _formatLimit: "{{#def.schemaRefOrQS}}", | ||
158 | + _formatExclusiveLimit: "validate.schema{{=$schemaPath}}" | ||
159 | +} #}} | ||
160 | + | ||
161 | + | ||
162 | +{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} | ||
163 | + | ||
164 | +{{## def._errorParams = { | ||
165 | + 'false schema': "{}", | ||
166 | + $ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }", | ||
167 | + additionalItems: "{ limit: {{=$schema.length}} }", | ||
168 | + additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }", | ||
169 | + anyOf: "{}", | ||
170 | + const: "{ allowedValue: schema{{=$lvl}} }", | ||
171 | + contains: "{}", | ||
172 | + dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }", | ||
173 | + 'enum': "{ allowedValues: schema{{=$lvl}} }", | ||
174 | + format: "{ format: {{#def.schemaValueQS}} }", | ||
175 | + 'if': "{ failingKeyword: {{=$ifClause}} }", | ||
176 | + _limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }", | ||
177 | + _exclusiveLimit: "{}", | ||
178 | + _limitItems: "{ limit: {{=$schemaValue}} }", | ||
179 | + _limitLength: "{ limit: {{=$schemaValue}} }", | ||
180 | + _limitProperties:"{ limit: {{=$schemaValue}} }", | ||
181 | + multipleOf: "{ multipleOf: {{=$schemaValue}} }", | ||
182 | + not: "{}", | ||
183 | + oneOf: "{ passingSchemas: {{=$passingSchemas}} }", | ||
184 | + pattern: "{ pattern: {{#def.schemaValueQS}} }", | ||
185 | + propertyNames: "{ propertyName: '{{=$invalidName}}' }", | ||
186 | + required: "{ missingProperty: '{{=$missingProperty}}' }", | ||
187 | + type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }", | ||
188 | + uniqueItems: "{ i: i, j: j }", | ||
189 | + custom: "{ keyword: '{{=$rule.keyword}}' }", | ||
190 | + patternRequired: "{ missingPattern: '{{=$missingPattern}}' }", | ||
191 | + switch: "{ caseIndex: {{=$caseIndex}} }", | ||
192 | + _formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }", | ||
193 | + _formatExclusiveLimit: "{}" | ||
194 | +} #}} |
LINE-js/node_modules/ajv/lib/dot/format.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | + | ||
5 | +{{## def.skipFormat: | ||
6 | + {{? $breakOnError }} if (true) { {{?}} | ||
7 | + {{ return out; }} | ||
8 | +#}} | ||
9 | + | ||
10 | +{{? it.opts.format === false }}{{# def.skipFormat }}{{?}} | ||
11 | + | ||
12 | + | ||
13 | +{{# def.$data }} | ||
14 | + | ||
15 | + | ||
16 | +{{## def.$dataCheckFormat: | ||
17 | + {{# def.$dataNotType:'string' }} | ||
18 | + ({{? $unknownFormats != 'ignore' }} | ||
19 | + ({{=$schemaValue}} && !{{=$format}} | ||
20 | + {{? $allowUnknown }} | ||
21 | + && self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1 | ||
22 | + {{?}}) || | ||
23 | + {{?}} | ||
24 | + ({{=$format}} && {{=$formatType}} == '{{=$ruleType}}' | ||
25 | + && !(typeof {{=$format}} == 'function' | ||
26 | + ? {{? it.async}} | ||
27 | + (async{{=$lvl}} ? await {{=$format}}({{=$data}}) : {{=$format}}({{=$data}})) | ||
28 | + {{??}} | ||
29 | + {{=$format}}({{=$data}}) | ||
30 | + {{?}} | ||
31 | + : {{=$format}}.test({{=$data}})))) | ||
32 | +#}} | ||
33 | + | ||
34 | +{{## def.checkFormat: | ||
35 | + {{ | ||
36 | + var $formatRef = 'formats' + it.util.getProperty($schema); | ||
37 | + if ($isObject) $formatRef += '.validate'; | ||
38 | + }} | ||
39 | + {{? typeof $format == 'function' }} | ||
40 | + {{=$formatRef}}({{=$data}}) | ||
41 | + {{??}} | ||
42 | + {{=$formatRef}}.test({{=$data}}) | ||
43 | + {{?}} | ||
44 | +#}} | ||
45 | + | ||
46 | + | ||
47 | +{{ | ||
48 | + var $unknownFormats = it.opts.unknownFormats | ||
49 | + , $allowUnknown = Array.isArray($unknownFormats); | ||
50 | +}} | ||
51 | + | ||
52 | +{{? $isData }} | ||
53 | + {{ | ||
54 | + var $format = 'format' + $lvl | ||
55 | + , $isObject = 'isObject' + $lvl | ||
56 | + , $formatType = 'formatType' + $lvl; | ||
57 | + }} | ||
58 | + var {{=$format}} = formats[{{=$schemaValue}}]; | ||
59 | + var {{=$isObject}} = typeof {{=$format}} == 'object' | ||
60 | + && !({{=$format}} instanceof RegExp) | ||
61 | + && {{=$format}}.validate; | ||
62 | + var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string'; | ||
63 | + if ({{=$isObject}}) { | ||
64 | + {{? it.async}} | ||
65 | + var async{{=$lvl}} = {{=$format}}.async; | ||
66 | + {{?}} | ||
67 | + {{=$format}} = {{=$format}}.validate; | ||
68 | + } | ||
69 | + if ({{# def.$dataCheckFormat }}) { | ||
70 | +{{??}} | ||
71 | + {{ var $format = it.formats[$schema]; }} | ||
72 | + {{? !$format }} | ||
73 | + {{? $unknownFormats == 'ignore' }} | ||
74 | + {{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }} | ||
75 | + {{# def.skipFormat }} | ||
76 | + {{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }} | ||
77 | + {{# def.skipFormat }} | ||
78 | + {{??}} | ||
79 | + {{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }} | ||
80 | + {{?}} | ||
81 | + {{?}} | ||
82 | + {{ | ||
83 | + var $isObject = typeof $format == 'object' | ||
84 | + && !($format instanceof RegExp) | ||
85 | + && $format.validate; | ||
86 | + var $formatType = $isObject && $format.type || 'string'; | ||
87 | + if ($isObject) { | ||
88 | + var $async = $format.async === true; | ||
89 | + $format = $format.validate; | ||
90 | + } | ||
91 | + }} | ||
92 | + {{? $formatType != $ruleType }} | ||
93 | + {{# def.skipFormat }} | ||
94 | + {{?}} | ||
95 | + {{? $async }} | ||
96 | + {{ | ||
97 | + if (!it.async) throw new Error('async format in sync schema'); | ||
98 | + var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; | ||
99 | + }} | ||
100 | + if (!(await {{=$formatRef}}({{=$data}}))) { | ||
101 | + {{??}} | ||
102 | + if (!{{# def.checkFormat }}) { | ||
103 | + {{?}} | ||
104 | +{{?}} | ||
105 | + {{# def.error:'format' }} | ||
106 | + } {{? $breakOnError }} else { {{?}} |
LINE-js/node_modules/ajv/lib/dot/if.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | + | ||
7 | +{{## def.validateIfClause:_clause: | ||
8 | + {{ | ||
9 | + $it.schema = it.schema['_clause']; | ||
10 | + $it.schemaPath = it.schemaPath + '._clause'; | ||
11 | + $it.errSchemaPath = it.errSchemaPath + '/_clause'; | ||
12 | + }} | ||
13 | + {{# def.insertSubschemaCode }} | ||
14 | + {{=$valid}} = {{=$nextValid}}; | ||
15 | + {{? $thenPresent && $elsePresent }} | ||
16 | + {{ $ifClause = 'ifClause' + $lvl; }} | ||
17 | + var {{=$ifClause}} = '_clause'; | ||
18 | + {{??}} | ||
19 | + {{ $ifClause = '\'_clause\''; }} | ||
20 | + {{?}} | ||
21 | +#}} | ||
22 | + | ||
23 | +{{ | ||
24 | + var $thenSch = it.schema['then'] | ||
25 | + , $elseSch = it.schema['else'] | ||
26 | + , $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }} | ||
27 | + , $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }} | ||
28 | + , $currentBaseId = $it.baseId; | ||
29 | +}} | ||
30 | + | ||
31 | +{{? $thenPresent || $elsePresent }} | ||
32 | + {{ | ||
33 | + var $ifClause; | ||
34 | + $it.createErrors = false; | ||
35 | + $it.schema = $schema; | ||
36 | + $it.schemaPath = $schemaPath; | ||
37 | + $it.errSchemaPath = $errSchemaPath; | ||
38 | + }} | ||
39 | + var {{=$errs}} = errors; | ||
40 | + var {{=$valid}} = true; | ||
41 | + | ||
42 | + {{# def.setCompositeRule }} | ||
43 | + {{# def.insertSubschemaCode }} | ||
44 | + {{ $it.createErrors = true; }} | ||
45 | + {{# def.resetErrors }} | ||
46 | + {{# def.resetCompositeRule }} | ||
47 | + | ||
48 | + {{? $thenPresent }} | ||
49 | + if ({{=$nextValid}}) { | ||
50 | + {{# def.validateIfClause:then }} | ||
51 | + } | ||
52 | + {{? $elsePresent }} | ||
53 | + else { | ||
54 | + {{?}} | ||
55 | + {{??}} | ||
56 | + if (!{{=$nextValid}}) { | ||
57 | + {{?}} | ||
58 | + | ||
59 | + {{? $elsePresent }} | ||
60 | + {{# def.validateIfClause:else }} | ||
61 | + } | ||
62 | + {{?}} | ||
63 | + | ||
64 | + if (!{{=$valid}}) { | ||
65 | + {{# def.extraError:'if' }} | ||
66 | + } | ||
67 | + {{? $breakOnError }} else { {{?}} | ||
68 | + | ||
69 | + {{# def.cleanUp }} | ||
70 | +{{??}} | ||
71 | + {{? $breakOnError }} | ||
72 | + if (true) { | ||
73 | + {{?}} | ||
74 | +{{?}} | ||
75 | + |
LINE-js/node_modules/ajv/lib/dot/items.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | + | ||
7 | +{{## def.validateItems:startFrom: | ||
8 | + for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { | ||
9 | + {{ | ||
10 | + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); | ||
11 | + var $passData = $data + '[' + $idx + ']'; | ||
12 | + $it.dataPathArr[$dataNxt] = $idx; | ||
13 | + }} | ||
14 | + | ||
15 | + {{# def.generateSubschemaCode }} | ||
16 | + {{# def.optimizeValidate }} | ||
17 | + | ||
18 | + {{? $breakOnError }} | ||
19 | + if (!{{=$nextValid}}) break; | ||
20 | + {{?}} | ||
21 | + } | ||
22 | +#}} | ||
23 | + | ||
24 | +{{ | ||
25 | + var $idx = 'i' + $lvl | ||
26 | + , $dataNxt = $it.dataLevel = it.dataLevel + 1 | ||
27 | + , $nextData = 'data' + $dataNxt | ||
28 | + , $currentBaseId = it.baseId; | ||
29 | +}} | ||
30 | + | ||
31 | +var {{=$errs}} = errors; | ||
32 | +var {{=$valid}}; | ||
33 | + | ||
34 | +{{? Array.isArray($schema) }} | ||
35 | + {{ /* 'items' is an array of schemas */}} | ||
36 | + {{ var $additionalItems = it.schema.additionalItems; }} | ||
37 | + {{? $additionalItems === false }} | ||
38 | + {{=$valid}} = {{=$data}}.length <= {{= $schema.length }}; | ||
39 | + {{ | ||
40 | + var $currErrSchemaPath = $errSchemaPath; | ||
41 | + $errSchemaPath = it.errSchemaPath + '/additionalItems'; | ||
42 | + }} | ||
43 | + {{# def.checkError:'additionalItems' }} | ||
44 | + {{ $errSchemaPath = $currErrSchemaPath; }} | ||
45 | + {{# def.elseIfValid}} | ||
46 | + {{?}} | ||
47 | + | ||
48 | + {{~ $schema:$sch:$i }} | ||
49 | + {{? {{# def.nonEmptySchema:$sch }} }} | ||
50 | + {{=$nextValid}} = true; | ||
51 | + | ||
52 | + if ({{=$data}}.length > {{=$i}}) { | ||
53 | + {{ | ||
54 | + var $passData = $data + '[' + $i + ']'; | ||
55 | + $it.schema = $sch; | ||
56 | + $it.schemaPath = $schemaPath + '[' + $i + ']'; | ||
57 | + $it.errSchemaPath = $errSchemaPath + '/' + $i; | ||
58 | + $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); | ||
59 | + $it.dataPathArr[$dataNxt] = $i; | ||
60 | + }} | ||
61 | + | ||
62 | + {{# def.generateSubschemaCode }} | ||
63 | + {{# def.optimizeValidate }} | ||
64 | + } | ||
65 | + | ||
66 | + {{# def.ifResultValid }} | ||
67 | + {{?}} | ||
68 | + {{~}} | ||
69 | + | ||
70 | + {{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }} | ||
71 | + {{ | ||
72 | + $it.schema = $additionalItems; | ||
73 | + $it.schemaPath = it.schemaPath + '.additionalItems'; | ||
74 | + $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; | ||
75 | + }} | ||
76 | + {{=$nextValid}} = true; | ||
77 | + | ||
78 | + if ({{=$data}}.length > {{= $schema.length }}) { | ||
79 | + {{# def.validateItems: $schema.length }} | ||
80 | + } | ||
81 | + | ||
82 | + {{# def.ifResultValid }} | ||
83 | + {{?}} | ||
84 | + | ||
85 | +{{?? {{# def.nonEmptySchema:$schema }} }} | ||
86 | + {{ /* 'items' is a single schema */}} | ||
87 | + {{ | ||
88 | + $it.schema = $schema; | ||
89 | + $it.schemaPath = $schemaPath; | ||
90 | + $it.errSchemaPath = $errSchemaPath; | ||
91 | + }} | ||
92 | + {{# def.validateItems: 0 }} | ||
93 | +{{?}} | ||
94 | + | ||
95 | +{{? $breakOnError }} | ||
96 | + {{= $closingBraces }} | ||
97 | + if ({{=$errs}} == errors) { | ||
98 | +{{?}} | ||
99 | + | ||
100 | +{{# def.cleanUp }} |
LINE-js/node_modules/ajv/lib/dot/missing.def
0 → 100644
1 | +{{## def.checkMissingProperty:_properties: | ||
2 | + {{~ _properties:$propertyKey:$i }} | ||
3 | + {{?$i}} || {{?}} | ||
4 | + {{ | ||
5 | + var $prop = it.util.getProperty($propertyKey) | ||
6 | + , $useData = $data + $prop; | ||
7 | + }} | ||
8 | + ( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) ) | ||
9 | + {{~}} | ||
10 | +#}} | ||
11 | + | ||
12 | + | ||
13 | +{{## def.errorMissingProperty:_error: | ||
14 | + {{ | ||
15 | + var $propertyPath = 'missing' + $lvl | ||
16 | + , $missingProperty = '\' + ' + $propertyPath + ' + \''; | ||
17 | + if (it.opts._errorDataPathProperty) { | ||
18 | + it.errorPath = it.opts.jsonPointers | ||
19 | + ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) | ||
20 | + : $currentErrorPath + ' + ' + $propertyPath; | ||
21 | + } | ||
22 | + }} | ||
23 | + {{# def.error:_error }} | ||
24 | +#}} | ||
25 | + | ||
26 | + | ||
27 | +{{## def.allErrorsMissingProperty:_error: | ||
28 | + {{ | ||
29 | + var $prop = it.util.getProperty($propertyKey) | ||
30 | + , $missingProperty = it.util.escapeQuotes($propertyKey) | ||
31 | + , $useData = $data + $prop; | ||
32 | + if (it.opts._errorDataPathProperty) { | ||
33 | + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); | ||
34 | + } | ||
35 | + }} | ||
36 | + if ({{# def.noPropertyInData }}) { | ||
37 | + {{# def.addError:_error }} | ||
38 | + } | ||
39 | +#}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +var division{{=$lvl}}; | ||
7 | +if ({{?$isData}} | ||
8 | + {{=$schemaValue}} !== undefined && ( | ||
9 | + typeof {{=$schemaValue}} != 'number' || | ||
10 | + {{?}} | ||
11 | + (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}}, | ||
12 | + {{? it.opts.multipleOfPrecision }} | ||
13 | + Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}} | ||
14 | + {{??}} | ||
15 | + division{{=$lvl}} !== parseInt(division{{=$lvl}}) | ||
16 | + {{?}} | ||
17 | + ) | ||
18 | + {{?$isData}} ) {{?}} ) { | ||
19 | + {{# def.error:'multipleOf' }} | ||
20 | +} {{? $breakOnError }} else { {{?}} |
LINE-js/node_modules/ajv/lib/dot/not.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | +{{? {{# def.nonEmptySchema:$schema }} }} | ||
7 | + {{ | ||
8 | + $it.schema = $schema; | ||
9 | + $it.schemaPath = $schemaPath; | ||
10 | + $it.errSchemaPath = $errSchemaPath; | ||
11 | + }} | ||
12 | + | ||
13 | + var {{=$errs}} = errors; | ||
14 | + | ||
15 | + {{# def.setCompositeRule }} | ||
16 | + | ||
17 | + {{ | ||
18 | + $it.createErrors = false; | ||
19 | + var $allErrorsOption; | ||
20 | + if ($it.opts.allErrors) { | ||
21 | + $allErrorsOption = $it.opts.allErrors; | ||
22 | + $it.opts.allErrors = false; | ||
23 | + } | ||
24 | + }} | ||
25 | + {{= it.validate($it) }} | ||
26 | + {{ | ||
27 | + $it.createErrors = true; | ||
28 | + if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; | ||
29 | + }} | ||
30 | + | ||
31 | + {{# def.resetCompositeRule }} | ||
32 | + | ||
33 | + if ({{=$nextValid}}) { | ||
34 | + {{# def.error:'not' }} | ||
35 | + } else { | ||
36 | + {{# def.resetErrors }} | ||
37 | + {{? it.opts.allErrors }} } {{?}} | ||
38 | +{{??}} | ||
39 | + {{# def.addError:'not' }} | ||
40 | + {{? $breakOnError}} | ||
41 | + if (false) { | ||
42 | + {{?}} | ||
43 | +{{?}} |
LINE-js/node_modules/ajv/lib/dot/oneOf.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | +{{ | ||
7 | + var $currentBaseId = $it.baseId | ||
8 | + , $prevValid = 'prevValid' + $lvl | ||
9 | + , $passingSchemas = 'passingSchemas' + $lvl; | ||
10 | +}} | ||
11 | + | ||
12 | +var {{=$errs}} = errors | ||
13 | + , {{=$prevValid}} = false | ||
14 | + , {{=$valid}} = false | ||
15 | + , {{=$passingSchemas}} = null; | ||
16 | + | ||
17 | +{{# def.setCompositeRule }} | ||
18 | + | ||
19 | +{{~ $schema:$sch:$i }} | ||
20 | + {{? {{# def.nonEmptySchema:$sch }} }} | ||
21 | + {{ | ||
22 | + $it.schema = $sch; | ||
23 | + $it.schemaPath = $schemaPath + '[' + $i + ']'; | ||
24 | + $it.errSchemaPath = $errSchemaPath + '/' + $i; | ||
25 | + }} | ||
26 | + | ||
27 | + {{# def.insertSubschemaCode }} | ||
28 | + {{??}} | ||
29 | + var {{=$nextValid}} = true; | ||
30 | + {{?}} | ||
31 | + | ||
32 | + {{? $i }} | ||
33 | + if ({{=$nextValid}} && {{=$prevValid}}) { | ||
34 | + {{=$valid}} = false; | ||
35 | + {{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}]; | ||
36 | + } else { | ||
37 | + {{ $closingBraces += '}'; }} | ||
38 | + {{?}} | ||
39 | + | ||
40 | + if ({{=$nextValid}}) { | ||
41 | + {{=$valid}} = {{=$prevValid}} = true; | ||
42 | + {{=$passingSchemas}} = {{=$i}}; | ||
43 | + } | ||
44 | +{{~}} | ||
45 | + | ||
46 | +{{# def.resetCompositeRule }} | ||
47 | + | ||
48 | +{{= $closingBraces }} | ||
49 | + | ||
50 | +if (!{{=$valid}}) { | ||
51 | + {{# def.extraError:'oneOf' }} | ||
52 | +} else { | ||
53 | + {{# def.resetErrors }} | ||
54 | +{{? it.opts.allErrors }} } {{?}} |
LINE-js/node_modules/ajv/lib/dot/pattern.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | +{{ | ||
7 | + var $regexp = $isData | ||
8 | + ? '(new RegExp(' + $schemaValue + '))' | ||
9 | + : it.usePattern($schema); | ||
10 | +}} | ||
11 | + | ||
12 | +if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) { | ||
13 | + {{# def.error:'pattern' }} | ||
14 | +} {{? $breakOnError }} else { {{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | + | ||
7 | +{{## def.validateAdditional: | ||
8 | + {{ /* additionalProperties is schema */ | ||
9 | + $it.schema = $aProperties; | ||
10 | + $it.schemaPath = it.schemaPath + '.additionalProperties'; | ||
11 | + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; | ||
12 | + $it.errorPath = it.opts._errorDataPathProperty | ||
13 | + ? it.errorPath | ||
14 | + : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); | ||
15 | + var $passData = $data + '[' + $key + ']'; | ||
16 | + $it.dataPathArr[$dataNxt] = $key; | ||
17 | + }} | ||
18 | + | ||
19 | + {{# def.generateSubschemaCode }} | ||
20 | + {{# def.optimizeValidate }} | ||
21 | +#}} | ||
22 | + | ||
23 | + | ||
24 | +{{ | ||
25 | + var $key = 'key' + $lvl | ||
26 | + , $idx = 'idx' + $lvl | ||
27 | + , $dataNxt = $it.dataLevel = it.dataLevel + 1 | ||
28 | + , $nextData = 'data' + $dataNxt | ||
29 | + , $dataProperties = 'dataProperties' + $lvl; | ||
30 | + | ||
31 | + var $schemaKeys = Object.keys($schema || {}) | ||
32 | + , $pProperties = it.schema.patternProperties || {} | ||
33 | + , $pPropertyKeys = Object.keys($pProperties) | ||
34 | + , $aProperties = it.schema.additionalProperties | ||
35 | + , $someProperties = $schemaKeys.length || $pPropertyKeys.length | ||
36 | + , $noAdditional = $aProperties === false | ||
37 | + , $additionalIsSchema = typeof $aProperties == 'object' | ||
38 | + && Object.keys($aProperties).length | ||
39 | + , $removeAdditional = it.opts.removeAdditional | ||
40 | + , $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional | ||
41 | + , $ownProperties = it.opts.ownProperties | ||
42 | + , $currentBaseId = it.baseId; | ||
43 | + | ||
44 | + var $required = it.schema.required; | ||
45 | + if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) | ||
46 | + var $requiredHash = it.util.toHash($required); | ||
47 | +}} | ||
48 | + | ||
49 | + | ||
50 | +var {{=$errs}} = errors; | ||
51 | +var {{=$nextValid}} = true; | ||
52 | +{{? $ownProperties }} | ||
53 | + var {{=$dataProperties}} = undefined; | ||
54 | +{{?}} | ||
55 | + | ||
56 | +{{? $checkAdditional }} | ||
57 | + {{# def.iterateProperties }} | ||
58 | + {{? $someProperties }} | ||
59 | + var isAdditional{{=$lvl}} = !(false | ||
60 | + {{? $schemaKeys.length }} | ||
61 | + {{? $schemaKeys.length > 8 }} | ||
62 | + || validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}}) | ||
63 | + {{??}} | ||
64 | + {{~ $schemaKeys:$propertyKey }} | ||
65 | + || {{=$key}} == {{= it.util.toQuotedString($propertyKey) }} | ||
66 | + {{~}} | ||
67 | + {{?}} | ||
68 | + {{?}} | ||
69 | + {{? $pPropertyKeys.length }} | ||
70 | + {{~ $pPropertyKeys:$pProperty:$i }} | ||
71 | + || {{= it.usePattern($pProperty) }}.test({{=$key}}) | ||
72 | + {{~}} | ||
73 | + {{?}} | ||
74 | + ); | ||
75 | + | ||
76 | + if (isAdditional{{=$lvl}}) { | ||
77 | + {{?}} | ||
78 | + {{? $removeAdditional == 'all' }} | ||
79 | + delete {{=$data}}[{{=$key}}]; | ||
80 | + {{??}} | ||
81 | + {{ | ||
82 | + var $currentErrorPath = it.errorPath; | ||
83 | + var $additionalProperty = '\' + ' + $key + ' + \''; | ||
84 | + if (it.opts._errorDataPathProperty) { | ||
85 | + it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); | ||
86 | + } | ||
87 | + }} | ||
88 | + {{? $noAdditional }} | ||
89 | + {{? $removeAdditional }} | ||
90 | + delete {{=$data}}[{{=$key}}]; | ||
91 | + {{??}} | ||
92 | + {{=$nextValid}} = false; | ||
93 | + {{ | ||
94 | + var $currErrSchemaPath = $errSchemaPath; | ||
95 | + $errSchemaPath = it.errSchemaPath + '/additionalProperties'; | ||
96 | + }} | ||
97 | + {{# def.error:'additionalProperties' }} | ||
98 | + {{ $errSchemaPath = $currErrSchemaPath; }} | ||
99 | + {{? $breakOnError }} break; {{?}} | ||
100 | + {{?}} | ||
101 | + {{?? $additionalIsSchema }} | ||
102 | + {{? $removeAdditional == 'failing' }} | ||
103 | + var {{=$errs}} = errors; | ||
104 | + {{# def.setCompositeRule }} | ||
105 | + | ||
106 | + {{# def.validateAdditional }} | ||
107 | + | ||
108 | + if (!{{=$nextValid}}) { | ||
109 | + errors = {{=$errs}}; | ||
110 | + if (validate.errors !== null) { | ||
111 | + if (errors) validate.errors.length = errors; | ||
112 | + else validate.errors = null; | ||
113 | + } | ||
114 | + delete {{=$data}}[{{=$key}}]; | ||
115 | + } | ||
116 | + | ||
117 | + {{# def.resetCompositeRule }} | ||
118 | + {{??}} | ||
119 | + {{# def.validateAdditional }} | ||
120 | + {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} | ||
121 | + {{?}} | ||
122 | + {{?}} | ||
123 | + {{ it.errorPath = $currentErrorPath; }} | ||
124 | + {{?}} | ||
125 | + {{? $someProperties }} | ||
126 | + } | ||
127 | + {{?}} | ||
128 | + } | ||
129 | + | ||
130 | + {{# def.ifResultValid }} | ||
131 | +{{?}} | ||
132 | + | ||
133 | +{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }} | ||
134 | + | ||
135 | +{{? $schemaKeys.length }} | ||
136 | + {{~ $schemaKeys:$propertyKey }} | ||
137 | + {{ var $sch = $schema[$propertyKey]; }} | ||
138 | + | ||
139 | + {{? {{# def.nonEmptySchema:$sch}} }} | ||
140 | + {{ | ||
141 | + var $prop = it.util.getProperty($propertyKey) | ||
142 | + , $passData = $data + $prop | ||
143 | + , $hasDefault = $useDefaults && $sch.default !== undefined; | ||
144 | + $it.schema = $sch; | ||
145 | + $it.schemaPath = $schemaPath + $prop; | ||
146 | + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); | ||
147 | + $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); | ||
148 | + $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); | ||
149 | + }} | ||
150 | + | ||
151 | + {{# def.generateSubschemaCode }} | ||
152 | + | ||
153 | + {{? {{# def.willOptimize }} }} | ||
154 | + {{ | ||
155 | + $code = {{# def._optimizeValidate }}; | ||
156 | + var $useData = $passData; | ||
157 | + }} | ||
158 | + {{??}} | ||
159 | + {{ var $useData = $nextData; }} | ||
160 | + var {{=$nextData}} = {{=$passData}}; | ||
161 | + {{?}} | ||
162 | + | ||
163 | + {{? $hasDefault }} | ||
164 | + {{= $code }} | ||
165 | + {{??}} | ||
166 | + {{? $requiredHash && $requiredHash[$propertyKey] }} | ||
167 | + if ({{# def.noPropertyInData }}) { | ||
168 | + {{=$nextValid}} = false; | ||
169 | + {{ | ||
170 | + var $currentErrorPath = it.errorPath | ||
171 | + , $currErrSchemaPath = $errSchemaPath | ||
172 | + , $missingProperty = it.util.escapeQuotes($propertyKey); | ||
173 | + if (it.opts._errorDataPathProperty) { | ||
174 | + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); | ||
175 | + } | ||
176 | + $errSchemaPath = it.errSchemaPath + '/required'; | ||
177 | + }} | ||
178 | + {{# def.error:'required' }} | ||
179 | + {{ $errSchemaPath = $currErrSchemaPath; }} | ||
180 | + {{ it.errorPath = $currentErrorPath; }} | ||
181 | + } else { | ||
182 | + {{??}} | ||
183 | + {{? $breakOnError }} | ||
184 | + if ({{# def.noPropertyInData }}) { | ||
185 | + {{=$nextValid}} = true; | ||
186 | + } else { | ||
187 | + {{??}} | ||
188 | + if ({{=$useData}} !== undefined | ||
189 | + {{? $ownProperties }} | ||
190 | + && {{# def.isOwnProperty }} | ||
191 | + {{?}} | ||
192 | + ) { | ||
193 | + {{?}} | ||
194 | + {{?}} | ||
195 | + | ||
196 | + {{= $code }} | ||
197 | + } | ||
198 | + {{?}} {{ /* $hasDefault */ }} | ||
199 | + {{?}} {{ /* def.nonEmptySchema */ }} | ||
200 | + | ||
201 | + {{# def.ifResultValid }} | ||
202 | + {{~}} | ||
203 | +{{?}} | ||
204 | + | ||
205 | +{{? $pPropertyKeys.length }} | ||
206 | + {{~ $pPropertyKeys:$pProperty }} | ||
207 | + {{ var $sch = $pProperties[$pProperty]; }} | ||
208 | + | ||
209 | + {{? {{# def.nonEmptySchema:$sch}} }} | ||
210 | + {{ | ||
211 | + $it.schema = $sch; | ||
212 | + $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); | ||
213 | + $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' | ||
214 | + + it.util.escapeFragment($pProperty); | ||
215 | + }} | ||
216 | + | ||
217 | + {{# def.iterateProperties }} | ||
218 | + if ({{= it.usePattern($pProperty) }}.test({{=$key}})) { | ||
219 | + {{ | ||
220 | + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); | ||
221 | + var $passData = $data + '[' + $key + ']'; | ||
222 | + $it.dataPathArr[$dataNxt] = $key; | ||
223 | + }} | ||
224 | + | ||
225 | + {{# def.generateSubschemaCode }} | ||
226 | + {{# def.optimizeValidate }} | ||
227 | + | ||
228 | + {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} | ||
229 | + } | ||
230 | + {{? $breakOnError }} else {{=$nextValid}} = true; {{?}} | ||
231 | + } | ||
232 | + | ||
233 | + {{# def.ifResultValid }} | ||
234 | + {{?}} {{ /* def.nonEmptySchema */ }} | ||
235 | + {{~}} | ||
236 | +{{?}} | ||
237 | + | ||
238 | + | ||
239 | +{{? $breakOnError }} | ||
240 | + {{= $closingBraces }} | ||
241 | + if ({{=$errs}} == errors) { | ||
242 | +{{?}} | ||
243 | + | ||
244 | +{{# def.cleanUp }} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.setupNextLevel }} | ||
5 | + | ||
6 | +var {{=$errs}} = errors; | ||
7 | + | ||
8 | +{{? {{# def.nonEmptySchema:$schema }} }} | ||
9 | + {{ | ||
10 | + $it.schema = $schema; | ||
11 | + $it.schemaPath = $schemaPath; | ||
12 | + $it.errSchemaPath = $errSchemaPath; | ||
13 | + }} | ||
14 | + | ||
15 | + {{ | ||
16 | + var $key = 'key' + $lvl | ||
17 | + , $idx = 'idx' + $lvl | ||
18 | + , $i = 'i' + $lvl | ||
19 | + , $invalidName = '\' + ' + $key + ' + \'' | ||
20 | + , $dataNxt = $it.dataLevel = it.dataLevel + 1 | ||
21 | + , $nextData = 'data' + $dataNxt | ||
22 | + , $dataProperties = 'dataProperties' + $lvl | ||
23 | + , $ownProperties = it.opts.ownProperties | ||
24 | + , $currentBaseId = it.baseId; | ||
25 | + }} | ||
26 | + | ||
27 | + {{? $ownProperties }} | ||
28 | + var {{=$dataProperties}} = undefined; | ||
29 | + {{?}} | ||
30 | + {{# def.iterateProperties }} | ||
31 | + var startErrs{{=$lvl}} = errors; | ||
32 | + | ||
33 | + {{ var $passData = $key; }} | ||
34 | + {{# def.setCompositeRule }} | ||
35 | + {{# def.generateSubschemaCode }} | ||
36 | + {{# def.optimizeValidate }} | ||
37 | + {{# def.resetCompositeRule }} | ||
38 | + | ||
39 | + if (!{{=$nextValid}}) { | ||
40 | + for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) { | ||
41 | + vErrors[{{=$i}}].propertyName = {{=$key}}; | ||
42 | + } | ||
43 | + {{# def.extraError:'propertyNames' }} | ||
44 | + {{? $breakOnError }} break; {{?}} | ||
45 | + } | ||
46 | + } | ||
47 | +{{?}} | ||
48 | + | ||
49 | +{{? $breakOnError }} | ||
50 | + {{= $closingBraces }} | ||
51 | + if ({{=$errs}} == errors) { | ||
52 | +{{?}} | ||
53 | + | ||
54 | +{{# def.cleanUp }} |
LINE-js/node_modules/ajv/lib/dot/ref.jst
0 → 100644
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | + | ||
5 | +{{## def._validateRef:_v: | ||
6 | + {{? it.opts.passContext }} | ||
7 | + {{=_v}}.call(this, | ||
8 | + {{??}} | ||
9 | + {{=_v}}( | ||
10 | + {{?}} | ||
11 | + {{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData) | ||
12 | +#}} | ||
13 | + | ||
14 | +{{ var $async, $refCode; }} | ||
15 | +{{? $schema == '#' || $schema == '#/' }} | ||
16 | + {{ | ||
17 | + if (it.isRoot) { | ||
18 | + $async = it.async; | ||
19 | + $refCode = 'validate'; | ||
20 | + } else { | ||
21 | + $async = it.root.schema.$async === true; | ||
22 | + $refCode = 'root.refVal[0]'; | ||
23 | + } | ||
24 | + }} | ||
25 | +{{??}} | ||
26 | + {{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }} | ||
27 | + {{? $refVal === undefined }} | ||
28 | + {{ var $message = it.MissingRefError.message(it.baseId, $schema); }} | ||
29 | + {{? it.opts.missingRefs == 'fail' }} | ||
30 | + {{ it.logger.error($message); }} | ||
31 | + {{# def.error:'$ref' }} | ||
32 | + {{? $breakOnError }} if (false) { {{?}} | ||
33 | + {{?? it.opts.missingRefs == 'ignore' }} | ||
34 | + {{ it.logger.warn($message); }} | ||
35 | + {{? $breakOnError }} if (true) { {{?}} | ||
36 | + {{??}} | ||
37 | + {{ throw new it.MissingRefError(it.baseId, $schema, $message); }} | ||
38 | + {{?}} | ||
39 | + {{?? $refVal.inline }} | ||
40 | + {{# def.setupNextLevel }} | ||
41 | + {{ | ||
42 | + $it.schema = $refVal.schema; | ||
43 | + $it.schemaPath = ''; | ||
44 | + $it.errSchemaPath = $schema; | ||
45 | + }} | ||
46 | + {{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }} | ||
47 | + {{= $code }} | ||
48 | + {{? $breakOnError}} | ||
49 | + if ({{=$nextValid}}) { | ||
50 | + {{?}} | ||
51 | + {{??}} | ||
52 | + {{ | ||
53 | + $async = $refVal.$async === true || (it.async && $refVal.$async !== false); | ||
54 | + $refCode = $refVal.code; | ||
55 | + }} | ||
56 | + {{?}} | ||
57 | +{{?}} | ||
58 | + | ||
59 | +{{? $refCode }} | ||
60 | + {{# def.beginDefOut}} | ||
61 | + {{# def._validateRef:$refCode }} | ||
62 | + {{# def.storeDefOut:__callValidate }} | ||
63 | + | ||
64 | + {{? $async }} | ||
65 | + {{ if (!it.async) throw new Error('async schema referenced by sync schema'); }} | ||
66 | + {{? $breakOnError }} var {{=$valid}}; {{?}} | ||
67 | + try { | ||
68 | + await {{=__callValidate}}; | ||
69 | + {{? $breakOnError }} {{=$valid}} = true; {{?}} | ||
70 | + } catch (e) { | ||
71 | + if (!(e instanceof ValidationError)) throw e; | ||
72 | + if (vErrors === null) vErrors = e.errors; | ||
73 | + else vErrors = vErrors.concat(e.errors); | ||
74 | + errors = vErrors.length; | ||
75 | + {{? $breakOnError }} {{=$valid}} = false; {{?}} | ||
76 | + } | ||
77 | + {{? $breakOnError }} if ({{=$valid}}) { {{?}} | ||
78 | + {{??}} | ||
79 | + if (!{{=__callValidate}}) { | ||
80 | + if (vErrors === null) vErrors = {{=$refCode}}.errors; | ||
81 | + else vErrors = vErrors.concat({{=$refCode}}.errors); | ||
82 | + errors = vErrors.length; | ||
83 | + } {{? $breakOnError }} else { {{?}} | ||
84 | + {{?}} | ||
85 | +{{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.missing }} | ||
4 | +{{# def.setupKeyword }} | ||
5 | +{{# def.$data }} | ||
6 | + | ||
7 | +{{ var $vSchema = 'schema' + $lvl; }} | ||
8 | + | ||
9 | +{{## def.setupLoop: | ||
10 | + {{? !$isData }} | ||
11 | + var {{=$vSchema}} = validate.schema{{=$schemaPath}}; | ||
12 | + {{?}} | ||
13 | + | ||
14 | + {{ | ||
15 | + var $i = 'i' + $lvl | ||
16 | + , $propertyPath = 'schema' + $lvl + '[' + $i + ']' | ||
17 | + , $missingProperty = '\' + ' + $propertyPath + ' + \''; | ||
18 | + if (it.opts._errorDataPathProperty) { | ||
19 | + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); | ||
20 | + } | ||
21 | + }} | ||
22 | +#}} | ||
23 | + | ||
24 | + | ||
25 | +{{## def.isRequiredOwnProperty: | ||
26 | + Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}]) | ||
27 | +#}} | ||
28 | + | ||
29 | + | ||
30 | +{{? !$isData }} | ||
31 | + {{? $schema.length < it.opts.loopRequired && | ||
32 | + it.schema.properties && Object.keys(it.schema.properties).length }} | ||
33 | + {{ var $required = []; }} | ||
34 | + {{~ $schema:$property }} | ||
35 | + {{ var $propertySch = it.schema.properties[$property]; }} | ||
36 | + {{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }} | ||
37 | + {{ $required[$required.length] = $property; }} | ||
38 | + {{?}} | ||
39 | + {{~}} | ||
40 | + {{??}} | ||
41 | + {{ var $required = $schema; }} | ||
42 | + {{?}} | ||
43 | +{{?}} | ||
44 | + | ||
45 | + | ||
46 | +{{? $isData || $required.length }} | ||
47 | + {{ | ||
48 | + var $currentErrorPath = it.errorPath | ||
49 | + , $loopRequired = $isData || $required.length >= it.opts.loopRequired | ||
50 | + , $ownProperties = it.opts.ownProperties; | ||
51 | + }} | ||
52 | + | ||
53 | + {{? $breakOnError }} | ||
54 | + var missing{{=$lvl}}; | ||
55 | + {{? $loopRequired }} | ||
56 | + {{# def.setupLoop }} | ||
57 | + var {{=$valid}} = true; | ||
58 | + | ||
59 | + {{?$isData}}{{# def.check$dataIsArray }}{{?}} | ||
60 | + | ||
61 | + for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { | ||
62 | + {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined | ||
63 | + {{? $ownProperties }} | ||
64 | + && {{# def.isRequiredOwnProperty }} | ||
65 | + {{?}}; | ||
66 | + if (!{{=$valid}}) break; | ||
67 | + } | ||
68 | + | ||
69 | + {{? $isData }} } {{?}} | ||
70 | + | ||
71 | + {{# def.checkError:'required' }} | ||
72 | + else { | ||
73 | + {{??}} | ||
74 | + if ({{# def.checkMissingProperty:$required }}) { | ||
75 | + {{# def.errorMissingProperty:'required' }} | ||
76 | + } else { | ||
77 | + {{?}} | ||
78 | + {{??}} | ||
79 | + {{? $loopRequired }} | ||
80 | + {{# def.setupLoop }} | ||
81 | + {{? $isData }} | ||
82 | + if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) { | ||
83 | + {{# def.addError:'required' }} | ||
84 | + } else if ({{=$vSchema}} !== undefined) { | ||
85 | + {{?}} | ||
86 | + | ||
87 | + for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { | ||
88 | + if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined | ||
89 | + {{? $ownProperties }} | ||
90 | + || !{{# def.isRequiredOwnProperty }} | ||
91 | + {{?}}) { | ||
92 | + {{# def.addError:'required' }} | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + {{? $isData }} } {{?}} | ||
97 | + {{??}} | ||
98 | + {{~ $required:$propertyKey }} | ||
99 | + {{# def.allErrorsMissingProperty:'required' }} | ||
100 | + {{~}} | ||
101 | + {{?}} | ||
102 | + {{?}} | ||
103 | + | ||
104 | + {{ it.errorPath = $currentErrorPath; }} | ||
105 | + | ||
106 | +{{?? $breakOnError }} | ||
107 | + if (true) { | ||
108 | +{{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.setupKeyword }} | ||
4 | +{{# def.$data }} | ||
5 | + | ||
6 | + | ||
7 | +{{? ($schema || $isData) && it.opts.uniqueItems !== false }} | ||
8 | + {{? $isData }} | ||
9 | + var {{=$valid}}; | ||
10 | + if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined) | ||
11 | + {{=$valid}} = true; | ||
12 | + else if (typeof {{=$schemaValue}} != 'boolean') | ||
13 | + {{=$valid}} = false; | ||
14 | + else { | ||
15 | + {{?}} | ||
16 | + | ||
17 | + var i = {{=$data}}.length | ||
18 | + , {{=$valid}} = true | ||
19 | + , j; | ||
20 | + if (i > 1) { | ||
21 | + {{ | ||
22 | + var $itemType = it.schema.items && it.schema.items.type | ||
23 | + , $typeIsArray = Array.isArray($itemType); | ||
24 | + }} | ||
25 | + {{? !$itemType || $itemType == 'object' || $itemType == 'array' || | ||
26 | + ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0)) }} | ||
27 | + outer: | ||
28 | + for (;i--;) { | ||
29 | + for (j = i; j--;) { | ||
30 | + if (equal({{=$data}}[i], {{=$data}}[j])) { | ||
31 | + {{=$valid}} = false; | ||
32 | + break outer; | ||
33 | + } | ||
34 | + } | ||
35 | + } | ||
36 | + {{??}} | ||
37 | + var itemIndices = {}, item; | ||
38 | + for (;i--;) { | ||
39 | + var item = {{=$data}}[i]; | ||
40 | + {{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }} | ||
41 | + if ({{= it.util[$method]($itemType, 'item', true) }}) continue; | ||
42 | + {{? $typeIsArray}} | ||
43 | + if (typeof item == 'string') item = '"' + item; | ||
44 | + {{?}} | ||
45 | + if (typeof itemIndices[item] == 'number') { | ||
46 | + {{=$valid}} = false; | ||
47 | + j = itemIndices[item]; | ||
48 | + break; | ||
49 | + } | ||
50 | + itemIndices[item] = i; | ||
51 | + } | ||
52 | + {{?}} | ||
53 | + } | ||
54 | + | ||
55 | + {{? $isData }} } {{?}} | ||
56 | + | ||
57 | + if (!{{=$valid}}) { | ||
58 | + {{# def.error:'uniqueItems' }} | ||
59 | + } {{? $breakOnError }} else { {{?}} | ||
60 | +{{??}} | ||
61 | + {{? $breakOnError }} if (true) { {{?}} | ||
62 | +{{?}} |
1 | +{{# def.definitions }} | ||
2 | +{{# def.errors }} | ||
3 | +{{# def.defaults }} | ||
4 | +{{# def.coerce }} | ||
5 | + | ||
6 | +{{ /** | ||
7 | + * schema compilation (render) time: | ||
8 | + * it = { schema, RULES, _validate, opts } | ||
9 | + * it.validate - this template function, | ||
10 | + * it is used recursively to generate code for subschemas | ||
11 | + * | ||
12 | + * runtime: | ||
13 | + * "validate" is a variable name to which this function will be assigned | ||
14 | + * validateRef etc. are defined in the parent scope in index.js | ||
15 | + */ }} | ||
16 | + | ||
17 | +{{ | ||
18 | + var $async = it.schema.$async === true | ||
19 | + , $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref') | ||
20 | + , $id = it.self._getId(it.schema); | ||
21 | +}} | ||
22 | + | ||
23 | +{{ | ||
24 | + if (it.opts.strictKeywords) { | ||
25 | + var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); | ||
26 | + if ($unknownKwd) { | ||
27 | + var $keywordsMsg = 'unknown keyword: ' + $unknownKwd; | ||
28 | + if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg); | ||
29 | + else throw new Error($keywordsMsg); | ||
30 | + } | ||
31 | + } | ||
32 | +}} | ||
33 | + | ||
34 | +{{? it.isTop }} | ||
35 | + var validate = {{?$async}}{{it.async = true;}}async {{?}}function(data, dataPath, parentData, parentDataProperty, rootData) { | ||
36 | + 'use strict'; | ||
37 | + {{? $id && (it.opts.sourceCode || it.opts.processCode) }} | ||
38 | + {{= '/\*# sourceURL=' + $id + ' */' }} | ||
39 | + {{?}} | ||
40 | +{{?}} | ||
41 | + | ||
42 | +{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }} | ||
43 | + {{ var $keyword = 'false schema'; }} | ||
44 | + {{# def.setupKeyword }} | ||
45 | + {{? it.schema === false}} | ||
46 | + {{? it.isTop}} | ||
47 | + {{ $breakOnError = true; }} | ||
48 | + {{??}} | ||
49 | + var {{=$valid}} = false; | ||
50 | + {{?}} | ||
51 | + {{# def.error:'false schema' }} | ||
52 | + {{??}} | ||
53 | + {{? it.isTop}} | ||
54 | + {{? $async }} | ||
55 | + return data; | ||
56 | + {{??}} | ||
57 | + validate.errors = null; | ||
58 | + return true; | ||
59 | + {{?}} | ||
60 | + {{??}} | ||
61 | + var {{=$valid}} = true; | ||
62 | + {{?}} | ||
63 | + {{?}} | ||
64 | + | ||
65 | + {{? it.isTop}} | ||
66 | + }; | ||
67 | + return validate; | ||
68 | + {{?}} | ||
69 | + | ||
70 | + {{ return out; }} | ||
71 | +{{?}} | ||
72 | + | ||
73 | + | ||
74 | +{{? it.isTop }} | ||
75 | + {{ | ||
76 | + var $top = it.isTop | ||
77 | + , $lvl = it.level = 0 | ||
78 | + , $dataLvl = it.dataLevel = 0 | ||
79 | + , $data = 'data'; | ||
80 | + it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); | ||
81 | + it.baseId = it.baseId || it.rootId; | ||
82 | + delete it.isTop; | ||
83 | + | ||
84 | + it.dataPathArr = [undefined]; | ||
85 | + | ||
86 | + if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) { | ||
87 | + var $defaultMsg = 'default is ignored in the schema root'; | ||
88 | + if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg); | ||
89 | + else throw new Error($defaultMsg); | ||
90 | + } | ||
91 | + }} | ||
92 | + | ||
93 | + var vErrors = null; {{ /* don't edit, used in replace */ }} | ||
94 | + var errors = 0; {{ /* don't edit, used in replace */ }} | ||
95 | + if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }} | ||
96 | +{{??}} | ||
97 | + {{ | ||
98 | + var $lvl = it.level | ||
99 | + , $dataLvl = it.dataLevel | ||
100 | + , $data = 'data' + ($dataLvl || ''); | ||
101 | + | ||
102 | + if ($id) it.baseId = it.resolve.url(it.baseId, $id); | ||
103 | + | ||
104 | + if ($async && !it.async) throw new Error('async schema in sync schema'); | ||
105 | + }} | ||
106 | + | ||
107 | + var errs_{{=$lvl}} = errors; | ||
108 | +{{?}} | ||
109 | + | ||
110 | +{{ | ||
111 | + var $valid = 'valid' + $lvl | ||
112 | + , $breakOnError = !it.opts.allErrors | ||
113 | + , $closingBraces1 = '' | ||
114 | + , $closingBraces2 = ''; | ||
115 | + | ||
116 | + var $errorKeyword; | ||
117 | + var $typeSchema = it.schema.type | ||
118 | + , $typeIsArray = Array.isArray($typeSchema); | ||
119 | + | ||
120 | + if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { | ||
121 | + if ($typeIsArray) { | ||
122 | + if ($typeSchema.indexOf('null') == -1) | ||
123 | + $typeSchema = $typeSchema.concat('null'); | ||
124 | + } else if ($typeSchema != 'null') { | ||
125 | + $typeSchema = [$typeSchema, 'null']; | ||
126 | + $typeIsArray = true; | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + if ($typeIsArray && $typeSchema.length == 1) { | ||
131 | + $typeSchema = $typeSchema[0]; | ||
132 | + $typeIsArray = false; | ||
133 | + } | ||
134 | +}} | ||
135 | + | ||
136 | +{{## def.checkType: | ||
137 | + {{ | ||
138 | + var $schemaPath = it.schemaPath + '.type' | ||
139 | + , $errSchemaPath = it.errSchemaPath + '/type' | ||
140 | + , $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; | ||
141 | + }} | ||
142 | + | ||
143 | + if ({{= it.util[$method]($typeSchema, $data, true) }}) { | ||
144 | +#}} | ||
145 | + | ||
146 | +{{? it.schema.$ref && $refKeywords }} | ||
147 | + {{? it.opts.extendRefs == 'fail' }} | ||
148 | + {{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }} | ||
149 | + {{?? it.opts.extendRefs !== true }} | ||
150 | + {{ | ||
151 | + $refKeywords = false; | ||
152 | + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); | ||
153 | + }} | ||
154 | + {{?}} | ||
155 | +{{?}} | ||
156 | + | ||
157 | +{{? it.schema.$comment && it.opts.$comment }} | ||
158 | + {{= it.RULES.all.$comment.code(it, '$comment') }} | ||
159 | +{{?}} | ||
160 | + | ||
161 | +{{? $typeSchema }} | ||
162 | + {{? it.opts.coerceTypes }} | ||
163 | + {{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }} | ||
164 | + {{?}} | ||
165 | + | ||
166 | + {{ var $rulesGroup = it.RULES.types[$typeSchema]; }} | ||
167 | + {{? $coerceToTypes || $typeIsArray || $rulesGroup === true || | ||
168 | + ($rulesGroup && !$shouldUseGroup($rulesGroup)) }} | ||
169 | + {{ | ||
170 | + var $schemaPath = it.schemaPath + '.type' | ||
171 | + , $errSchemaPath = it.errSchemaPath + '/type'; | ||
172 | + }} | ||
173 | + {{# def.checkType }} | ||
174 | + {{? $coerceToTypes }} | ||
175 | + {{# def.coerceType }} | ||
176 | + {{??}} | ||
177 | + {{# def.error:'type' }} | ||
178 | + {{?}} | ||
179 | + } | ||
180 | + {{?}} | ||
181 | +{{?}} | ||
182 | + | ||
183 | + | ||
184 | +{{? it.schema.$ref && !$refKeywords }} | ||
185 | + {{= it.RULES.all.$ref.code(it, '$ref') }} | ||
186 | + {{? $breakOnError }} | ||
187 | + } | ||
188 | + if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { | ||
189 | + {{ $closingBraces2 += '}'; }} | ||
190 | + {{?}} | ||
191 | +{{??}} | ||
192 | + {{~ it.RULES:$rulesGroup }} | ||
193 | + {{? $shouldUseGroup($rulesGroup) }} | ||
194 | + {{? $rulesGroup.type }} | ||
195 | + if ({{= it.util.checkDataType($rulesGroup.type, $data) }}) { | ||
196 | + {{?}} | ||
197 | + {{? it.opts.useDefaults }} | ||
198 | + {{? $rulesGroup.type == 'object' && it.schema.properties }} | ||
199 | + {{# def.defaultProperties }} | ||
200 | + {{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }} | ||
201 | + {{# def.defaultItems }} | ||
202 | + {{?}} | ||
203 | + {{?}} | ||
204 | + {{~ $rulesGroup.rules:$rule }} | ||
205 | + {{? $shouldUseRule($rule) }} | ||
206 | + {{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }} | ||
207 | + {{? $code }} | ||
208 | + {{= $code }} | ||
209 | + {{? $breakOnError }} | ||
210 | + {{ $closingBraces1 += '}'; }} | ||
211 | + {{?}} | ||
212 | + {{?}} | ||
213 | + {{?}} | ||
214 | + {{~}} | ||
215 | + {{? $breakOnError }} | ||
216 | + {{= $closingBraces1 }} | ||
217 | + {{ $closingBraces1 = ''; }} | ||
218 | + {{?}} | ||
219 | + {{? $rulesGroup.type }} | ||
220 | + } | ||
221 | + {{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }} | ||
222 | + else { | ||
223 | + {{ | ||
224 | + var $schemaPath = it.schemaPath + '.type' | ||
225 | + , $errSchemaPath = it.errSchemaPath + '/type'; | ||
226 | + }} | ||
227 | + {{# def.error:'type' }} | ||
228 | + } | ||
229 | + {{?}} | ||
230 | + {{?}} | ||
231 | + | ||
232 | + {{? $breakOnError }} | ||
233 | + if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { | ||
234 | + {{ $closingBraces2 += '}'; }} | ||
235 | + {{?}} | ||
236 | + {{?}} | ||
237 | + {{~}} | ||
238 | +{{?}} | ||
239 | + | ||
240 | +{{? $breakOnError }} {{= $closingBraces2 }} {{?}} | ||
241 | + | ||
242 | +{{? $top }} | ||
243 | + {{? $async }} | ||
244 | + if (errors === 0) return data; {{ /* don't edit, used in replace */ }} | ||
245 | + else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }} | ||
246 | + {{??}} | ||
247 | + validate.errors = vErrors; {{ /* don't edit, used in replace */ }} | ||
248 | + return errors === 0; {{ /* don't edit, used in replace */ }} | ||
249 | + {{?}} | ||
250 | + }; | ||
251 | + | ||
252 | + return validate; | ||
253 | +{{??}} | ||
254 | + var {{=$valid}} = errors === errs_{{=$lvl}}; | ||
255 | +{{?}} | ||
256 | + | ||
257 | +{{# def.cleanUp }} | ||
258 | + | ||
259 | +{{? $top }} | ||
260 | + {{# def.finalCleanUp }} | ||
261 | +{{?}} | ||
262 | + | ||
263 | +{{ | ||
264 | + function $shouldUseGroup($rulesGroup) { | ||
265 | + var rules = $rulesGroup.rules; | ||
266 | + for (var i=0; i < rules.length; i++) | ||
267 | + if ($shouldUseRule(rules[i])) | ||
268 | + return true; | ||
269 | + } | ||
270 | + | ||
271 | + function $shouldUseRule($rule) { | ||
272 | + return it.schema[$rule.keyword] !== undefined || | ||
273 | + ($rule.implements && $ruleImplementsSomeKeyword($rule)); | ||
274 | + } | ||
275 | + | ||
276 | + function $ruleImplementsSomeKeyword($rule) { | ||
277 | + var impl = $rule.implements; | ||
278 | + for (var i=0; i < impl.length; i++) | ||
279 | + if (it.schema[impl[i]] !== undefined) | ||
280 | + return true; | ||
281 | + } | ||
282 | +}} |
LINE-js/node_modules/ajv/lib/dotjs/README.md
0 → 100644
LINE-js/node_modules/ajv/lib/dotjs/_limit.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate__limit(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $errorKeyword; | ||
11 | + var $data = 'data' + ($dataLvl || ''); | ||
12 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
13 | + $schemaValue; | ||
14 | + if ($isData) { | ||
15 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
16 | + $schemaValue = 'schema' + $lvl; | ||
17 | + } else { | ||
18 | + $schemaValue = $schema; | ||
19 | + } | ||
20 | + var $isMax = $keyword == 'maximum', | ||
21 | + $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', | ||
22 | + $schemaExcl = it.schema[$exclusiveKeyword], | ||
23 | + $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, | ||
24 | + $op = $isMax ? '<' : '>', | ||
25 | + $notOp = $isMax ? '>' : '<', | ||
26 | + $errorKeyword = undefined; | ||
27 | + if ($isDataExcl) { | ||
28 | + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), | ||
29 | + $exclusive = 'exclusive' + $lvl, | ||
30 | + $exclType = 'exclType' + $lvl, | ||
31 | + $exclIsNumber = 'exclIsNumber' + $lvl, | ||
32 | + $opExpr = 'op' + $lvl, | ||
33 | + $opStr = '\' + ' + $opExpr + ' + \''; | ||
34 | + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; | ||
35 | + $schemaValueExcl = 'schemaExcl' + $lvl; | ||
36 | + out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; | ||
37 | + var $errorKeyword = $exclusiveKeyword; | ||
38 | + var $$outStack = $$outStack || []; | ||
39 | + $$outStack.push(out); | ||
40 | + out = ''; /* istanbul ignore else */ | ||
41 | + if (it.createErrors !== false) { | ||
42 | + out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; | ||
43 | + if (it.opts.messages !== false) { | ||
44 | + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; | ||
45 | + } | ||
46 | + if (it.opts.verbose) { | ||
47 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
48 | + } | ||
49 | + out += ' } '; | ||
50 | + } else { | ||
51 | + out += ' {} '; | ||
52 | + } | ||
53 | + var __err = out; | ||
54 | + out = $$outStack.pop(); | ||
55 | + if (!it.compositeRule && $breakOnError) { | ||
56 | + /* istanbul ignore if */ | ||
57 | + if (it.async) { | ||
58 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
59 | + } else { | ||
60 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
61 | + } | ||
62 | + } else { | ||
63 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
64 | + } | ||
65 | + out += ' } else if ( '; | ||
66 | + if ($isData) { | ||
67 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; | ||
68 | + } | ||
69 | + out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; '; | ||
70 | + if ($schema === undefined) { | ||
71 | + $errorKeyword = $exclusiveKeyword; | ||
72 | + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; | ||
73 | + $schemaValue = $schemaValueExcl; | ||
74 | + $isData = $isDataExcl; | ||
75 | + } | ||
76 | + } else { | ||
77 | + var $exclIsNumber = typeof $schemaExcl == 'number', | ||
78 | + $opStr = $op; | ||
79 | + if ($exclIsNumber && $isData) { | ||
80 | + var $opExpr = '\'' + $opStr + '\''; | ||
81 | + out += ' if ( '; | ||
82 | + if ($isData) { | ||
83 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; | ||
84 | + } | ||
85 | + out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; | ||
86 | + } else { | ||
87 | + if ($exclIsNumber && $schema === undefined) { | ||
88 | + $exclusive = true; | ||
89 | + $errorKeyword = $exclusiveKeyword; | ||
90 | + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; | ||
91 | + $schemaValue = $schemaExcl; | ||
92 | + $notOp += '='; | ||
93 | + } else { | ||
94 | + if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); | ||
95 | + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { | ||
96 | + $exclusive = true; | ||
97 | + $errorKeyword = $exclusiveKeyword; | ||
98 | + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; | ||
99 | + $notOp += '='; | ||
100 | + } else { | ||
101 | + $exclusive = false; | ||
102 | + $opStr += '='; | ||
103 | + } | ||
104 | + } | ||
105 | + var $opExpr = '\'' + $opStr + '\''; | ||
106 | + out += ' if ( '; | ||
107 | + if ($isData) { | ||
108 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; | ||
109 | + } | ||
110 | + out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; | ||
111 | + } | ||
112 | + } | ||
113 | + $errorKeyword = $errorKeyword || $keyword; | ||
114 | + var $$outStack = $$outStack || []; | ||
115 | + $$outStack.push(out); | ||
116 | + out = ''; /* istanbul ignore else */ | ||
117 | + if (it.createErrors !== false) { | ||
118 | + out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; | ||
119 | + if (it.opts.messages !== false) { | ||
120 | + out += ' , message: \'should be ' + ($opStr) + ' '; | ||
121 | + if ($isData) { | ||
122 | + out += '\' + ' + ($schemaValue); | ||
123 | + } else { | ||
124 | + out += '' + ($schemaValue) + '\''; | ||
125 | + } | ||
126 | + } | ||
127 | + if (it.opts.verbose) { | ||
128 | + out += ' , schema: '; | ||
129 | + if ($isData) { | ||
130 | + out += 'validate.schema' + ($schemaPath); | ||
131 | + } else { | ||
132 | + out += '' + ($schema); | ||
133 | + } | ||
134 | + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
135 | + } | ||
136 | + out += ' } '; | ||
137 | + } else { | ||
138 | + out += ' {} '; | ||
139 | + } | ||
140 | + var __err = out; | ||
141 | + out = $$outStack.pop(); | ||
142 | + if (!it.compositeRule && $breakOnError) { | ||
143 | + /* istanbul ignore if */ | ||
144 | + if (it.async) { | ||
145 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
146 | + } else { | ||
147 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
148 | + } | ||
149 | + } else { | ||
150 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
151 | + } | ||
152 | + out += ' } '; | ||
153 | + if ($breakOnError) { | ||
154 | + out += ' else { '; | ||
155 | + } | ||
156 | + return out; | ||
157 | +} |
1 | +'use strict'; | ||
2 | +module.exports = function generate__limitItems(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $errorKeyword; | ||
11 | + var $data = 'data' + ($dataLvl || ''); | ||
12 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
13 | + $schemaValue; | ||
14 | + if ($isData) { | ||
15 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
16 | + $schemaValue = 'schema' + $lvl; | ||
17 | + } else { | ||
18 | + $schemaValue = $schema; | ||
19 | + } | ||
20 | + var $op = $keyword == 'maxItems' ? '>' : '<'; | ||
21 | + out += 'if ( '; | ||
22 | + if ($isData) { | ||
23 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; | ||
24 | + } | ||
25 | + out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; | ||
26 | + var $errorKeyword = $keyword; | ||
27 | + var $$outStack = $$outStack || []; | ||
28 | + $$outStack.push(out); | ||
29 | + out = ''; /* istanbul ignore else */ | ||
30 | + if (it.createErrors !== false) { | ||
31 | + out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; | ||
32 | + if (it.opts.messages !== false) { | ||
33 | + out += ' , message: \'should NOT have '; | ||
34 | + if ($keyword == 'maxItems') { | ||
35 | + out += 'more'; | ||
36 | + } else { | ||
37 | + out += 'fewer'; | ||
38 | + } | ||
39 | + out += ' than '; | ||
40 | + if ($isData) { | ||
41 | + out += '\' + ' + ($schemaValue) + ' + \''; | ||
42 | + } else { | ||
43 | + out += '' + ($schema); | ||
44 | + } | ||
45 | + out += ' items\' '; | ||
46 | + } | ||
47 | + if (it.opts.verbose) { | ||
48 | + out += ' , schema: '; | ||
49 | + if ($isData) { | ||
50 | + out += 'validate.schema' + ($schemaPath); | ||
51 | + } else { | ||
52 | + out += '' + ($schema); | ||
53 | + } | ||
54 | + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
55 | + } | ||
56 | + out += ' } '; | ||
57 | + } else { | ||
58 | + out += ' {} '; | ||
59 | + } | ||
60 | + var __err = out; | ||
61 | + out = $$outStack.pop(); | ||
62 | + if (!it.compositeRule && $breakOnError) { | ||
63 | + /* istanbul ignore if */ | ||
64 | + if (it.async) { | ||
65 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
66 | + } else { | ||
67 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
68 | + } | ||
69 | + } else { | ||
70 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
71 | + } | ||
72 | + out += '} '; | ||
73 | + if ($breakOnError) { | ||
74 | + out += ' else { '; | ||
75 | + } | ||
76 | + return out; | ||
77 | +} |
1 | +'use strict'; | ||
2 | +module.exports = function generate__limitLength(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $errorKeyword; | ||
11 | + var $data = 'data' + ($dataLvl || ''); | ||
12 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
13 | + $schemaValue; | ||
14 | + if ($isData) { | ||
15 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
16 | + $schemaValue = 'schema' + $lvl; | ||
17 | + } else { | ||
18 | + $schemaValue = $schema; | ||
19 | + } | ||
20 | + var $op = $keyword == 'maxLength' ? '>' : '<'; | ||
21 | + out += 'if ( '; | ||
22 | + if ($isData) { | ||
23 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; | ||
24 | + } | ||
25 | + if (it.opts.unicode === false) { | ||
26 | + out += ' ' + ($data) + '.length '; | ||
27 | + } else { | ||
28 | + out += ' ucs2length(' + ($data) + ') '; | ||
29 | + } | ||
30 | + out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; | ||
31 | + var $errorKeyword = $keyword; | ||
32 | + var $$outStack = $$outStack || []; | ||
33 | + $$outStack.push(out); | ||
34 | + out = ''; /* istanbul ignore else */ | ||
35 | + if (it.createErrors !== false) { | ||
36 | + out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; | ||
37 | + if (it.opts.messages !== false) { | ||
38 | + out += ' , message: \'should NOT be '; | ||
39 | + if ($keyword == 'maxLength') { | ||
40 | + out += 'longer'; | ||
41 | + } else { | ||
42 | + out += 'shorter'; | ||
43 | + } | ||
44 | + out += ' than '; | ||
45 | + if ($isData) { | ||
46 | + out += '\' + ' + ($schemaValue) + ' + \''; | ||
47 | + } else { | ||
48 | + out += '' + ($schema); | ||
49 | + } | ||
50 | + out += ' characters\' '; | ||
51 | + } | ||
52 | + if (it.opts.verbose) { | ||
53 | + out += ' , schema: '; | ||
54 | + if ($isData) { | ||
55 | + out += 'validate.schema' + ($schemaPath); | ||
56 | + } else { | ||
57 | + out += '' + ($schema); | ||
58 | + } | ||
59 | + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
60 | + } | ||
61 | + out += ' } '; | ||
62 | + } else { | ||
63 | + out += ' {} '; | ||
64 | + } | ||
65 | + var __err = out; | ||
66 | + out = $$outStack.pop(); | ||
67 | + if (!it.compositeRule && $breakOnError) { | ||
68 | + /* istanbul ignore if */ | ||
69 | + if (it.async) { | ||
70 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
71 | + } else { | ||
72 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
73 | + } | ||
74 | + } else { | ||
75 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
76 | + } | ||
77 | + out += '} '; | ||
78 | + if ($breakOnError) { | ||
79 | + out += ' else { '; | ||
80 | + } | ||
81 | + return out; | ||
82 | +} |
1 | +'use strict'; | ||
2 | +module.exports = function generate__limitProperties(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $errorKeyword; | ||
11 | + var $data = 'data' + ($dataLvl || ''); | ||
12 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
13 | + $schemaValue; | ||
14 | + if ($isData) { | ||
15 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
16 | + $schemaValue = 'schema' + $lvl; | ||
17 | + } else { | ||
18 | + $schemaValue = $schema; | ||
19 | + } | ||
20 | + var $op = $keyword == 'maxProperties' ? '>' : '<'; | ||
21 | + out += 'if ( '; | ||
22 | + if ($isData) { | ||
23 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; | ||
24 | + } | ||
25 | + out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; | ||
26 | + var $errorKeyword = $keyword; | ||
27 | + var $$outStack = $$outStack || []; | ||
28 | + $$outStack.push(out); | ||
29 | + out = ''; /* istanbul ignore else */ | ||
30 | + if (it.createErrors !== false) { | ||
31 | + out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; | ||
32 | + if (it.opts.messages !== false) { | ||
33 | + out += ' , message: \'should NOT have '; | ||
34 | + if ($keyword == 'maxProperties') { | ||
35 | + out += 'more'; | ||
36 | + } else { | ||
37 | + out += 'fewer'; | ||
38 | + } | ||
39 | + out += ' than '; | ||
40 | + if ($isData) { | ||
41 | + out += '\' + ' + ($schemaValue) + ' + \''; | ||
42 | + } else { | ||
43 | + out += '' + ($schema); | ||
44 | + } | ||
45 | + out += ' properties\' '; | ||
46 | + } | ||
47 | + if (it.opts.verbose) { | ||
48 | + out += ' , schema: '; | ||
49 | + if ($isData) { | ||
50 | + out += 'validate.schema' + ($schemaPath); | ||
51 | + } else { | ||
52 | + out += '' + ($schema); | ||
53 | + } | ||
54 | + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
55 | + } | ||
56 | + out += ' } '; | ||
57 | + } else { | ||
58 | + out += ' {} '; | ||
59 | + } | ||
60 | + var __err = out; | ||
61 | + out = $$outStack.pop(); | ||
62 | + if (!it.compositeRule && $breakOnError) { | ||
63 | + /* istanbul ignore if */ | ||
64 | + if (it.async) { | ||
65 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
66 | + } else { | ||
67 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
68 | + } | ||
69 | + } else { | ||
70 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
71 | + } | ||
72 | + out += '} '; | ||
73 | + if ($breakOnError) { | ||
74 | + out += ' else { '; | ||
75 | + } | ||
76 | + return out; | ||
77 | +} |
LINE-js/node_modules/ajv/lib/dotjs/allOf.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate_allOf(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $schema = it.schema[$keyword]; | ||
5 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
6 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
7 | + var $breakOnError = !it.opts.allErrors; | ||
8 | + var $it = it.util.copy(it); | ||
9 | + var $closingBraces = ''; | ||
10 | + $it.level++; | ||
11 | + var $nextValid = 'valid' + $it.level; | ||
12 | + var $currentBaseId = $it.baseId, | ||
13 | + $allSchemasEmpty = true; | ||
14 | + var arr1 = $schema; | ||
15 | + if (arr1) { | ||
16 | + var $sch, $i = -1, | ||
17 | + l1 = arr1.length - 1; | ||
18 | + while ($i < l1) { | ||
19 | + $sch = arr1[$i += 1]; | ||
20 | + if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { | ||
21 | + $allSchemasEmpty = false; | ||
22 | + $it.schema = $sch; | ||
23 | + $it.schemaPath = $schemaPath + '[' + $i + ']'; | ||
24 | + $it.errSchemaPath = $errSchemaPath + '/' + $i; | ||
25 | + out += ' ' + (it.validate($it)) + ' '; | ||
26 | + $it.baseId = $currentBaseId; | ||
27 | + if ($breakOnError) { | ||
28 | + out += ' if (' + ($nextValid) + ') { '; | ||
29 | + $closingBraces += '}'; | ||
30 | + } | ||
31 | + } | ||
32 | + } | ||
33 | + } | ||
34 | + if ($breakOnError) { | ||
35 | + if ($allSchemasEmpty) { | ||
36 | + out += ' if (true) { '; | ||
37 | + } else { | ||
38 | + out += ' ' + ($closingBraces.slice(0, -1)) + ' '; | ||
39 | + } | ||
40 | + } | ||
41 | + out = it.util.cleanUpCode(out); | ||
42 | + return out; | ||
43 | +} |
LINE-js/node_modules/ajv/lib/dotjs/anyOf.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate_anyOf(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $data = 'data' + ($dataLvl || ''); | ||
11 | + var $valid = 'valid' + $lvl; | ||
12 | + var $errs = 'errs__' + $lvl; | ||
13 | + var $it = it.util.copy(it); | ||
14 | + var $closingBraces = ''; | ||
15 | + $it.level++; | ||
16 | + var $nextValid = 'valid' + $it.level; | ||
17 | + var $noEmptySchema = $schema.every(function($sch) { | ||
18 | + return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all)); | ||
19 | + }); | ||
20 | + if ($noEmptySchema) { | ||
21 | + var $currentBaseId = $it.baseId; | ||
22 | + out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; | ||
23 | + var $wasComposite = it.compositeRule; | ||
24 | + it.compositeRule = $it.compositeRule = true; | ||
25 | + var arr1 = $schema; | ||
26 | + if (arr1) { | ||
27 | + var $sch, $i = -1, | ||
28 | + l1 = arr1.length - 1; | ||
29 | + while ($i < l1) { | ||
30 | + $sch = arr1[$i += 1]; | ||
31 | + $it.schema = $sch; | ||
32 | + $it.schemaPath = $schemaPath + '[' + $i + ']'; | ||
33 | + $it.errSchemaPath = $errSchemaPath + '/' + $i; | ||
34 | + out += ' ' + (it.validate($it)) + ' '; | ||
35 | + $it.baseId = $currentBaseId; | ||
36 | + out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; | ||
37 | + $closingBraces += '}'; | ||
38 | + } | ||
39 | + } | ||
40 | + it.compositeRule = $it.compositeRule = $wasComposite; | ||
41 | + out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ | ||
42 | + if (it.createErrors !== false) { | ||
43 | + out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; | ||
44 | + if (it.opts.messages !== false) { | ||
45 | + out += ' , message: \'should match some schema in anyOf\' '; | ||
46 | + } | ||
47 | + if (it.opts.verbose) { | ||
48 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
49 | + } | ||
50 | + out += ' } '; | ||
51 | + } else { | ||
52 | + out += ' {} '; | ||
53 | + } | ||
54 | + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
55 | + if (!it.compositeRule && $breakOnError) { | ||
56 | + /* istanbul ignore if */ | ||
57 | + if (it.async) { | ||
58 | + out += ' throw new ValidationError(vErrors); '; | ||
59 | + } else { | ||
60 | + out += ' validate.errors = vErrors; return false; '; | ||
61 | + } | ||
62 | + } | ||
63 | + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; | ||
64 | + if (it.opts.allErrors) { | ||
65 | + out += ' } '; | ||
66 | + } | ||
67 | + out = it.util.cleanUpCode(out); | ||
68 | + } else { | ||
69 | + if ($breakOnError) { | ||
70 | + out += ' if (true) { '; | ||
71 | + } | ||
72 | + } | ||
73 | + return out; | ||
74 | +} |
1 | +'use strict'; | ||
2 | +module.exports = function generate_comment(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $schema = it.schema[$keyword]; | ||
5 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
6 | + var $breakOnError = !it.opts.allErrors; | ||
7 | + var $comment = it.util.toQuotedString($schema); | ||
8 | + if (it.opts.$comment === true) { | ||
9 | + out += ' console.log(' + ($comment) + ');'; | ||
10 | + } else if (typeof it.opts.$comment == 'function') { | ||
11 | + out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);'; | ||
12 | + } | ||
13 | + return out; | ||
14 | +} |
LINE-js/node_modules/ajv/lib/dotjs/const.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate_const(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $data = 'data' + ($dataLvl || ''); | ||
11 | + var $valid = 'valid' + $lvl; | ||
12 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
13 | + $schemaValue; | ||
14 | + if ($isData) { | ||
15 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
16 | + $schemaValue = 'schema' + $lvl; | ||
17 | + } else { | ||
18 | + $schemaValue = $schema; | ||
19 | + } | ||
20 | + if (!$isData) { | ||
21 | + out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; | ||
22 | + } | ||
23 | + out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; | ||
24 | + var $$outStack = $$outStack || []; | ||
25 | + $$outStack.push(out); | ||
26 | + out = ''; /* istanbul ignore else */ | ||
27 | + if (it.createErrors !== false) { | ||
28 | + out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } '; | ||
29 | + if (it.opts.messages !== false) { | ||
30 | + out += ' , message: \'should be equal to constant\' '; | ||
31 | + } | ||
32 | + if (it.opts.verbose) { | ||
33 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
34 | + } | ||
35 | + out += ' } '; | ||
36 | + } else { | ||
37 | + out += ' {} '; | ||
38 | + } | ||
39 | + var __err = out; | ||
40 | + out = $$outStack.pop(); | ||
41 | + if (!it.compositeRule && $breakOnError) { | ||
42 | + /* istanbul ignore if */ | ||
43 | + if (it.async) { | ||
44 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
45 | + } else { | ||
46 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
47 | + } | ||
48 | + } else { | ||
49 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
50 | + } | ||
51 | + out += ' }'; | ||
52 | + if ($breakOnError) { | ||
53 | + out += ' else { '; | ||
54 | + } | ||
55 | + return out; | ||
56 | +} |
1 | +'use strict'; | ||
2 | +module.exports = function generate_contains(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $data = 'data' + ($dataLvl || ''); | ||
11 | + var $valid = 'valid' + $lvl; | ||
12 | + var $errs = 'errs__' + $lvl; | ||
13 | + var $it = it.util.copy(it); | ||
14 | + var $closingBraces = ''; | ||
15 | + $it.level++; | ||
16 | + var $nextValid = 'valid' + $it.level; | ||
17 | + var $idx = 'i' + $lvl, | ||
18 | + $dataNxt = $it.dataLevel = it.dataLevel + 1, | ||
19 | + $nextData = 'data' + $dataNxt, | ||
20 | + $currentBaseId = it.baseId, | ||
21 | + $nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all)); | ||
22 | + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; | ||
23 | + if ($nonEmptySchema) { | ||
24 | + var $wasComposite = it.compositeRule; | ||
25 | + it.compositeRule = $it.compositeRule = true; | ||
26 | + $it.schema = $schema; | ||
27 | + $it.schemaPath = $schemaPath; | ||
28 | + $it.errSchemaPath = $errSchemaPath; | ||
29 | + out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; | ||
30 | + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); | ||
31 | + var $passData = $data + '[' + $idx + ']'; | ||
32 | + $it.dataPathArr[$dataNxt] = $idx; | ||
33 | + var $code = it.validate($it); | ||
34 | + $it.baseId = $currentBaseId; | ||
35 | + if (it.util.varOccurences($code, $nextData) < 2) { | ||
36 | + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; | ||
37 | + } else { | ||
38 | + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; | ||
39 | + } | ||
40 | + out += ' if (' + ($nextValid) + ') break; } '; | ||
41 | + it.compositeRule = $it.compositeRule = $wasComposite; | ||
42 | + out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; | ||
43 | + } else { | ||
44 | + out += ' if (' + ($data) + '.length == 0) {'; | ||
45 | + } | ||
46 | + var $$outStack = $$outStack || []; | ||
47 | + $$outStack.push(out); | ||
48 | + out = ''; /* istanbul ignore else */ | ||
49 | + if (it.createErrors !== false) { | ||
50 | + out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; | ||
51 | + if (it.opts.messages !== false) { | ||
52 | + out += ' , message: \'should contain a valid item\' '; | ||
53 | + } | ||
54 | + if (it.opts.verbose) { | ||
55 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
56 | + } | ||
57 | + out += ' } '; | ||
58 | + } else { | ||
59 | + out += ' {} '; | ||
60 | + } | ||
61 | + var __err = out; | ||
62 | + out = $$outStack.pop(); | ||
63 | + if (!it.compositeRule && $breakOnError) { | ||
64 | + /* istanbul ignore if */ | ||
65 | + if (it.async) { | ||
66 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
67 | + } else { | ||
68 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
69 | + } | ||
70 | + } else { | ||
71 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
72 | + } | ||
73 | + out += ' } else { '; | ||
74 | + if ($nonEmptySchema) { | ||
75 | + out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; | ||
76 | + } | ||
77 | + if (it.opts.allErrors) { | ||
78 | + out += ' } '; | ||
79 | + } | ||
80 | + out = it.util.cleanUpCode(out); | ||
81 | + return out; | ||
82 | +} |
LINE-js/node_modules/ajv/lib/dotjs/custom.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate_custom(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $errorKeyword; | ||
11 | + var $data = 'data' + ($dataLvl || ''); | ||
12 | + var $valid = 'valid' + $lvl; | ||
13 | + var $errs = 'errs__' + $lvl; | ||
14 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
15 | + $schemaValue; | ||
16 | + if ($isData) { | ||
17 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
18 | + $schemaValue = 'schema' + $lvl; | ||
19 | + } else { | ||
20 | + $schemaValue = $schema; | ||
21 | + } | ||
22 | + var $rule = this, | ||
23 | + $definition = 'definition' + $lvl, | ||
24 | + $rDef = $rule.definition, | ||
25 | + $closingBraces = ''; | ||
26 | + var $compile, $inline, $macro, $ruleValidate, $validateCode; | ||
27 | + if ($isData && $rDef.$data) { | ||
28 | + $validateCode = 'keywordValidate' + $lvl; | ||
29 | + var $validateSchema = $rDef.validateSchema; | ||
30 | + out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; | ||
31 | + } else { | ||
32 | + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); | ||
33 | + if (!$ruleValidate) return; | ||
34 | + $schemaValue = 'validate.schema' + $schemaPath; | ||
35 | + $validateCode = $ruleValidate.code; | ||
36 | + $compile = $rDef.compile; | ||
37 | + $inline = $rDef.inline; | ||
38 | + $macro = $rDef.macro; | ||
39 | + } | ||
40 | + var $ruleErrs = $validateCode + '.errors', | ||
41 | + $i = 'i' + $lvl, | ||
42 | + $ruleErr = 'ruleErr' + $lvl, | ||
43 | + $asyncKeyword = $rDef.async; | ||
44 | + if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); | ||
45 | + if (!($inline || $macro)) { | ||
46 | + out += '' + ($ruleErrs) + ' = null;'; | ||
47 | + } | ||
48 | + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; | ||
49 | + if ($isData && $rDef.$data) { | ||
50 | + $closingBraces += '}'; | ||
51 | + out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; | ||
52 | + if ($validateSchema) { | ||
53 | + $closingBraces += '}'; | ||
54 | + out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; | ||
55 | + } | ||
56 | + } | ||
57 | + if ($inline) { | ||
58 | + if ($rDef.statements) { | ||
59 | + out += ' ' + ($ruleValidate.validate) + ' '; | ||
60 | + } else { | ||
61 | + out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; | ||
62 | + } | ||
63 | + } else if ($macro) { | ||
64 | + var $it = it.util.copy(it); | ||
65 | + var $closingBraces = ''; | ||
66 | + $it.level++; | ||
67 | + var $nextValid = 'valid' + $it.level; | ||
68 | + $it.schema = $ruleValidate.validate; | ||
69 | + $it.schemaPath = ''; | ||
70 | + var $wasComposite = it.compositeRule; | ||
71 | + it.compositeRule = $it.compositeRule = true; | ||
72 | + var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); | ||
73 | + it.compositeRule = $it.compositeRule = $wasComposite; | ||
74 | + out += ' ' + ($code); | ||
75 | + } else { | ||
76 | + var $$outStack = $$outStack || []; | ||
77 | + $$outStack.push(out); | ||
78 | + out = ''; | ||
79 | + out += ' ' + ($validateCode) + '.call( '; | ||
80 | + if (it.opts.passContext) { | ||
81 | + out += 'this'; | ||
82 | + } else { | ||
83 | + out += 'self'; | ||
84 | + } | ||
85 | + if ($compile || $rDef.schema === false) { | ||
86 | + out += ' , ' + ($data) + ' '; | ||
87 | + } else { | ||
88 | + out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; | ||
89 | + } | ||
90 | + out += ' , (dataPath || \'\')'; | ||
91 | + if (it.errorPath != '""') { | ||
92 | + out += ' + ' + (it.errorPath); | ||
93 | + } | ||
94 | + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', | ||
95 | + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; | ||
96 | + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; | ||
97 | + var def_callRuleValidate = out; | ||
98 | + out = $$outStack.pop(); | ||
99 | + if ($rDef.errors === false) { | ||
100 | + out += ' ' + ($valid) + ' = '; | ||
101 | + if ($asyncKeyword) { | ||
102 | + out += 'await '; | ||
103 | + } | ||
104 | + out += '' + (def_callRuleValidate) + '; '; | ||
105 | + } else { | ||
106 | + if ($asyncKeyword) { | ||
107 | + $ruleErrs = 'customErrors' + $lvl; | ||
108 | + out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; | ||
109 | + } else { | ||
110 | + out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; | ||
111 | + } | ||
112 | + } | ||
113 | + } | ||
114 | + if ($rDef.modifying) { | ||
115 | + out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; | ||
116 | + } | ||
117 | + out += '' + ($closingBraces); | ||
118 | + if ($rDef.valid) { | ||
119 | + if ($breakOnError) { | ||
120 | + out += ' if (true) { '; | ||
121 | + } | ||
122 | + } else { | ||
123 | + out += ' if ( '; | ||
124 | + if ($rDef.valid === undefined) { | ||
125 | + out += ' !'; | ||
126 | + if ($macro) { | ||
127 | + out += '' + ($nextValid); | ||
128 | + } else { | ||
129 | + out += '' + ($valid); | ||
130 | + } | ||
131 | + } else { | ||
132 | + out += ' ' + (!$rDef.valid) + ' '; | ||
133 | + } | ||
134 | + out += ') { '; | ||
135 | + $errorKeyword = $rule.keyword; | ||
136 | + var $$outStack = $$outStack || []; | ||
137 | + $$outStack.push(out); | ||
138 | + out = ''; | ||
139 | + var $$outStack = $$outStack || []; | ||
140 | + $$outStack.push(out); | ||
141 | + out = ''; /* istanbul ignore else */ | ||
142 | + if (it.createErrors !== false) { | ||
143 | + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; | ||
144 | + if (it.opts.messages !== false) { | ||
145 | + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; | ||
146 | + } | ||
147 | + if (it.opts.verbose) { | ||
148 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
149 | + } | ||
150 | + out += ' } '; | ||
151 | + } else { | ||
152 | + out += ' {} '; | ||
153 | + } | ||
154 | + var __err = out; | ||
155 | + out = $$outStack.pop(); | ||
156 | + if (!it.compositeRule && $breakOnError) { | ||
157 | + /* istanbul ignore if */ | ||
158 | + if (it.async) { | ||
159 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
160 | + } else { | ||
161 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
162 | + } | ||
163 | + } else { | ||
164 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
165 | + } | ||
166 | + var def_customError = out; | ||
167 | + out = $$outStack.pop(); | ||
168 | + if ($inline) { | ||
169 | + if ($rDef.errors) { | ||
170 | + if ($rDef.errors != 'full') { | ||
171 | + out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } '; | ||
172 | + if (it.opts.verbose) { | ||
173 | + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; | ||
174 | + } | ||
175 | + out += ' } '; | ||
176 | + } | ||
177 | + } else { | ||
178 | + if ($rDef.errors === false) { | ||
179 | + out += ' ' + (def_customError) + ' '; | ||
180 | + } else { | ||
181 | + out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } '; | ||
182 | + if (it.opts.verbose) { | ||
183 | + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; | ||
184 | + } | ||
185 | + out += ' } } '; | ||
186 | + } | ||
187 | + } | ||
188 | + } else if ($macro) { | ||
189 | + out += ' var err = '; /* istanbul ignore else */ | ||
190 | + if (it.createErrors !== false) { | ||
191 | + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; | ||
192 | + if (it.opts.messages !== false) { | ||
193 | + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; | ||
194 | + } | ||
195 | + if (it.opts.verbose) { | ||
196 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
197 | + } | ||
198 | + out += ' } '; | ||
199 | + } else { | ||
200 | + out += ' {} '; | ||
201 | + } | ||
202 | + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
203 | + if (!it.compositeRule && $breakOnError) { | ||
204 | + /* istanbul ignore if */ | ||
205 | + if (it.async) { | ||
206 | + out += ' throw new ValidationError(vErrors); '; | ||
207 | + } else { | ||
208 | + out += ' validate.errors = vErrors; return false; '; | ||
209 | + } | ||
210 | + } | ||
211 | + } else { | ||
212 | + if ($rDef.errors === false) { | ||
213 | + out += ' ' + (def_customError) + ' '; | ||
214 | + } else { | ||
215 | + out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; '; | ||
216 | + if (it.opts.verbose) { | ||
217 | + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; | ||
218 | + } | ||
219 | + out += ' } } else { ' + (def_customError) + ' } '; | ||
220 | + } | ||
221 | + } | ||
222 | + out += ' } '; | ||
223 | + if ($breakOnError) { | ||
224 | + out += ' else { '; | ||
225 | + } | ||
226 | + } | ||
227 | + return out; | ||
228 | +} |
1 | +'use strict'; | ||
2 | +module.exports = function generate_dependencies(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $data = 'data' + ($dataLvl || ''); | ||
11 | + var $errs = 'errs__' + $lvl; | ||
12 | + var $it = it.util.copy(it); | ||
13 | + var $closingBraces = ''; | ||
14 | + $it.level++; | ||
15 | + var $nextValid = 'valid' + $it.level; | ||
16 | + var $schemaDeps = {}, | ||
17 | + $propertyDeps = {}, | ||
18 | + $ownProperties = it.opts.ownProperties; | ||
19 | + for ($property in $schema) { | ||
20 | + var $sch = $schema[$property]; | ||
21 | + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; | ||
22 | + $deps[$property] = $sch; | ||
23 | + } | ||
24 | + out += 'var ' + ($errs) + ' = errors;'; | ||
25 | + var $currentErrorPath = it.errorPath; | ||
26 | + out += 'var missing' + ($lvl) + ';'; | ||
27 | + for (var $property in $propertyDeps) { | ||
28 | + $deps = $propertyDeps[$property]; | ||
29 | + if ($deps.length) { | ||
30 | + out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; | ||
31 | + if ($ownProperties) { | ||
32 | + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; | ||
33 | + } | ||
34 | + if ($breakOnError) { | ||
35 | + out += ' && ( '; | ||
36 | + var arr1 = $deps; | ||
37 | + if (arr1) { | ||
38 | + var $propertyKey, $i = -1, | ||
39 | + l1 = arr1.length - 1; | ||
40 | + while ($i < l1) { | ||
41 | + $propertyKey = arr1[$i += 1]; | ||
42 | + if ($i) { | ||
43 | + out += ' || '; | ||
44 | + } | ||
45 | + var $prop = it.util.getProperty($propertyKey), | ||
46 | + $useData = $data + $prop; | ||
47 | + out += ' ( ( ' + ($useData) + ' === undefined '; | ||
48 | + if ($ownProperties) { | ||
49 | + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; | ||
50 | + } | ||
51 | + out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; | ||
52 | + } | ||
53 | + } | ||
54 | + out += ')) { '; | ||
55 | + var $propertyPath = 'missing' + $lvl, | ||
56 | + $missingProperty = '\' + ' + $propertyPath + ' + \''; | ||
57 | + if (it.opts._errorDataPathProperty) { | ||
58 | + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; | ||
59 | + } | ||
60 | + var $$outStack = $$outStack || []; | ||
61 | + $$outStack.push(out); | ||
62 | + out = ''; /* istanbul ignore else */ | ||
63 | + if (it.createErrors !== false) { | ||
64 | + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; | ||
65 | + if (it.opts.messages !== false) { | ||
66 | + out += ' , message: \'should have '; | ||
67 | + if ($deps.length == 1) { | ||
68 | + out += 'property ' + (it.util.escapeQuotes($deps[0])); | ||
69 | + } else { | ||
70 | + out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); | ||
71 | + } | ||
72 | + out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; | ||
73 | + } | ||
74 | + if (it.opts.verbose) { | ||
75 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
76 | + } | ||
77 | + out += ' } '; | ||
78 | + } else { | ||
79 | + out += ' {} '; | ||
80 | + } | ||
81 | + var __err = out; | ||
82 | + out = $$outStack.pop(); | ||
83 | + if (!it.compositeRule && $breakOnError) { | ||
84 | + /* istanbul ignore if */ | ||
85 | + if (it.async) { | ||
86 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
87 | + } else { | ||
88 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
89 | + } | ||
90 | + } else { | ||
91 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
92 | + } | ||
93 | + } else { | ||
94 | + out += ' ) { '; | ||
95 | + var arr2 = $deps; | ||
96 | + if (arr2) { | ||
97 | + var $propertyKey, i2 = -1, | ||
98 | + l2 = arr2.length - 1; | ||
99 | + while (i2 < l2) { | ||
100 | + $propertyKey = arr2[i2 += 1]; | ||
101 | + var $prop = it.util.getProperty($propertyKey), | ||
102 | + $missingProperty = it.util.escapeQuotes($propertyKey), | ||
103 | + $useData = $data + $prop; | ||
104 | + if (it.opts._errorDataPathProperty) { | ||
105 | + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); | ||
106 | + } | ||
107 | + out += ' if ( ' + ($useData) + ' === undefined '; | ||
108 | + if ($ownProperties) { | ||
109 | + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; | ||
110 | + } | ||
111 | + out += ') { var err = '; /* istanbul ignore else */ | ||
112 | + if (it.createErrors !== false) { | ||
113 | + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; | ||
114 | + if (it.opts.messages !== false) { | ||
115 | + out += ' , message: \'should have '; | ||
116 | + if ($deps.length == 1) { | ||
117 | + out += 'property ' + (it.util.escapeQuotes($deps[0])); | ||
118 | + } else { | ||
119 | + out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); | ||
120 | + } | ||
121 | + out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; | ||
122 | + } | ||
123 | + if (it.opts.verbose) { | ||
124 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
125 | + } | ||
126 | + out += ' } '; | ||
127 | + } else { | ||
128 | + out += ' {} '; | ||
129 | + } | ||
130 | + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; | ||
131 | + } | ||
132 | + } | ||
133 | + } | ||
134 | + out += ' } '; | ||
135 | + if ($breakOnError) { | ||
136 | + $closingBraces += '}'; | ||
137 | + out += ' else { '; | ||
138 | + } | ||
139 | + } | ||
140 | + } | ||
141 | + it.errorPath = $currentErrorPath; | ||
142 | + var $currentBaseId = $it.baseId; | ||
143 | + for (var $property in $schemaDeps) { | ||
144 | + var $sch = $schemaDeps[$property]; | ||
145 | + if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { | ||
146 | + out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; | ||
147 | + if ($ownProperties) { | ||
148 | + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; | ||
149 | + } | ||
150 | + out += ') { '; | ||
151 | + $it.schema = $sch; | ||
152 | + $it.schemaPath = $schemaPath + it.util.getProperty($property); | ||
153 | + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); | ||
154 | + out += ' ' + (it.validate($it)) + ' '; | ||
155 | + $it.baseId = $currentBaseId; | ||
156 | + out += ' } '; | ||
157 | + if ($breakOnError) { | ||
158 | + out += ' if (' + ($nextValid) + ') { '; | ||
159 | + $closingBraces += '}'; | ||
160 | + } | ||
161 | + } | ||
162 | + } | ||
163 | + if ($breakOnError) { | ||
164 | + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; | ||
165 | + } | ||
166 | + out = it.util.cleanUpCode(out); | ||
167 | + return out; | ||
168 | +} |
LINE-js/node_modules/ajv/lib/dotjs/enum.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate_enum(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $data = 'data' + ($dataLvl || ''); | ||
11 | + var $valid = 'valid' + $lvl; | ||
12 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
13 | + $schemaValue; | ||
14 | + if ($isData) { | ||
15 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
16 | + $schemaValue = 'schema' + $lvl; | ||
17 | + } else { | ||
18 | + $schemaValue = $schema; | ||
19 | + } | ||
20 | + var $i = 'i' + $lvl, | ||
21 | + $vSchema = 'schema' + $lvl; | ||
22 | + if (!$isData) { | ||
23 | + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; | ||
24 | + } | ||
25 | + out += 'var ' + ($valid) + ';'; | ||
26 | + if ($isData) { | ||
27 | + out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; | ||
28 | + } | ||
29 | + out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; | ||
30 | + if ($isData) { | ||
31 | + out += ' } '; | ||
32 | + } | ||
33 | + out += ' if (!' + ($valid) + ') { '; | ||
34 | + var $$outStack = $$outStack || []; | ||
35 | + $$outStack.push(out); | ||
36 | + out = ''; /* istanbul ignore else */ | ||
37 | + if (it.createErrors !== false) { | ||
38 | + out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; | ||
39 | + if (it.opts.messages !== false) { | ||
40 | + out += ' , message: \'should be equal to one of the allowed values\' '; | ||
41 | + } | ||
42 | + if (it.opts.verbose) { | ||
43 | + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
44 | + } | ||
45 | + out += ' } '; | ||
46 | + } else { | ||
47 | + out += ' {} '; | ||
48 | + } | ||
49 | + var __err = out; | ||
50 | + out = $$outStack.pop(); | ||
51 | + if (!it.compositeRule && $breakOnError) { | ||
52 | + /* istanbul ignore if */ | ||
53 | + if (it.async) { | ||
54 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
55 | + } else { | ||
56 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
57 | + } | ||
58 | + } else { | ||
59 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
60 | + } | ||
61 | + out += ' }'; | ||
62 | + if ($breakOnError) { | ||
63 | + out += ' else { '; | ||
64 | + } | ||
65 | + return out; | ||
66 | +} |
LINE-js/node_modules/ajv/lib/dotjs/format.js
0 → 100644
1 | +'use strict'; | ||
2 | +module.exports = function generate_format(it, $keyword, $ruleType) { | ||
3 | + var out = ' '; | ||
4 | + var $lvl = it.level; | ||
5 | + var $dataLvl = it.dataLevel; | ||
6 | + var $schema = it.schema[$keyword]; | ||
7 | + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); | ||
8 | + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; | ||
9 | + var $breakOnError = !it.opts.allErrors; | ||
10 | + var $data = 'data' + ($dataLvl || ''); | ||
11 | + if (it.opts.format === false) { | ||
12 | + if ($breakOnError) { | ||
13 | + out += ' if (true) { '; | ||
14 | + } | ||
15 | + return out; | ||
16 | + } | ||
17 | + var $isData = it.opts.$data && $schema && $schema.$data, | ||
18 | + $schemaValue; | ||
19 | + if ($isData) { | ||
20 | + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; | ||
21 | + $schemaValue = 'schema' + $lvl; | ||
22 | + } else { | ||
23 | + $schemaValue = $schema; | ||
24 | + } | ||
25 | + var $unknownFormats = it.opts.unknownFormats, | ||
26 | + $allowUnknown = Array.isArray($unknownFormats); | ||
27 | + if ($isData) { | ||
28 | + var $format = 'format' + $lvl, | ||
29 | + $isObject = 'isObject' + $lvl, | ||
30 | + $formatType = 'formatType' + $lvl; | ||
31 | + out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; | ||
32 | + if (it.async) { | ||
33 | + out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; | ||
34 | + } | ||
35 | + out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; | ||
36 | + if ($isData) { | ||
37 | + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; | ||
38 | + } | ||
39 | + out += ' ('; | ||
40 | + if ($unknownFormats != 'ignore') { | ||
41 | + out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; | ||
42 | + if ($allowUnknown) { | ||
43 | + out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; | ||
44 | + } | ||
45 | + out += ') || '; | ||
46 | + } | ||
47 | + out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; | ||
48 | + if (it.async) { | ||
49 | + out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; | ||
50 | + } else { | ||
51 | + out += ' ' + ($format) + '(' + ($data) + ') '; | ||
52 | + } | ||
53 | + out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; | ||
54 | + } else { | ||
55 | + var $format = it.formats[$schema]; | ||
56 | + if (!$format) { | ||
57 | + if ($unknownFormats == 'ignore') { | ||
58 | + it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); | ||
59 | + if ($breakOnError) { | ||
60 | + out += ' if (true) { '; | ||
61 | + } | ||
62 | + return out; | ||
63 | + } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { | ||
64 | + if ($breakOnError) { | ||
65 | + out += ' if (true) { '; | ||
66 | + } | ||
67 | + return out; | ||
68 | + } else { | ||
69 | + throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); | ||
70 | + } | ||
71 | + } | ||
72 | + var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; | ||
73 | + var $formatType = $isObject && $format.type || 'string'; | ||
74 | + if ($isObject) { | ||
75 | + var $async = $format.async === true; | ||
76 | + $format = $format.validate; | ||
77 | + } | ||
78 | + if ($formatType != $ruleType) { | ||
79 | + if ($breakOnError) { | ||
80 | + out += ' if (true) { '; | ||
81 | + } | ||
82 | + return out; | ||
83 | + } | ||
84 | + if ($async) { | ||
85 | + if (!it.async) throw new Error('async format in sync schema'); | ||
86 | + var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; | ||
87 | + out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { '; | ||
88 | + } else { | ||
89 | + out += ' if (! '; | ||
90 | + var $formatRef = 'formats' + it.util.getProperty($schema); | ||
91 | + if ($isObject) $formatRef += '.validate'; | ||
92 | + if (typeof $format == 'function') { | ||
93 | + out += ' ' + ($formatRef) + '(' + ($data) + ') '; | ||
94 | + } else { | ||
95 | + out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; | ||
96 | + } | ||
97 | + out += ') { '; | ||
98 | + } | ||
99 | + } | ||
100 | + var $$outStack = $$outStack || []; | ||
101 | + $$outStack.push(out); | ||
102 | + out = ''; /* istanbul ignore else */ | ||
103 | + if (it.createErrors !== false) { | ||
104 | + out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; | ||
105 | + if ($isData) { | ||
106 | + out += '' + ($schemaValue); | ||
107 | + } else { | ||
108 | + out += '' + (it.util.toQuotedString($schema)); | ||
109 | + } | ||
110 | + out += ' } '; | ||
111 | + if (it.opts.messages !== false) { | ||
112 | + out += ' , message: \'should match format "'; | ||
113 | + if ($isData) { | ||
114 | + out += '\' + ' + ($schemaValue) + ' + \''; | ||
115 | + } else { | ||
116 | + out += '' + (it.util.escapeQuotes($schema)); | ||
117 | + } | ||
118 | + out += '"\' '; | ||
119 | + } | ||
120 | + if (it.opts.verbose) { | ||
121 | + out += ' , schema: '; | ||
122 | + if ($isData) { | ||
123 | + out += 'validate.schema' + ($schemaPath); | ||
124 | + } else { | ||
125 | + out += '' + (it.util.toQuotedString($schema)); | ||
126 | + } | ||
127 | + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; | ||
128 | + } | ||
129 | + out += ' } '; | ||
130 | + } else { | ||
131 | + out += ' {} '; | ||
132 | + } | ||
133 | + var __err = out; | ||
134 | + out = $$outStack.pop(); | ||
135 | + if (!it.compositeRule && $breakOnError) { | ||
136 | + /* istanbul ignore if */ | ||
137 | + if (it.async) { | ||
138 | + out += ' throw new ValidationError([' + (__err) + ']); '; | ||
139 | + } else { | ||
140 | + out += ' validate.errors = [' + (__err) + ']; return false; '; | ||
141 | + } | ||
142 | + } else { | ||
143 | + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; | ||
144 | + } | ||
145 | + out += ' } '; | ||
146 | + if ($breakOnError) { | ||
147 | + out += ' else { '; | ||
148 | + } | ||
149 | + return out; | ||
150 | +} |
LINE-js/node_modules/ajv/lib/dotjs/if.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/dotjs/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/dotjs/items.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/dotjs/not.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/dotjs/oneOf.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/dotjs/ref.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/keyword.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/lib/refs/data.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/scripts/bundle.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ajv/scripts/info
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/lib/ber/errors.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/lib/ber/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/lib/ber/reader.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/lib/ber/types.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/lib/ber/writer.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/lib/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asn1/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/assert-plus/AUTHORS
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/assert-plus/CHANGES.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/assert-plus/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/assert-plus/assert.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/bench.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/lib/abort.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/lib/async.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/lib/defer.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/lib/iterate.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/lib/state.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/parallel.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/serial.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/asynckit/stream.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws-sign2/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws-sign2/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws-sign2/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws-sign2/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws4/.travis.yml
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws4/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws4/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws4/aws4.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws4/lru.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/aws4/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/bcrypt-pbkdf/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/bcrypt-pbkdf/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/bcrypt-pbkdf/index.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/caseless/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/caseless/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/caseless/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/caseless/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/caseless/test.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/combined-stream/License
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/core-util-is/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/core-util-is/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/core-util-is/test.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/dashdash/CHANGES.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/dashdash/LICENSE.txt
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/dashdash/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/dashdash/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/delayed-stream/License
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/delayed-stream/Makefile
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/index.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/lib/ec.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/lib/sec.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/ecc-jsbn/test.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/.editorconfig
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/.eslintrc
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/.jscs.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/.travis.yml
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/component.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extend/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extsprintf/.gitmodules
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extsprintf/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extsprintf/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extsprintf/Makefile
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extsprintf/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/extsprintf/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/fast-deep-equal/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/forever-agent/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/forever-agent/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/forever-agent/index.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/form-data/License
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/form-data/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/form-data/README.md.bak
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/form-data/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/form-data/yarn.lock
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/getpass/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/getpass/.travis.yml
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/getpass/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/getpass/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/getpass/lib/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/getpass/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-schema/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-schema/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-schema/lib/har.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-schema/lib/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-schema/lib/log.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-schema/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-validator/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/har-validator/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/http-signature/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/is-typedarray/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/is-typedarray/index.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/is-typedarray/test.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/.jshintrc
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/.travis.yml
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/LICENSE.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/isstream.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/isstream/test.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/example.html
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/example.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsbn/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/json-schema/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsprim/CHANGES.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsprim/CONTRIBUTING.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsprim/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsprim/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsprim/lib/jsprim.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/jsprim/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-db/HISTORY.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-db/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-db/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-db/db.json
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/mime-db/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-db/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-types/HISTORY.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-types/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-types/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-types/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/mime-types/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/oauth-sign/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/oauth-sign/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/oauth-sign/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/oauth-sign/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/psl/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/psl/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/psl/data/rules.json
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/psl/dist/psl.js
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/psl/dist/psl.min.js
0 → 100644
This diff could not be displayed because it is too large.
LINE-js/node_modules/psl/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/psl/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/punycode/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/punycode/package.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/punycode/punycode.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/.editorconfig
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/.eslintignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/.eslintrc
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/dist/qs.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/lib/formats.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/lib/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/lib/parse.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/lib/stringify.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/lib/utils.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/test/.eslintrc
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/test/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/test/parse.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/test/stringify.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/qs/test/utils.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/auth.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/cookies.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/har.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/hawk.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/helpers.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/oauth.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/redirect.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/lib/tunnel.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/request/request.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safe-buffer/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safe-buffer/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safe-buffer/index.d.ts
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safe-buffer/index.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safer-buffer/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safer-buffer/Readme.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safer-buffer/safer.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/safer-buffer/tests.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/.travis.yml
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/bin/sshpk-conv
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/bin/sshpk-sign
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/bin/sshpk-verify
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/algs.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/dhe.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/ed-compat.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/errors.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/identity.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/key.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/signature.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/ssh-buffer.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/lib/utils.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/sshpk/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tough-cookie/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tough-cookie/README.md
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tunnel-agent/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tunnel-agent/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tunnel-agent/index.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/AUTHORS.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/nacl-fast.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/nacl.d.ts
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/nacl.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/nacl.min.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/tweetnacl/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/bower.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/rollup.config.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/src/index.ts
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/src/uri.ts
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/src/util.ts
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/tests/qunit.css
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/tests/qunit.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/tests/tests.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/tsconfig.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uri-js/yarn.lock
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/AUTHORS
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/LICENSE.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/bin/uuid
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/index.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/bytesToUuid.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/md5-browser.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/md5.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/rng-browser.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/rng.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/sha1.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/lib/v35.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/v1.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/v3.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/v4.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/uuid/v5.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/.npmignore
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/CHANGES.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/CONTRIBUTING.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/LICENSE
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/README.md
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/lib/verror.js
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/node_modules/verror/package.json
0 → 100644
This diff is collapsed. Click to expand it.
LINE-js/package-lock.json
0 → 100644
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment