Browse Source

android fix

christian 3 years ago
parent
commit
4571a14169
100 changed files with 17360 additions and 7 deletions
  1. 3
    6
      config.xml
  2. 1
    0
      node_modules/.bin/cordova
  3. 1
    0
      node_modules/.bin/is-ci
  4. 1
    0
      node_modules/.bin/is-docker
  5. 1
    0
      node_modules/.bin/md5-file
  6. 1
    0
      node_modules/.bin/rc
  7. 1
    0
      node_modules/.bin/rimraf
  8. 1
    0
      node_modules/.bin/sshpk-conv
  9. 1
    0
      node_modules/.bin/sshpk-sign
  10. 1
    0
      node_modules/.bin/sshpk-verify
  11. 1
    0
      node_modules/.bin/systeminformation
  12. 1
    1
      node_modules/.bin/uuid
  13. 132
    0
      node_modules/@sindresorhus/is/dist/index.d.ts
  14. 245
    0
      node_modules/@sindresorhus/is/dist/index.js
  15. 1
    0
      node_modules/@sindresorhus/is/dist/index.js.map
  16. 0
    0
      node_modules/@sindresorhus/is/license
  17. 96
    0
      node_modules/@sindresorhus/is/package.json
  18. 451
    0
      node_modules/@sindresorhus/is/readme.md
  19. 21
    0
      node_modules/@szmarczak/http-timer/LICENSE
  20. 70
    0
      node_modules/@szmarczak/http-timer/README.md
  21. 75
    0
      node_modules/@szmarczak/http-timer/package.json
  22. 99
    0
      node_modules/@szmarczak/http-timer/source/index.js
  23. 20
    0
      node_modules/ajv/.tonic_example.js
  24. 22
    0
      node_modules/ajv/LICENSE
  25. 1497
    0
      node_modules/ajv/README.md
  26. 7189
    0
      node_modules/ajv/dist/ajv.bundle.js
  27. 3
    0
      node_modules/ajv/dist/ajv.min.js
  28. 1
    0
      node_modules/ajv/dist/ajv.min.js.map
  29. 397
    0
      node_modules/ajv/lib/ajv.d.ts
  30. 506
    0
      node_modules/ajv/lib/ajv.js
  31. 26
    0
      node_modules/ajv/lib/cache.js
  32. 90
    0
      node_modules/ajv/lib/compile/async.js
  33. 5
    0
      node_modules/ajv/lib/compile/equal.js
  34. 34
    0
      node_modules/ajv/lib/compile/error_classes.js
  35. 142
    0
      node_modules/ajv/lib/compile/formats.js
  36. 387
    0
      node_modules/ajv/lib/compile/index.js
  37. 270
    0
      node_modules/ajv/lib/compile/resolve.js
  38. 66
    0
      node_modules/ajv/lib/compile/rules.js
  39. 9
    0
      node_modules/ajv/lib/compile/schema_obj.js
  40. 20
    0
      node_modules/ajv/lib/compile/ucs2length.js
  41. 239
    0
      node_modules/ajv/lib/compile/util.js
  42. 49
    0
      node_modules/ajv/lib/data.js
  43. 37
    0
      node_modules/ajv/lib/definition_schema.js
  44. 113
    0
      node_modules/ajv/lib/dot/_limit.jst
  45. 12
    0
      node_modules/ajv/lib/dot/_limitItems.jst
  46. 12
    0
      node_modules/ajv/lib/dot/_limitLength.jst
  47. 12
    0
      node_modules/ajv/lib/dot/_limitProperties.jst
  48. 32
    0
      node_modules/ajv/lib/dot/allOf.jst
  49. 46
    0
      node_modules/ajv/lib/dot/anyOf.jst
  50. 51
    0
      node_modules/ajv/lib/dot/coerce.def
  51. 9
    0
      node_modules/ajv/lib/dot/comment.jst
  52. 11
    0
      node_modules/ajv/lib/dot/const.jst
  53. 55
    0
      node_modules/ajv/lib/dot/contains.jst
  54. 191
    0
      node_modules/ajv/lib/dot/custom.jst
  55. 47
    0
      node_modules/ajv/lib/dot/defaults.def
  56. 203
    0
      node_modules/ajv/lib/dot/definitions.def
  57. 79
    0
      node_modules/ajv/lib/dot/dependencies.jst
  58. 30
    0
      node_modules/ajv/lib/dot/enum.jst
  59. 194
    0
      node_modules/ajv/lib/dot/errors.def
  60. 106
    0
      node_modules/ajv/lib/dot/format.jst
  61. 73
    0
      node_modules/ajv/lib/dot/if.jst
  62. 98
    0
      node_modules/ajv/lib/dot/items.jst
  63. 39
    0
      node_modules/ajv/lib/dot/missing.def
  64. 22
    0
      node_modules/ajv/lib/dot/multipleOf.jst
  65. 43
    0
      node_modules/ajv/lib/dot/not.jst
  66. 54
    0
      node_modules/ajv/lib/dot/oneOf.jst
  67. 14
    0
      node_modules/ajv/lib/dot/pattern.jst
  68. 245
    0
      node_modules/ajv/lib/dot/properties.jst
  69. 52
    0
      node_modules/ajv/lib/dot/propertyNames.jst
  70. 85
    0
      node_modules/ajv/lib/dot/ref.jst
  71. 108
    0
      node_modules/ajv/lib/dot/required.jst
  72. 62
    0
      node_modules/ajv/lib/dot/uniqueItems.jst
  73. 276
    0
      node_modules/ajv/lib/dot/validate.jst
  74. 3
    0
      node_modules/ajv/lib/dotjs/README.md
  75. 163
    0
      node_modules/ajv/lib/dotjs/_limit.js
  76. 80
    0
      node_modules/ajv/lib/dotjs/_limitItems.js
  77. 85
    0
      node_modules/ajv/lib/dotjs/_limitLength.js
  78. 80
    0
      node_modules/ajv/lib/dotjs/_limitProperties.js
  79. 42
    0
      node_modules/ajv/lib/dotjs/allOf.js
  80. 73
    0
      node_modules/ajv/lib/dotjs/anyOf.js
  81. 14
    0
      node_modules/ajv/lib/dotjs/comment.js
  82. 56
    0
      node_modules/ajv/lib/dotjs/const.js
  83. 81
    0
      node_modules/ajv/lib/dotjs/contains.js
  84. 228
    0
      node_modules/ajv/lib/dotjs/custom.js
  85. 168
    0
      node_modules/ajv/lib/dotjs/dependencies.js
  86. 66
    0
      node_modules/ajv/lib/dotjs/enum.js
  87. 150
    0
      node_modules/ajv/lib/dotjs/format.js
  88. 103
    0
      node_modules/ajv/lib/dotjs/if.js
  89. 33
    0
      node_modules/ajv/lib/dotjs/index.js
  90. 140
    0
      node_modules/ajv/lib/dotjs/items.js
  91. 80
    0
      node_modules/ajv/lib/dotjs/multipleOf.js
  92. 84
    0
      node_modules/ajv/lib/dotjs/not.js
  93. 73
    0
      node_modules/ajv/lib/dotjs/oneOf.js
  94. 75
    0
      node_modules/ajv/lib/dotjs/pattern.js
  95. 335
    0
      node_modules/ajv/lib/dotjs/properties.js
  96. 81
    0
      node_modules/ajv/lib/dotjs/propertyNames.js
  97. 124
    0
      node_modules/ajv/lib/dotjs/ref.js
  98. 270
    0
      node_modules/ajv/lib/dotjs/required.js
  99. 86
    0
      node_modules/ajv/lib/dotjs/uniqueItems.js
  100. 0
    0
      node_modules/ajv/lib/dotjs/validate.js

+ 3
- 6
config.xml View File

@@ -8,19 +8,16 @@
8 8
         Apache Cordova Team
9 9
     </author>
10 10
     <content src="index.html" />
11
-    <plugin name="cordova-plugin-whitelist" spec="1" />
12 11
     <access origin="*" />
13
-    <allow-navigation href="*"/>
12
+    <allow-navigation href="http://*/*" />
14 13
     <allow-intent href="http://*/*" />
15 14
     <allow-intent href="https://*/*" />
16 15
     <allow-intent href="tel:*" />
17 16
     <allow-intent href="sms:*" />
18
-    <allow-intent href="file://*"/>
17
+    <allow-intent href="file://*" />
19 18
     <allow-intent href="mailto:*" />
20 19
     <allow-intent href="geo:*" />
21
-
22 20
     <feature name="NativeStorage">
23
-        <param name="ios-package" value="NativeStorage"/>
21
+        <param name="ios-package" value="NativeStorage" />
24 22
     </feature>
25
-
26 23
 </widget>

+ 1
- 0
node_modules/.bin/cordova View File

@@ -0,0 +1 @@
1
+../cordova/bin/cordova

+ 1
- 0
node_modules/.bin/is-ci View File

@@ -0,0 +1 @@
1
+../is-ci/bin.js

+ 1
- 0
node_modules/.bin/is-docker View File

@@ -0,0 +1 @@
1
+../is-docker/cli.js

+ 1
- 0
node_modules/.bin/md5-file View File

@@ -0,0 +1 @@
1
+../md5-file/cli.js

+ 1
- 0
node_modules/.bin/rc View File

@@ -0,0 +1 @@
1
+../rc/cli.js

+ 1
- 0
node_modules/.bin/rimraf View File

@@ -0,0 +1 @@
1
+../rimraf/bin.js

+ 1
- 0
node_modules/.bin/sshpk-conv View File

@@ -0,0 +1 @@
1
+../sshpk/bin/sshpk-conv

+ 1
- 0
node_modules/.bin/sshpk-sign View File

@@ -0,0 +1 @@
1
+../sshpk/bin/sshpk-sign

+ 1
- 0
node_modules/.bin/sshpk-verify View File

@@ -0,0 +1 @@
1
+../sshpk/bin/sshpk-verify

+ 1
- 0
node_modules/.bin/systeminformation View File

@@ -0,0 +1 @@
1
+../systeminformation/lib/cli.js

+ 1
- 1
node_modules/.bin/uuid View File

@@ -1 +1 @@
1
-../uuid/dist/bin/uuid
1
+../uuid/bin/uuid

+ 132
- 0
node_modules/@sindresorhus/is/dist/index.d.ts View File

@@ -0,0 +1,132 @@
1
+/// <reference types="node" />
2
+/// <reference lib="es2016" />
3
+/// <reference lib="es2017.sharedmemory" />
4
+/// <reference lib="esnext.asynciterable" />
5
+/// <reference lib="dom" />
6
+declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
7
+declare type Primitive = null | undefined | string | number | boolean | Symbol;
8
+export interface ArrayLike {
9
+    length: number;
10
+}
11
+export interface Class<T = unknown> {
12
+    new (...args: any[]): T;
13
+}
14
+declare type DomElement = object & {
15
+    nodeType: 1;
16
+    nodeName: string;
17
+};
18
+declare type NodeStream = object & {
19
+    pipe: Function;
20
+};
21
+export declare const enum TypeName {
22
+    null = "null",
23
+    boolean = "boolean",
24
+    undefined = "undefined",
25
+    string = "string",
26
+    number = "number",
27
+    symbol = "symbol",
28
+    Function = "Function",
29
+    GeneratorFunction = "GeneratorFunction",
30
+    AsyncFunction = "AsyncFunction",
31
+    Observable = "Observable",
32
+    Array = "Array",
33
+    Buffer = "Buffer",
34
+    Object = "Object",
35
+    RegExp = "RegExp",
36
+    Date = "Date",
37
+    Error = "Error",
38
+    Map = "Map",
39
+    Set = "Set",
40
+    WeakMap = "WeakMap",
41
+    WeakSet = "WeakSet",
42
+    Int8Array = "Int8Array",
43
+    Uint8Array = "Uint8Array",
44
+    Uint8ClampedArray = "Uint8ClampedArray",
45
+    Int16Array = "Int16Array",
46
+    Uint16Array = "Uint16Array",
47
+    Int32Array = "Int32Array",
48
+    Uint32Array = "Uint32Array",
49
+    Float32Array = "Float32Array",
50
+    Float64Array = "Float64Array",
51
+    ArrayBuffer = "ArrayBuffer",
52
+    SharedArrayBuffer = "SharedArrayBuffer",
53
+    DataView = "DataView",
54
+    Promise = "Promise",
55
+    URL = "URL"
56
+}
57
+declare function is(value: unknown): TypeName;
58
+declare namespace is {
59
+    const undefined: (value: unknown) => value is undefined;
60
+    const string: (value: unknown) => value is string;
61
+    const number: (value: unknown) => value is number;
62
+    const function_: (value: unknown) => value is Function;
63
+    const null_: (value: unknown) => value is null;
64
+    const class_: (value: unknown) => value is Class<unknown>;
65
+    const boolean: (value: unknown) => value is boolean;
66
+    const symbol: (value: unknown) => value is Symbol;
67
+    const numericString: (value: unknown) => boolean;
68
+    const array: (arg: any) => arg is any[];
69
+    const buffer: (input: unknown) => input is Buffer;
70
+    const nullOrUndefined: (value: unknown) => value is null | undefined;
71
+    const object: (value: unknown) => value is object;
72
+    const iterable: (value: unknown) => value is IterableIterator<unknown>;
73
+    const asyncIterable: (value: unknown) => value is AsyncIterableIterator<unknown>;
74
+    const generator: (value: unknown) => value is Generator;
75
+    const nativePromise: (value: unknown) => value is Promise<unknown>;
76
+    const promise: (value: unknown) => value is Promise<unknown>;
77
+    const generatorFunction: (value: unknown) => value is GeneratorFunction;
78
+    const asyncFunction: (value: unknown) => value is Function;
79
+    const boundFunction: (value: unknown) => value is Function;
80
+    const regExp: (value: unknown) => value is RegExp;
81
+    const date: (value: unknown) => value is Date;
82
+    const error: (value: unknown) => value is Error;
83
+    const map: (value: unknown) => value is Map<unknown, unknown>;
84
+    const set: (value: unknown) => value is Set<unknown>;
85
+    const weakMap: (value: unknown) => value is WeakMap<object, unknown>;
86
+    const weakSet: (value: unknown) => value is WeakSet<object>;
87
+    const int8Array: (value: unknown) => value is Int8Array;
88
+    const uint8Array: (value: unknown) => value is Uint8Array;
89
+    const uint8ClampedArray: (value: unknown) => value is Uint8ClampedArray;
90
+    const int16Array: (value: unknown) => value is Int16Array;
91
+    const uint16Array: (value: unknown) => value is Uint16Array;
92
+    const int32Array: (value: unknown) => value is Int32Array;
93
+    const uint32Array: (value: unknown) => value is Uint32Array;
94
+    const float32Array: (value: unknown) => value is Float32Array;
95
+    const float64Array: (value: unknown) => value is Float64Array;
96
+    const arrayBuffer: (value: unknown) => value is ArrayBuffer;
97
+    const sharedArrayBuffer: (value: unknown) => value is SharedArrayBuffer;
98
+    const dataView: (value: unknown) => value is DataView;
99
+    const directInstanceOf: <T>(instance: unknown, klass: Class<T>) => instance is T;
100
+    const urlInstance: (value: unknown) => value is URL;
101
+    const urlString: (value: unknown) => boolean;
102
+    const truthy: (value: unknown) => boolean;
103
+    const falsy: (value: unknown) => boolean;
104
+    const nan: (value: unknown) => boolean;
105
+    const primitive: (value: unknown) => value is Primitive;
106
+    const integer: (value: unknown) => value is number;
107
+    const safeInteger: (value: unknown) => value is number;
108
+    const plainObject: (value: unknown) => boolean;
109
+    const typedArray: (value: unknown) => value is TypedArray;
110
+    const arrayLike: (value: unknown) => value is ArrayLike;
111
+    const inRange: (value: number, range: number | number[]) => boolean;
112
+    const domElement: (value: unknown) => value is DomElement;
113
+    const observable: (value: unknown) => boolean;
114
+    const nodeStream: (value: unknown) => value is NodeStream;
115
+    const infinite: (value: unknown) => boolean;
116
+    const even: (value: number) => boolean;
117
+    const odd: (value: number) => boolean;
118
+    const emptyArray: (value: unknown) => boolean;
119
+    const nonEmptyArray: (value: unknown) => boolean;
120
+    const emptyString: (value: unknown) => boolean;
121
+    const nonEmptyString: (value: unknown) => boolean;
122
+    const emptyStringOrWhitespace: (value: unknown) => boolean;
123
+    const emptyObject: (value: unknown) => boolean;
124
+    const nonEmptyObject: (value: unknown) => boolean;
125
+    const emptySet: (value: unknown) => boolean;
126
+    const nonEmptySet: (value: unknown) => boolean;
127
+    const emptyMap: (value: unknown) => boolean;
128
+    const nonEmptyMap: (value: unknown) => boolean;
129
+    const any: (predicate: unknown, ...values: unknown[]) => boolean;
130
+    const all: (predicate: unknown, ...values: unknown[]) => boolean;
131
+}
132
+export default is;

+ 245
- 0
node_modules/@sindresorhus/is/dist/index.js View File

@@ -0,0 +1,245 @@
1
+"use strict";
2
+/// <reference lib="es2016"/>
3
+/// <reference lib="es2017.sharedmemory"/>
4
+/// <reference lib="esnext.asynciterable"/>
5
+/// <reference lib="dom"/>
6
+Object.defineProperty(exports, "__esModule", { value: true });
7
+// TODO: Use the `URL` global when targeting Node.js 10
8
+// tslint:disable-next-line
9
+const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL;
10
+const toString = Object.prototype.toString;
11
+const isOfType = (type) => (value) => typeof value === type;
12
+const isBuffer = (input) => !is.nullOrUndefined(input) && !is.nullOrUndefined(input.constructor) && is.function_(input.constructor.isBuffer) && input.constructor.isBuffer(input);
13
+const getObjectType = (value) => {
14
+    const objectName = toString.call(value).slice(8, -1);
15
+    if (objectName) {
16
+        return objectName;
17
+    }
18
+    return null;
19
+};
20
+const isObjectOfType = (type) => (value) => getObjectType(value) === type;
21
+function is(value) {
22
+    switch (value) {
23
+        case null:
24
+            return "null" /* null */;
25
+        case true:
26
+        case false:
27
+            return "boolean" /* boolean */;
28
+        default:
29
+    }
30
+    switch (typeof value) {
31
+        case 'undefined':
32
+            return "undefined" /* undefined */;
33
+        case 'string':
34
+            return "string" /* string */;
35
+        case 'number':
36
+            return "number" /* number */;
37
+        case 'symbol':
38
+            return "symbol" /* symbol */;
39
+        default:
40
+    }
41
+    if (is.function_(value)) {
42
+        return "Function" /* Function */;
43
+    }
44
+    if (is.observable(value)) {
45
+        return "Observable" /* Observable */;
46
+    }
47
+    if (Array.isArray(value)) {
48
+        return "Array" /* Array */;
49
+    }
50
+    if (isBuffer(value)) {
51
+        return "Buffer" /* Buffer */;
52
+    }
53
+    const tagType = getObjectType(value);
54
+    if (tagType) {
55
+        return tagType;
56
+    }
57
+    if (value instanceof String || value instanceof Boolean || value instanceof Number) {
58
+        throw new TypeError('Please don\'t use object wrappers for primitive types');
59
+    }
60
+    return "Object" /* Object */;
61
+}
62
+(function (is) {
63
+    // tslint:disable-next-line:strict-type-predicates
64
+    const isObject = (value) => typeof value === 'object';
65
+    // tslint:disable:variable-name
66
+    is.undefined = isOfType('undefined');
67
+    is.string = isOfType('string');
68
+    is.number = isOfType('number');
69
+    is.function_ = isOfType('function');
70
+    // tslint:disable-next-line:strict-type-predicates
71
+    is.null_ = (value) => value === null;
72
+    is.class_ = (value) => is.function_(value) && value.toString().startsWith('class ');
73
+    is.boolean = (value) => value === true || value === false;
74
+    is.symbol = isOfType('symbol');
75
+    // tslint:enable:variable-name
76
+    is.numericString = (value) => is.string(value) && value.length > 0 && !Number.isNaN(Number(value));
77
+    is.array = Array.isArray;
78
+    is.buffer = isBuffer;
79
+    is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);
80
+    is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value));
81
+    is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]);
82
+    is.asyncIterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.asyncIterator]);
83
+    is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw);
84
+    is.nativePromise = (value) => isObjectOfType("Promise" /* Promise */)(value);
85
+    const hasPromiseAPI = (value) => !is.null_(value) &&
86
+        isObject(value) &&
87
+        is.function_(value.then) &&
88
+        is.function_(value.catch);
89
+    is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value);
90
+    is.generatorFunction = isObjectOfType("GeneratorFunction" /* GeneratorFunction */);
91
+    is.asyncFunction = isObjectOfType("AsyncFunction" /* AsyncFunction */);
92
+    is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype');
93
+    is.regExp = isObjectOfType("RegExp" /* RegExp */);
94
+    is.date = isObjectOfType("Date" /* Date */);
95
+    is.error = isObjectOfType("Error" /* Error */);
96
+    is.map = (value) => isObjectOfType("Map" /* Map */)(value);
97
+    is.set = (value) => isObjectOfType("Set" /* Set */)(value);
98
+    is.weakMap = (value) => isObjectOfType("WeakMap" /* WeakMap */)(value);
99
+    is.weakSet = (value) => isObjectOfType("WeakSet" /* WeakSet */)(value);
100
+    is.int8Array = isObjectOfType("Int8Array" /* Int8Array */);
101
+    is.uint8Array = isObjectOfType("Uint8Array" /* Uint8Array */);
102
+    is.uint8ClampedArray = isObjectOfType("Uint8ClampedArray" /* Uint8ClampedArray */);
103
+    is.int16Array = isObjectOfType("Int16Array" /* Int16Array */);
104
+    is.uint16Array = isObjectOfType("Uint16Array" /* Uint16Array */);
105
+    is.int32Array = isObjectOfType("Int32Array" /* Int32Array */);
106
+    is.uint32Array = isObjectOfType("Uint32Array" /* Uint32Array */);
107
+    is.float32Array = isObjectOfType("Float32Array" /* Float32Array */);
108
+    is.float64Array = isObjectOfType("Float64Array" /* Float64Array */);
109
+    is.arrayBuffer = isObjectOfType("ArrayBuffer" /* ArrayBuffer */);
110
+    is.sharedArrayBuffer = isObjectOfType("SharedArrayBuffer" /* SharedArrayBuffer */);
111
+    is.dataView = isObjectOfType("DataView" /* DataView */);
112
+    is.directInstanceOf = (instance, klass) => Object.getPrototypeOf(instance) === klass.prototype;
113
+    is.urlInstance = (value) => isObjectOfType("URL" /* URL */)(value);
114
+    is.urlString = (value) => {
115
+        if (!is.string(value)) {
116
+            return false;
117
+        }
118
+        try {
119
+            new URLGlobal(value); // tslint:disable-line no-unused-expression
120
+            return true;
121
+        }
122
+        catch (_a) {
123
+            return false;
124
+        }
125
+    };
126
+    is.truthy = (value) => Boolean(value);
127
+    is.falsy = (value) => !value;
128
+    is.nan = (value) => Number.isNaN(value);
129
+    const primitiveTypes = new Set([
130
+        'undefined',
131
+        'string',
132
+        'number',
133
+        'boolean',
134
+        'symbol'
135
+    ]);
136
+    is.primitive = (value) => is.null_(value) || primitiveTypes.has(typeof value);
137
+    is.integer = (value) => Number.isInteger(value);
138
+    is.safeInteger = (value) => Number.isSafeInteger(value);
139
+    is.plainObject = (value) => {
140
+        // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js
141
+        let prototype;
142
+        return getObjectType(value) === "Object" /* Object */ &&
143
+            (prototype = Object.getPrototypeOf(value), prototype === null || // tslint:disable-line:ban-comma-operator
144
+                prototype === Object.getPrototypeOf({}));
145
+    };
146
+    const typedArrayTypes = new Set([
147
+        "Int8Array" /* Int8Array */,
148
+        "Uint8Array" /* Uint8Array */,
149
+        "Uint8ClampedArray" /* Uint8ClampedArray */,
150
+        "Int16Array" /* Int16Array */,
151
+        "Uint16Array" /* Uint16Array */,
152
+        "Int32Array" /* Int32Array */,
153
+        "Uint32Array" /* Uint32Array */,
154
+        "Float32Array" /* Float32Array */,
155
+        "Float64Array" /* Float64Array */
156
+    ]);
157
+    is.typedArray = (value) => {
158
+        const objectType = getObjectType(value);
159
+        if (objectType === null) {
160
+            return false;
161
+        }
162
+        return typedArrayTypes.has(objectType);
163
+    };
164
+    const isValidLength = (value) => is.safeInteger(value) && value > -1;
165
+    is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length);
166
+    is.inRange = (value, range) => {
167
+        if (is.number(range)) {
168
+            return value >= Math.min(0, range) && value <= Math.max(range, 0);
169
+        }
170
+        if (is.array(range) && range.length === 2) {
171
+            return value >= Math.min(...range) && value <= Math.max(...range);
172
+        }
173
+        throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
174
+    };
175
+    const NODE_TYPE_ELEMENT = 1;
176
+    const DOM_PROPERTIES_TO_CHECK = [
177
+        'innerHTML',
178
+        'ownerDocument',
179
+        'style',
180
+        'attributes',
181
+        'nodeValue'
182
+    ];
183
+    is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) &&
184
+        !is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every(property => property in value);
185
+    is.observable = (value) => {
186
+        if (!value) {
187
+            return false;
188
+        }
189
+        if (value[Symbol.observable] && value === value[Symbol.observable]()) {
190
+            return true;
191
+        }
192
+        if (value['@@observable'] && value === value['@@observable']()) {
193
+            return true;
194
+        }
195
+        return false;
196
+    };
197
+    is.nodeStream = (value) => !is.nullOrUndefined(value) && isObject(value) && is.function_(value.pipe) && !is.observable(value);
198
+    is.infinite = (value) => value === Infinity || value === -Infinity;
199
+    const isAbsoluteMod2 = (rem) => (value) => is.integer(value) && Math.abs(value % 2) === rem;
200
+    is.even = isAbsoluteMod2(0);
201
+    is.odd = isAbsoluteMod2(1);
202
+    const isWhiteSpaceString = (value) => is.string(value) && /\S/.test(value) === false;
203
+    is.emptyArray = (value) => is.array(value) && value.length === 0;
204
+    is.nonEmptyArray = (value) => is.array(value) && value.length > 0;
205
+    is.emptyString = (value) => is.string(value) && value.length === 0;
206
+    is.nonEmptyString = (value) => is.string(value) && value.length > 0;
207
+    is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);
208
+    is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;
209
+    is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0;
210
+    is.emptySet = (value) => is.set(value) && value.size === 0;
211
+    is.nonEmptySet = (value) => is.set(value) && value.size > 0;
212
+    is.emptyMap = (value) => is.map(value) && value.size === 0;
213
+    is.nonEmptyMap = (value) => is.map(value) && value.size > 0;
214
+    const predicateOnArray = (method, predicate, values) => {
215
+        if (is.function_(predicate) === false) {
216
+            throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
217
+        }
218
+        if (values.length === 0) {
219
+            throw new TypeError('Invalid number of values');
220
+        }
221
+        return method.call(values, predicate);
222
+    };
223
+    // tslint:disable variable-name
224
+    is.any = (predicate, ...values) => predicateOnArray(Array.prototype.some, predicate, values);
225
+    is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values);
226
+    // tslint:enable variable-name
227
+})(is || (is = {}));
228
+// Some few keywords are reserved, but we'll populate them for Node.js users
229
+// See https://github.com/Microsoft/TypeScript/issues/2536
230
+Object.defineProperties(is, {
231
+    class: {
232
+        value: is.class_
233
+    },
234
+    function: {
235
+        value: is.function_
236
+    },
237
+    null: {
238
+        value: is.null_
239
+    }
240
+});
241
+exports.default = is;
242
+// For CommonJS default export support
243
+module.exports = is;
244
+module.exports.default = is;
245
+//# sourceMappingURL=index.js.map

+ 1
- 0
node_modules/@sindresorhus/is/dist/index.js.map
File diff suppressed because it is too large
View File


platforms/ios/cordova/node_modules/strip-bom/license → node_modules/@sindresorhus/is/license View File


+ 96
- 0
node_modules/@sindresorhus/is/package.json View File

@@ -0,0 +1,96 @@
1
+{
2
+  "_from": "@sindresorhus/is@^0.14.0",
3
+  "_id": "@sindresorhus/is@0.14.0",
4
+  "_inBundle": false,
5
+  "_integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==",
6
+  "_location": "/@sindresorhus/is",
7
+  "_phantomChildren": {},
8
+  "_requested": {
9
+    "type": "range",
10
+    "registry": true,
11
+    "raw": "@sindresorhus/is@^0.14.0",
12
+    "name": "@sindresorhus/is",
13
+    "escapedName": "@sindresorhus%2fis",
14
+    "scope": "@sindresorhus",
15
+    "rawSpec": "^0.14.0",
16
+    "saveSpec": null,
17
+    "fetchSpec": "^0.14.0"
18
+  },
19
+  "_requiredBy": [
20
+    "/got"
21
+  ],
22
+  "_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
23
+  "_shasum": "9fb3a3cf3132328151f353de4632e01e52102bea",
24
+  "_spec": "@sindresorhus/is@^0.14.0",
25
+  "_where": "/home/christian/Documents/newarte/artesanias/node_modules/got",
26
+  "author": {
27
+    "name": "Sindre Sorhus",
28
+    "email": "sindresorhus@gmail.com",
29
+    "url": "sindresorhus.com"
30
+  },
31
+  "bugs": {
32
+    "url": "https://github.com/sindresorhus/is/issues"
33
+  },
34
+  "bundleDependencies": false,
35
+  "deprecated": false,
36
+  "description": "Type check values: `is.string('🦄') //=> true`",
37
+  "devDependencies": {
38
+    "@sindresorhus/tsconfig": "^0.1.0",
39
+    "@types/jsdom": "^11.12.0",
40
+    "@types/node": "^10.12.10",
41
+    "@types/tempy": "^0.2.0",
42
+    "@types/zen-observable": "^0.8.0",
43
+    "ava": "^0.25.0",
44
+    "del-cli": "^1.1.0",
45
+    "jsdom": "^11.6.2",
46
+    "rxjs": "^6.3.3",
47
+    "tempy": "^0.2.1",
48
+    "tslint": "^5.9.1",
49
+    "tslint-xo": "^0.10.0",
50
+    "typescript": "^3.2.1",
51
+    "zen-observable": "^0.8.8"
52
+  },
53
+  "engines": {
54
+    "node": ">=6"
55
+  },
56
+  "files": [
57
+    "dist"
58
+  ],
59
+  "homepage": "https://github.com/sindresorhus/is#readme",
60
+  "keywords": [
61
+    "type",
62
+    "types",
63
+    "is",
64
+    "check",
65
+    "checking",
66
+    "validate",
67
+    "validation",
68
+    "utility",
69
+    "util",
70
+    "typeof",
71
+    "instanceof",
72
+    "object",
73
+    "assert",
74
+    "assertion",
75
+    "test",
76
+    "kind",
77
+    "primitive",
78
+    "verify",
79
+    "compare"
80
+  ],
81
+  "license": "MIT",
82
+  "main": "dist/index.js",
83
+  "name": "@sindresorhus/is",
84
+  "repository": {
85
+    "type": "git",
86
+    "url": "git+https://github.com/sindresorhus/is.git"
87
+  },
88
+  "scripts": {
89
+    "build": "del dist && tsc",
90
+    "lint": "tslint --format stylish --project .",
91
+    "prepublish": "npm run build && del dist/tests",
92
+    "test": "npm run lint && npm run build && ava dist/tests"
93
+  },
94
+  "types": "dist/index.d.ts",
95
+  "version": "0.14.0"
96
+}

+ 451
- 0
node_modules/@sindresorhus/is/readme.md View File

@@ -0,0 +1,451 @@
1
+# is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](https://travis-ci.org/sindresorhus/is)
2
+
3
+> Type check values: `is.string('🦄') //=> true`
4
+
5
+<img src="header.gif" width="182" align="right">
6
+
7
+
8
+## Install
9
+
10
+```
11
+$ npm install @sindresorhus/is
12
+```
13
+
14
+
15
+## Usage
16
+
17
+```js
18
+const is = require('@sindresorhus/is');
19
+
20
+is('🦄');
21
+//=> 'string'
22
+
23
+is(new Map());
24
+//=> 'Map'
25
+
26
+is.number(6);
27
+//=> true
28
+```
29
+
30
+When using `is` together with TypeScript, [type guards](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types) are being used to infer the correct type inside if-else statements.
31
+
32
+```ts
33
+import is from '@sindresorhus/is';
34
+
35
+const padLeft = (value: string, padding: string | number) => {
36
+	if (is.number(padding)) {
37
+		// `padding` is typed as `number`
38
+		return Array(padding + 1).join(' ') + value;
39
+	}
40
+
41
+	if (is.string(padding)) {
42
+		// `padding` is typed as `string`
43
+		return padding + value;
44
+	}
45
+
46
+	throw new TypeError(`Expected 'padding' to be of type 'string' or 'number', got '${is(padding)}'.`);
47
+}
48
+
49
+padLeft('🦄', 3);
50
+//=> '   🦄'
51
+
52
+padLeft('🦄', '🌈');
53
+//=> '🌈🦄'
54
+```
55
+
56
+
57
+## API
58
+
59
+### is(value)
60
+
61
+Returns the type of `value`.
62
+
63
+Primitives are lowercase and object types are camelcase.
64
+
65
+Example:
66
+
67
+- `'undefined'`
68
+- `'null'`
69
+- `'string'`
70
+- `'symbol'`
71
+- `'Array'`
72
+- `'Function'`
73
+- `'Object'`
74
+
75
+Note: It will throw an error if you try to feed it object-wrapped primitives, as that's a bad practice. For example `new String('foo')`.
76
+
77
+### is.{method}
78
+
79
+All the below methods accept a value and returns a boolean for whether the value is of the desired type.
80
+
81
+#### Primitives
82
+
83
+##### .undefined(value)
84
+##### .null(value)
85
+##### .string(value)
86
+##### .number(value)
87
+##### .boolean(value)
88
+##### .symbol(value)
89
+
90
+#### Built-in types
91
+
92
+##### .array(value)
93
+##### .function(value)
94
+##### .buffer(value)
95
+##### .object(value)
96
+
97
+Keep in mind that [functions are objects too](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions).
98
+
99
+##### .numericString(value)
100
+
101
+Returns `true` for a string that represents a number. For example, `'42'` and `'-8'`.
102
+
103
+Note: `'NaN'` returns `false`, but `'Infinity'` and `'-Infinity'` return `true`.
104
+
105
+##### .regExp(value)
106
+##### .date(value)
107
+##### .error(value)
108
+##### .nativePromise(value)
109
+##### .promise(value)
110
+
111
+Returns `true` for any object with a `.then()` and `.catch()` method. Prefer this one over `.nativePromise()` as you usually want to allow userland promise implementations too.
112
+
113
+##### .generator(value)
114
+
115
+Returns `true` for any object that implements its own `.next()` and `.throw()` methods and has a function definition for `Symbol.iterator`.
116
+
117
+##### .generatorFunction(value)
118
+
119
+##### .asyncFunction(value)
120
+
121
+Returns `true` for any `async` function that can be called with the `await` operator.
122
+
123
+```js
124
+is.asyncFunction(async () => {});
125
+// => true
126
+
127
+is.asyncFunction(() => {});
128
+// => false
129
+```
130
+
131
+##### .boundFunction(value)
132
+
133
+Returns `true` for any `bound` function.
134
+
135
+```js
136
+is.boundFunction(() => {});
137
+// => true
138
+
139
+is.boundFunction(function () {}.bind(null));
140
+// => true
141
+
142
+is.boundFunction(function () {});
143
+// => false
144
+```
145
+
146
+##### .map(value)
147
+##### .set(value)
148
+##### .weakMap(value)
149
+##### .weakSet(value)
150
+
151
+#### Typed arrays
152
+
153
+##### .int8Array(value)
154
+##### .uint8Array(value)
155
+##### .uint8ClampedArray(value)
156
+##### .int16Array(value)
157
+##### .uint16Array(value)
158
+##### .int32Array(value)
159
+##### .uint32Array(value)
160
+##### .float32Array(value)
161
+##### .float64Array(value)
162
+
163
+#### Structured data
164
+
165
+##### .arrayBuffer(value)
166
+##### .sharedArrayBuffer(value)
167
+##### .dataView(value)
168
+
169
+#### Emptiness
170
+
171
+##### .emptyString(value)
172
+
173
+Returns `true` if the value is a `string` and the `.length` is 0.
174
+
175
+##### .nonEmptyString(value)
176
+
177
+Returns `true` if the value is a `string` and the `.length` is more than 0.
178
+
179
+##### .emptyStringOrWhitespace(value)
180
+
181
+Returns `true` if `is.emptyString(value)` or if it's a `string` that is all whitespace.
182
+
183
+##### .emptyArray(value)
184
+
185
+Returns `true` if the value is an `Array` and the `.length` is 0.
186
+
187
+##### .nonEmptyArray(value)
188
+
189
+Returns `true` if the value is an `Array` and the `.length` is more than 0.
190
+
191
+##### .emptyObject(value)
192
+
193
+Returns `true` if the value is an `Object` and `Object.keys(value).length` is 0.
194
+
195
+Please note that `Object.keys` returns only own enumerable properties. Hence something like this can happen:
196
+
197
+```js
198
+const object1 = {};
199
+
200
+Object.defineProperty(object1, 'property1', {
201
+	value: 42,
202
+	writable: true,
203
+	enumerable: false,
204
+	configurable: true
205
+});
206
+
207
+is.emptyObject(object1);
208
+// => true
209
+```
210
+
211
+##### .nonEmptyObject(value)
212
+
213
+Returns `true` if the value is an `Object` and `Object.keys(value).length` is more than 0.
214
+
215
+##### .emptySet(value)
216
+
217
+Returns `true` if the value is a `Set` and the `.size` is 0.
218
+
219
+##### .nonEmptySet(Value)
220
+
221
+Returns `true` if the value is a `Set` and the `.size` is more than 0.
222
+
223
+##### .emptyMap(value)
224
+
225
+Returns `true` if the value is a `Map` and the `.size` is 0.
226
+
227
+##### .nonEmptyMap(value)
228
+
229
+Returns `true` if the value is a `Map` and the `.size` is more than 0.
230
+
231
+#### Miscellaneous
232
+
233
+##### .directInstanceOf(value, class)
234
+
235
+Returns `true` if `value` is a direct instance of `class`.
236
+
237
+```js
238
+is.directInstanceOf(new Error(), Error);
239
+//=> true
240
+
241
+class UnicornError extends Error {}
242
+
243
+is.directInstanceOf(new UnicornError(), Error);
244
+//=> false
245
+```
246
+
247
+##### .urlInstance(value)
248
+
249
+Returns `true` if `value` is an instance of the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL).
250
+
251
+```js
252
+const url = new URL('https://example.com');
253
+
254
+is.urlInstance(url);
255
+//=> true
256
+```
257
+
258
+### .url(value)
259
+
260
+Returns `true` if `value` is a URL string.
261
+
262
+Note: this only does basic checking using the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL) constructor.
263
+
264
+```js
265
+const url = 'https://example.com';
266
+
267
+is.url(url);
268
+//=> true
269
+
270
+is.url(new URL(url));
271
+//=> false
272
+```
273
+
274
+##### .truthy(value)
275
+
276
+Returns `true` for all values that evaluate to true in a boolean context:
277
+
278
+```js
279
+is.truthy('🦄');
280
+//=> true
281
+
282
+is.truthy(undefined);
283
+//=> false
284
+```
285
+
286
+##### .falsy(value)
287
+
288
+Returns `true` if `value` is one of: `false`, `0`, `''`, `null`, `undefined`, `NaN`.
289
+
290
+##### .nan(value)
291
+##### .nullOrUndefined(value)
292
+##### .primitive(value)
293
+
294
+JavaScript primitives are as follows: `null`, `undefined`, `string`, `number`, `boolean`, `symbol`.
295
+
296
+##### .integer(value)
297
+
298
+##### .safeInteger(value)
299
+
300
+Returns `true` if `value` is a [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
301
+
302
+##### .plainObject(value)
303
+
304
+An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
305
+
306
+##### .iterable(value)
307
+##### .asyncIterable(value)
308
+##### .class(value)
309
+
310
+Returns `true` for instances created by a class.
311
+
312
+##### .typedArray(value)
313
+
314
+##### .arrayLike(value)
315
+
316
+A `value` is array-like if it is not a function and has a `value.length` that is a safe integer greater than or equal to 0.
317
+
318
+```js
319
+is.arrayLike(document.forms);
320
+//=> true
321
+
322
+function foo() {
323
+	is.arrayLike(arguments);
324
+	//=> true
325
+}
326
+foo();
327
+```
328
+
329
+##### .inRange(value, range)
330
+
331
+Check if `value` (number) is in the given `range`. The range is an array of two values, lower bound and upper bound, in no specific order.
332
+
333
+```js
334
+is.inRange(3, [0, 5]);
335
+is.inRange(3, [5, 0]);
336
+is.inRange(0, [-2, 2]);
337
+```
338
+
339
+##### .inRange(value, upperBound)
340
+
341
+Check if `value` (number) is in the range of `0` to `upperBound`.
342
+
343
+```js
344
+is.inRange(3, 10);
345
+```
346
+
347
+##### .domElement(value)
348
+
349
+Returns `true` if `value` is a DOM Element.
350
+
351
+##### .nodeStream(value)
352
+
353
+Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html).
354
+
355
+```js
356
+const fs = require('fs');
357
+
358
+is.nodeStream(fs.createReadStream('unicorn.png'));
359
+//=> true
360
+```
361
+
362
+##### .observable(value)
363
+
364
+Returns `true` if `value` is an `Observable`.
365
+
366
+```js
367
+const {Observable} = require('rxjs');
368
+
369
+is.observable(new Observable());
370
+//=> true
371
+```
372
+
373
+##### .infinite(value)
374
+
375
+Check if `value` is `Infinity` or `-Infinity`.
376
+
377
+##### .even(value)
378
+
379
+Returns `true` if `value` is an even integer.
380
+
381
+##### .odd(value)
382
+
383
+Returns `true` if `value` is an odd integer.
384
+
385
+##### .any(predicate, ...values)
386
+
387
+Returns `true` if **any** of the input `values` returns true in the `predicate`:
388
+
389
+```js
390
+is.any(is.string, {}, true, '🦄');
391
+//=> true
392
+
393
+is.any(is.boolean, 'unicorns', [], new Map());
394
+//=> false
395
+```
396
+
397
+##### .all(predicate, ...values)
398
+
399
+Returns `true` if **all** of the input `values` returns true in the `predicate`:
400
+
401
+```js
402
+is.all(is.object, {}, new Map(), new Set());
403
+//=> true
404
+
405
+is.all(is.string, '🦄', [], 'unicorns');
406
+//=> false
407
+```
408
+
409
+
410
+## FAQ
411
+
412
+### Why yet another type checking module?
413
+
414
+There are hundreds of type checking modules on npm, unfortunately, I couldn't find any that fit my needs:
415
+
416
+- Includes both type methods and ability to get the type
417
+- Types of primitives returned as lowercase and object types as camelcase
418
+- Covers all built-ins
419
+- Unsurprising behavior
420
+- Well-maintained
421
+- Comprehensive test suite
422
+
423
+For the ones I found, pick 3 of these.
424
+
425
+The most common mistakes I noticed in these modules was using `instanceof` for type checking, forgetting that functions are objects, and omitting `symbol` as a primitive.
426
+
427
+
428
+## Related
429
+
430
+- [ow](https://github.com/sindresorhus/ow) - Function argument validation for humans
431
+- [is-stream](https://github.com/sindresorhus/is-stream) - Check if something is a Node.js stream
432
+- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable
433
+- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array
434
+- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address
435
+- [is-array-sorted](https://github.com/sindresorhus/is-array-sorted) - Check if an Array is sorted
436
+- [is-error-constructor](https://github.com/sindresorhus/is-error-constructor) - Check if a value is an error constructor
437
+- [is-empty-iterable](https://github.com/sindresorhus/is-empty-iterable) - Check if an Iterable is empty
438
+- [is-blob](https://github.com/sindresorhus/is-blob) - Check if a value is a Blob - File-like object of immutable, raw data
439
+- [has-emoji](https://github.com/sindresorhus/has-emoji) - Check whether a string has any emoji
440
+
441
+
442
+## Created by
443
+
444
+- [Sindre Sorhus](https://github.com/sindresorhus)
445
+- [Giora Guttsait](https://github.com/gioragutt)
446
+- [Brandon Smith](https://github.com/brandon93s)
447
+
448
+
449
+## License
450
+
451
+MIT

+ 21
- 0
node_modules/@szmarczak/http-timer/LICENSE View File

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2018 Szymon Marczak
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.

+ 70
- 0
node_modules/@szmarczak/http-timer/README.md View File

@@ -0,0 +1,70 @@
1
+# http-timer
2
+> Timings for HTTP requests
3
+
4
+[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer)
5
+[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master)
6
+[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)
7
+
8
+Inspired by the [`request` package](https://github.com/request/request).
9
+
10
+## Usage
11
+```js
12
+'use strict';
13
+const https = require('https');
14
+const timer = require('@szmarczak/http-timer');
15
+
16
+const request = https.get('https://httpbin.org/anything');
17
+const timings = timer(request);
18
+
19
+request.on('response', response => {
20
+	response.on('data', () => {}); // Consume the data somehow
21
+	response.on('end', () => {
22
+		console.log(timings);
23
+	});
24
+});
25
+
26
+// { start: 1535708511443,
27
+//   socket: 1535708511444,
28
+//   lookup: 1535708511444,
29
+//   connect: 1535708511582,
30
+//   upload: 1535708511887,
31
+//   response: 1535708512037,
32
+//   end: 1535708512040,
33
+//   phases:
34
+//    { wait: 1,
35
+//      dns: 0,
36
+//      tcp: 138,
37
+//      request: 305,
38
+//      firstByte: 150,
39
+//      download: 3,
40
+//      total: 597 } }
41
+```
42
+
43
+## API
44
+
45
+### timer(request)
46
+
47
+Returns: `Object`
48
+
49
+- `start` - Time when the request started.
50
+- `socket` - Time when a socket was assigned to the request.
51
+- `lookup` - Time when the DNS lookup finished.
52
+- `connect` - Time when the socket successfully connected.
53
+- `upload` - Time when the request finished uploading.
54
+- `response` - Time when the request fired the `response` event.
55
+- `end` - Time when the response fired the `end` event.
56
+- `error` - Time when the request fired the `error` event.
57
+- `phases`
58
+	- `wait` - `timings.socket - timings.start`
59
+	- `dns` - `timings.lookup - timings.socket`
60
+	- `tcp` - `timings.connect - timings.lookup`
61
+	- `request` - `timings.upload - timings.connect`
62
+	- `firstByte` - `timings.response - timings.upload`
63
+	- `download` - `timings.end - timings.response`
64
+	- `total` - `timings.end - timings.start` or `timings.error - timings.start`
65
+
66
+**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
67
+
68
+## License
69
+
70
+MIT

+ 75
- 0
node_modules/@szmarczak/http-timer/package.json View File

@@ -0,0 +1,75 @@
1
+{
2
+  "_from": "@szmarczak/http-timer@^1.1.2",
3
+  "_id": "@szmarczak/http-timer@1.1.2",
4
+  "_inBundle": false,
5
+  "_integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==",
6
+  "_location": "/@szmarczak/http-timer",
7
+  "_phantomChildren": {},
8
+  "_requested": {
9
+    "type": "range",
10
+    "registry": true,
11
+    "raw": "@szmarczak/http-timer@^1.1.2",
12
+    "name": "@szmarczak/http-timer",
13
+    "escapedName": "@szmarczak%2fhttp-timer",
14
+    "scope": "@szmarczak",
15
+    "rawSpec": "^1.1.2",
16
+    "saveSpec": null,
17
+    "fetchSpec": "^1.1.2"
18
+  },
19
+  "_requiredBy": [
20
+    "/got"
21
+  ],
22
+  "_resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
23
+  "_shasum": "b1665e2c461a2cd92f4c1bbf50d5454de0d4b421",
24
+  "_spec": "@szmarczak/http-timer@^1.1.2",
25
+  "_where": "/home/christian/Documents/newarte/artesanias/node_modules/got",
26
+  "author": {
27
+    "name": "Szymon Marczak"
28
+  },
29
+  "bugs": {
30
+    "url": "https://github.com/szmarczak/http-timer/issues"
31
+  },
32
+  "bundleDependencies": false,
33
+  "dependencies": {
34
+    "defer-to-connect": "^1.0.1"
35
+  },
36
+  "deprecated": false,
37
+  "description": "Timings for HTTP requests",
38
+  "devDependencies": {
39
+    "ava": "^0.25.0",
40
+    "coveralls": "^3.0.2",
41
+    "nyc": "^12.0.2",
42
+    "p-event": "^2.1.0",
43
+    "xo": "^0.22.0"
44
+  },
45
+  "engines": {
46
+    "node": ">=6"
47
+  },
48
+  "files": [
49
+    "source"
50
+  ],
51
+  "homepage": "https://github.com/szmarczak/http-timer#readme",
52
+  "keywords": [
53
+    "http",
54
+    "https",
55
+    "timer",
56
+    "timings"
57
+  ],
58
+  "license": "MIT",
59
+  "main": "source",
60
+  "name": "@szmarczak/http-timer",
61
+  "repository": {
62
+    "type": "git",
63
+    "url": "git+https://github.com/szmarczak/http-timer.git"
64
+  },
65
+  "scripts": {
66
+    "coveralls": "nyc report --reporter=text-lcov | coveralls",
67
+    "test": "xo && nyc ava"
68
+  },
69
+  "version": "1.1.2",
70
+  "xo": {
71
+    "rules": {
72
+      "unicorn/filename-case": "camelCase"
73
+    }
74
+  }
75
+}

+ 99
- 0
node_modules/@szmarczak/http-timer/source/index.js View File

@@ -0,0 +1,99 @@
1
+'use strict';
2
+const deferToConnect = require('defer-to-connect');
3
+
4
+module.exports = request => {
5
+	const timings = {
6
+		start: Date.now(),
7
+		socket: null,
8
+		lookup: null,
9
+		connect: null,
10
+		upload: null,
11
+		response: null,
12
+		end: null,
13
+		error: null,
14
+		phases: {
15
+			wait: null,
16
+			dns: null,
17
+			tcp: null,
18
+			request: null,
19
+			firstByte: null,
20
+			download: null,
21
+			total: null
22
+		}
23
+	};
24
+
25
+	const handleError = origin => {
26
+		const emit = origin.emit.bind(origin);
27
+		origin.emit = (event, ...args) => {
28
+			// Catches the `error` event
29
+			if (event === 'error') {
30
+				timings.error = Date.now();
31
+				timings.phases.total = timings.error - timings.start;
32
+
33
+				origin.emit = emit;
34
+			}
35
+
36
+			// Saves the original behavior
37
+			return emit(event, ...args);
38
+		};
39
+	};
40
+
41
+	let uploadFinished = false;
42
+	const onUpload = () => {
43
+		timings.upload = Date.now();
44
+		timings.phases.request = timings.upload - timings.connect;
45
+	};
46
+
47
+	handleError(request);
48
+
49
+	request.once('socket', socket => {
50
+		timings.socket = Date.now();
51
+		timings.phases.wait = timings.socket - timings.start;
52
+
53
+		const lookupListener = () => {
54
+			timings.lookup = Date.now();
55
+			timings.phases.dns = timings.lookup - timings.socket;
56
+		};
57
+
58
+		socket.once('lookup', lookupListener);
59
+
60
+		deferToConnect(socket, () => {
61
+			timings.connect = Date.now();
62
+
63
+			if (timings.lookup === null) {
64
+				socket.removeListener('lookup', lookupListener);
65
+				timings.lookup = timings.connect;
66
+				timings.phases.dns = timings.lookup - timings.socket;
67
+			}
68
+
69
+			timings.phases.tcp = timings.connect - timings.lookup;
70
+
71
+			if (uploadFinished && !timings.upload) {
72
+				onUpload();
73
+			}
74
+		});
75
+	});
76
+
77
+	request.once('finish', () => {
78
+		uploadFinished = true;
79
+
80
+		if (timings.connect) {
81
+			onUpload();
82
+		}
83
+	});
84
+
85
+	request.once('response', response => {
86
+		timings.response = Date.now();
87
+		timings.phases.firstByte = timings.response - timings.upload;
88
+
89
+		handleError(response);
90
+
91
+		response.once('end', () => {
92
+			timings.end = Date.now();
93
+			timings.phases.download = timings.end - timings.response;
94
+			timings.phases.total = timings.end - timings.start;
95
+		});
96
+	});
97
+
98
+	return timings;
99
+};

+ 20
- 0
node_modules/ajv/.tonic_example.js View File

@@ -0,0 +1,20 @@
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
+}

+ 22
- 0
node_modules/ajv/LICENSE View File

@@ -0,0 +1,22 @@
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
+

+ 1497
- 0
node_modules/ajv/README.md
File diff suppressed because it is too large
View File


+ 7189
- 0
node_modules/ajv/dist/ajv.bundle.js
File diff suppressed because it is too large
View File


+ 3
- 0
node_modules/ajv/dist/ajv.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
node_modules/ajv/dist/ajv.min.js.map
File diff suppressed because it is too large
View File


+ 397
- 0
node_modules/ajv/lib/ajv.d.ts View File

@@ -0,0 +1,397 @@
1
+declare var ajv: {
2
+  (options?: ajv.Options): ajv.Ajv;
3
+  new(options?: ajv.Options): ajv.Ajv;
4
+  ValidationError: typeof AjvErrors.ValidationError;
5
+  MissingRefError: typeof AjvErrors.MissingRefError;
6
+  $dataMetaSchema: object;
7
+}
8
+
9
+declare namespace AjvErrors {
10
+  class ValidationError extends Error {
11
+    constructor(errors: Array<ajv.ErrorObject>);
12
+
13
+    message: string;
14
+    errors: Array<ajv.ErrorObject>;
15
+    ajv: true;
16
+    validation: true;
17
+  }
18
+
19
+  class MissingRefError extends Error {
20
+    constructor(baseId: string, ref: string, message?: string);
21
+    static message: (baseId: string, ref: string) => string;
22
+
23
+    message: string;
24
+    missingRef: string;
25
+    missingSchema: string;
26
+  }
27
+}
28
+
29
+declare namespace ajv {
30
+  type ValidationError = AjvErrors.ValidationError;
31
+
32
+  type MissingRefError = AjvErrors.MissingRefError;
33
+
34
+  interface Ajv {
35
+    /**
36
+    * Validate data using schema
37
+    * Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default).
38
+    * @param  {string|object|Boolean} schemaKeyRef key, ref or schema object
39
+    * @param  {Any} data to be validated
40
+    * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
41
+    */
42
+    validate(schemaKeyRef: object | string | boolean, data: any): boolean | PromiseLike<any>;
43
+    /**
44
+    * Create validating function for passed schema.
45
+    * @param  {object|Boolean} schema schema object
46
+    * @return {Function} validating function
47
+    */
48
+    compile(schema: object | boolean): ValidateFunction;
49
+    /**
50
+    * Creates validating function for passed schema with asynchronous loading of missing schemas.
51
+    * `loadSchema` option should be a function that accepts schema uri and node-style callback.
52
+    * @this  Ajv
53
+    * @param {object|Boolean} schema schema object
54
+    * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
55
+    * @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function.
56
+    * @return {PromiseLike<ValidateFunction>} validating function
57
+    */
58
+    compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): PromiseLike<ValidateFunction>;
59
+    /**
60
+    * Adds schema to the instance.
61
+    * @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
62
+    * @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
63
+    * @return {Ajv} this for method chaining
64
+    */
65
+    addSchema(schema: Array<object> | object, key?: string): Ajv;
66
+    /**
67
+    * Add schema that will be used to validate other schemas
68
+    * options in META_IGNORE_OPTIONS are alway set to false
69
+    * @param {object} schema schema object
70
+    * @param {string} key optional schema key
71
+    * @return {Ajv} this for method chaining
72
+    */
73
+    addMetaSchema(schema: object, key?: string): Ajv;
74
+    /**
75
+    * Validate schema
76
+    * @param {object|Boolean} schema schema to validate
77
+    * @return {Boolean} true if schema is valid
78
+    */
79
+    validateSchema(schema: object | boolean): boolean;
80
+    /**
81
+    * Get compiled schema from the instance by `key` or `ref`.
82
+    * @param  {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
83
+    * @return {Function} schema validating function (with property `schema`). Returns undefined if keyRef can't be resolved to an existing schema.
84
+    */
85
+    getSchema(keyRef: string): ValidateFunction | undefined;
86
+    /**
87
+    * Remove cached schema(s).
88
+    * If no parameter is passed all schemas but meta-schemas are removed.
89
+    * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
90
+    * Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
91
+    * @param  {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object
92
+    * @return {Ajv} this for method chaining
93
+    */
94
+    removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv;
95
+    /**
96
+    * Add custom format
97
+    * @param {string} name format name
98
+    * @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
99
+    * @return {Ajv} this for method chaining
100
+    */
101
+    addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv;
102
+    /**
103
+    * Define custom keyword
104
+    * @this  Ajv
105
+    * @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
106
+    * @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
107
+    * @return {Ajv} this for method chaining
108
+    */
109
+    addKeyword(keyword: string, definition: KeywordDefinition): Ajv;
110
+    /**
111
+    * Get keyword definition
112
+    * @this  Ajv
113
+    * @param {string} keyword pre-defined or custom keyword.
114
+    * @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
115
+    */
116
+    getKeyword(keyword: string): object | boolean;
117
+    /**
118
+    * Remove keyword
119
+    * @this  Ajv
120
+    * @param {string} keyword pre-defined or custom keyword.
121
+    * @return {Ajv} this for method chaining
122
+    */
123
+    removeKeyword(keyword: string): Ajv;
124
+    /**
125
+    * Validate keyword
126
+    * @this  Ajv
127
+    * @param {object} definition keyword definition object
128
+    * @param {boolean} throwError true to throw exception if definition is invalid
129
+    * @return {boolean} validation result
130
+    */
131
+    validateKeyword(definition: KeywordDefinition, throwError: boolean): boolean;
132
+    /**
133
+    * Convert array of error message objects to string
134
+    * @param  {Array<object>} errors optional array of validation errors, if not passed errors from the instance are used.
135
+    * @param  {object} options optional options with properties `separator` and `dataVar`.
136
+    * @return {string} human readable string with all errors descriptions
137
+    */
138
+    errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
139
+    errors?: Array<ErrorObject> | null;
140
+    _opts: Options;
141
+  }
142
+
143
+  interface CustomLogger {
144
+    log(...args: any[]): any;
145
+    warn(...args: any[]): any;
146
+    error(...args: any[]): any;
147
+  }
148
+
149
+  interface ValidateFunction {
150
+    (
151
+      data: any,
152
+      dataPath?: string,
153
+      parentData?: object | Array<any>,
154
+      parentDataProperty?: string | number,
155
+      rootData?: object | Array<any>
156
+    ): boolean | PromiseLike<any>;
157
+    schema?: object | boolean;
158
+    errors?: null | Array<ErrorObject>;
159
+    refs?: object;
160
+    refVal?: Array<any>;
161
+    root?: ValidateFunction | object;
162
+    $async?: true;
163
+    source?: object;
164
+  }
165
+
166
+  interface Options {
167
+    $data?: boolean;
168
+    allErrors?: boolean;
169
+    verbose?: boolean;
170
+    jsonPointers?: boolean;
171
+    uniqueItems?: boolean;
172
+    unicode?: boolean;
173
+    format?: false | string;
174
+    formats?: object;
175
+    keywords?: object;
176
+    unknownFormats?: true | string[] | 'ignore';
177
+    schemas?: Array<object> | object;
178
+    schemaId?: '$id' | 'id' | 'auto';
179
+    missingRefs?: true | 'ignore' | 'fail';
180
+    extendRefs?: true | 'ignore' | 'fail';
181
+    loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike<object | boolean>;
182
+    removeAdditional?: boolean | 'all' | 'failing';
183
+    useDefaults?: boolean | 'empty' | 'shared';
184
+    coerceTypes?: boolean | 'array';
185
+    strictDefaults?: boolean | 'log';
186
+    strictKeywords?: boolean | 'log';
187
+    strictNumbers?: boolean;
188
+    async?: boolean | string;
189
+    transpile?: string | ((code: string) => string);
190
+    meta?: boolean | object;
191
+    validateSchema?: boolean | 'log';
192
+    addUsedSchema?: boolean;
193
+    inlineRefs?: boolean | number;
194
+    passContext?: boolean;
195
+    loopRequired?: number;
196
+    ownProperties?: boolean;
197
+    multipleOfPrecision?: boolean | number;
198
+    errorDataPath?: string,
199
+    messages?: boolean;
200
+    sourceCode?: boolean;
201
+    processCode?: (code: string, schema: object) => string;
202
+    cache?: object;
203
+    logger?: CustomLogger | false;
204
+    nullable?: boolean;
205
+    serialize?: ((schema: object | boolean) => any) | false;
206
+  }
207
+
208
+  type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike<any>);
209
+  type NumberFormatValidator = ((data: number) => boolean | PromiseLike<any>);
210
+
211
+  interface NumberFormatDefinition {
212
+    type: "number",
213
+    validate: NumberFormatValidator;
214
+    compare?: (data1: number, data2: number) => number;
215
+    async?: boolean;
216
+  }
217
+
218
+  interface StringFormatDefinition {
219
+    type?: "string",
220
+    validate: FormatValidator;
221
+    compare?: (data1: string, data2: string) => number;
222
+    async?: boolean;
223
+  }
224
+
225
+  type FormatDefinition = NumberFormatDefinition | StringFormatDefinition;
226
+
227
+  interface KeywordDefinition {
228
+    type?: string | Array<string>;
229
+    async?: boolean;
230
+    $data?: boolean;
231
+    errors?: boolean | string;
232
+    metaSchema?: object;
233
+    // schema: false makes validate not to expect schema (ValidateFunction)
234
+    schema?: boolean;
235
+    statements?: boolean;
236
+    dependencies?: Array<string>;
237
+    modifying?: boolean;
238
+    valid?: boolean;
239
+    // one and only one of the following properties should be present
240
+    validate?: SchemaValidateFunction | ValidateFunction;
241
+    compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction;
242
+    macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean;
243
+    inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string;
244
+  }
245
+
246
+  interface CompilationContext {
247
+    level: number;
248
+    dataLevel: number;
249
+    dataPathArr: string[];
250
+    schema: any;
251
+    schemaPath: string;
252
+    baseId: string;
253
+    async: boolean;
254
+    opts: Options;
255
+    formats: {
256
+      [index: string]: FormatDefinition | undefined;
257
+    };
258
+    keywords: {
259
+      [index: string]: KeywordDefinition | undefined;
260
+    };
261
+    compositeRule: boolean;
262
+    validate: (schema: object) => boolean;
263
+    util: {
264
+      copy(obj: any, target?: any): any;
265
+      toHash(source: string[]): { [index: string]: true | undefined };
266
+      equal(obj: any, target: any): boolean;
267
+      getProperty(str: string): string;
268
+      schemaHasRules(schema: object, rules: any): string;
269
+      escapeQuotes(str: string): string;
270
+      toQuotedString(str: string): string;
271
+      getData(jsonPointer: string, dataLevel: number, paths: string[]): string;
272
+      escapeJsonPointer(str: string): string;
273
+      unescapeJsonPointer(str: string): string;
274
+      escapeFragment(str: string): string;
275
+      unescapeFragment(str: string): string;
276
+    };
277
+    self: Ajv;
278
+  }
279
+
280
+  interface SchemaValidateFunction {
281
+    (
282
+      schema: any,
283
+      data: any,
284
+      parentSchema?: object,
285
+      dataPath?: string,
286
+      parentData?: object | Array<any>,
287
+      parentDataProperty?: string | number,
288
+      rootData?: object | Array<any>
289
+    ): boolean | PromiseLike<any>;
290
+    errors?: Array<ErrorObject>;
291
+  }
292
+
293
+  interface ErrorsTextOptions {
294
+    separator?: string;
295
+    dataVar?: string;
296
+  }
297
+
298
+  interface ErrorObject {
299
+    keyword: string;
300
+    dataPath: string;
301
+    schemaPath: string;
302
+    params: ErrorParameters;
303
+    // Added to validation errors of propertyNames keyword schema
304
+    propertyName?: string;
305
+    // Excluded if messages set to false.
306
+    message?: string;
307
+    // These are added with the `verbose` option.
308
+    schema?: any;
309
+    parentSchema?: object;
310
+    data?: any;
311
+  }
312
+
313
+  type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams |
314
+    DependenciesParams | FormatParams | ComparisonParams |
315
+    MultipleOfParams | PatternParams | RequiredParams |
316
+    TypeParams | UniqueItemsParams | CustomParams |
317
+    PatternRequiredParams | PropertyNamesParams |
318
+    IfParams | SwitchParams | NoParams | EnumParams;
319
+
320
+  interface RefParams {
321
+    ref: string;
322
+  }
323
+
324
+  interface LimitParams {
325
+    limit: number;
326
+  }
327
+
328
+  interface AdditionalPropertiesParams {
329
+    additionalProperty: string;
330
+  }
331
+
332
+  interface DependenciesParams {
333
+    property: string;
334
+    missingProperty: string;
335
+    depsCount: number;
336
+    deps: string;
337
+  }
338
+
339
+  interface FormatParams {
340
+    format: string
341
+  }
342
+
343
+  interface ComparisonParams {
344
+    comparison: string;
345
+    limit: number | string;
346
+    exclusive: boolean;
347
+  }
348
+
349
+  interface MultipleOfParams {
350
+    multipleOf: number;
351
+  }
352
+
353
+  interface PatternParams {
354
+    pattern: string;
355
+  }
356
+
357
+  interface RequiredParams {
358
+    missingProperty: string;
359
+  }
360
+
361
+  interface TypeParams {
362
+    type: string;
363
+  }
364
+
365
+  interface UniqueItemsParams {
366
+    i: number;
367
+    j: number;
368
+  }
369
+
370
+  interface CustomParams {
371
+    keyword: string;
372
+  }
373
+
374
+  interface PatternRequiredParams {
375
+    missingPattern: string;
376
+  }
377
+
378
+  interface PropertyNamesParams {
379
+    propertyName: string;
380
+  }
381
+
382
+  interface IfParams {
383
+    failingKeyword: string;
384
+  }
385
+
386
+  interface SwitchParams {
387
+    caseIndex: number;
388
+  }
389
+
390
+  interface NoParams { }
391
+
392
+  interface EnumParams {
393
+    allowedValues: Array<any>;
394
+  }
395
+}
396
+
397
+export = ajv;

+ 506
- 0
node_modules/ajv/lib/ajv.js View File

@@ -0,0 +1,506 @@
1
+'use strict';
2
+
3
+var compileSchema = require('./compile')
4
+  , resolve = require('./compile/resolve')
5
+  , Cache = require('./cache')
6
+  , SchemaObject = require('./compile/schema_obj')
7
+  , stableStringify = require('fast-json-stable-stringify')
8
+  , formats = require('./compile/formats')
9
+  , rules = require('./compile/rules')
10
+  , $dataMetaSchema = require('./data')
11
+  , util = require('./compile/util');
12
+
13
+module.exports = Ajv;
14
+
15
+Ajv.prototype.validate = validate;
16
+Ajv.prototype.compile = compile;
17
+Ajv.prototype.addSchema = addSchema;
18
+Ajv.prototype.addMetaSchema = addMetaSchema;
19
+Ajv.prototype.validateSchema = validateSchema;
20
+Ajv.prototype.getSchema = getSchema;
21
+Ajv.prototype.removeSchema = removeSchema;
22
+Ajv.prototype.addFormat = addFormat;
23
+Ajv.prototype.errorsText = errorsText;
24
+
25
+Ajv.prototype._addSchema = _addSchema;
26
+Ajv.prototype._compile = _compile;
27
+
28
+Ajv.prototype.compileAsync = require('./compile/async');
29
+var customKeyword = require('./keyword');
30
+Ajv.prototype.addKeyword = customKeyword.add;
31
+Ajv.prototype.getKeyword = customKeyword.get;
32
+Ajv.prototype.removeKeyword = customKeyword.remove;
33
+Ajv.prototype.validateKeyword = customKeyword.validate;
34
+
35
+var errorClasses = require('./compile/error_classes');
36
+Ajv.ValidationError = errorClasses.Validation;
37
+Ajv.MissingRefError = errorClasses.MissingRef;
38
+Ajv.$dataMetaSchema = $dataMetaSchema;
39
+
40
+var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
41
+
42
+var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
43
+var META_SUPPORT_DATA = ['/properties'];
44
+
45
+/**
46
+ * Creates validator instance.
47
+ * Usage: `Ajv(opts)`
48
+ * @param {Object} opts optional options
49
+ * @return {Object} ajv instance
50
+ */
51
+function Ajv(opts) {
52
+  if (!(this instanceof Ajv)) return new Ajv(opts);
53
+  opts = this._opts = util.copy(opts) || {};
54
+  setLogger(this);
55
+  this._schemas = {};
56
+  this._refs = {};
57
+  this._fragments = {};
58
+  this._formats = formats(opts.format);
59
+
60
+  this._cache = opts.cache || new Cache;
61
+  this._loadingSchemas = {};
62
+  this._compilations = [];
63
+  this.RULES = rules();
64
+  this._getId = chooseGetId(opts);
65
+
66
+  opts.loopRequired = opts.loopRequired || Infinity;
67
+  if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
68
+  if (opts.serialize === undefined) opts.serialize = stableStringify;
69
+  this._metaOpts = getMetaSchemaOptions(this);
70
+
71
+  if (opts.formats) addInitialFormats(this);
72
+  if (opts.keywords) addInitialKeywords(this);
73
+  addDefaultMetaSchema(this);
74
+  if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
75
+  if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
76
+  addInitialSchemas(this);
77
+}
78
+
79
+
80
+
81
+/**
82
+ * Validate data using schema
83
+ * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.
84
+ * @this   Ajv
85
+ * @param  {String|Object} schemaKeyRef key, ref or schema object
86
+ * @param  {Any} data to be validated
87
+ * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
88
+ */
89
+function validate(schemaKeyRef, data) {
90
+  var v;
91
+  if (typeof schemaKeyRef == 'string') {
92
+    v = this.getSchema(schemaKeyRef);
93
+    if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
94
+  } else {
95
+    var schemaObj = this._addSchema(schemaKeyRef);
96
+    v = schemaObj.validate || this._compile(schemaObj);
97
+  }
98
+
99
+  var valid = v(data);
100
+  if (v.$async !== true) this.errors = v.errors;
101
+  return valid;
102
+}
103
+
104
+
105
+/**
106
+ * Create validating function for passed schema.
107
+ * @this   Ajv
108
+ * @param  {Object} schema schema object
109
+ * @param  {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
110
+ * @return {Function} validating function
111
+ */
112
+function compile(schema, _meta) {
113
+  var schemaObj = this._addSchema(schema, undefined, _meta);
114
+  return schemaObj.validate || this._compile(schemaObj);
115
+}
116
+
117
+
118
+/**
119
+ * Adds schema to the instance.
120
+ * @this   Ajv
121
+ * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
122
+ * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
123
+ * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
124
+ * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
125
+ * @return {Ajv} this for method chaining
126
+ */
127
+function addSchema(schema, key, _skipValidation, _meta) {
128
+  if (Array.isArray(schema)){
129
+    for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
130
+    return this;
131
+  }
132
+  var id = this._getId(schema);
133
+  if (id !== undefined && typeof id != 'string')
134
+    throw new Error('schema id must be string');
135
+  key = resolve.normalizeId(key || id);
136
+  checkUnique(this, key);
137
+  this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
138
+  return this;
139
+}
140
+
141
+
142
+/**
143
+ * Add schema that will be used to validate other schemas
144
+ * options in META_IGNORE_OPTIONS are alway set to false
145
+ * @this   Ajv
146
+ * @param {Object} schema schema object
147
+ * @param {String} key optional schema key
148
+ * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
149
+ * @return {Ajv} this for method chaining
150
+ */
151
+function addMetaSchema(schema, key, skipValidation) {
152
+  this.addSchema(schema, key, skipValidation, true);
153
+  return this;
154
+}
155
+
156
+
157
+/**
158
+ * Validate schema
159
+ * @this   Ajv
160
+ * @param {Object} schema schema to validate
161
+ * @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
162
+ * @return {Boolean} true if schema is valid
163
+ */
164
+function validateSchema(schema, throwOrLogError) {
165
+  var $schema = schema.$schema;
166
+  if ($schema !== undefined && typeof $schema != 'string')
167
+    throw new Error('$schema must be a string');
168
+  $schema = $schema || this._opts.defaultMeta || defaultMeta(this);
169
+  if (!$schema) {
170
+    this.logger.warn('meta-schema not available');
171
+    this.errors = null;
172
+    return true;
173
+  }
174
+  var valid = this.validate($schema, schema);
175
+  if (!valid && throwOrLogError) {
176
+    var message = 'schema is invalid: ' + this.errorsText();
177
+    if (this._opts.validateSchema == 'log') this.logger.error(message);
178
+    else throw new Error(message);
179
+  }
180
+  return valid;
181
+}
182
+
183
+
184
+function defaultMeta(self) {
185
+  var meta = self._opts.meta;
186
+  self._opts.defaultMeta = typeof meta == 'object'
187
+                            ? self._getId(meta) || meta
188
+                            : self.getSchema(META_SCHEMA_ID)
189
+                              ? META_SCHEMA_ID
190
+                              : undefined;
191
+  return self._opts.defaultMeta;
192
+}
193
+
194
+
195
+/**
196
+ * Get compiled schema from the instance by `key` or `ref`.
197
+ * @this   Ajv
198
+ * @param  {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
199
+ * @return {Function} schema validating function (with property `schema`).
200
+ */
201
+function getSchema(keyRef) {
202
+  var schemaObj = _getSchemaObj(this, keyRef);
203
+  switch (typeof schemaObj) {
204
+    case 'object': return schemaObj.validate || this._compile(schemaObj);
205
+    case 'string': return this.getSchema(schemaObj);
206
+    case 'undefined': return _getSchemaFragment(this, keyRef);
207
+  }
208
+}
209
+
210
+
211
+function _getSchemaFragment(self, ref) {
212
+  var res = resolve.schema.call(self, { schema: {} }, ref);
213
+  if (res) {
214
+    var schema = res.schema
215
+      , root = res.root
216
+      , baseId = res.baseId;
217
+    var v = compileSchema.call(self, schema, root, undefined, baseId);
218
+    self._fragments[ref] = new SchemaObject({
219
+      ref: ref,
220
+      fragment: true,
221
+      schema: schema,
222
+      root: root,
223
+      baseId: baseId,
224
+      validate: v
225
+    });
226
+    return v;
227
+  }
228
+}
229
+
230
+
231
+function _getSchemaObj(self, keyRef) {
232
+  keyRef = resolve.normalizeId(keyRef);
233
+  return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
234
+}
235
+
236
+
237
+/**
238
+ * Remove cached schema(s).
239
+ * If no parameter is passed all schemas but meta-schemas are removed.
240
+ * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
241
+ * Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
242
+ * @this   Ajv
243
+ * @param  {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
244
+ * @return {Ajv} this for method chaining
245
+ */
246
+function removeSchema(schemaKeyRef) {
247
+  if (schemaKeyRef instanceof RegExp) {
248
+    _removeAllSchemas(this, this._schemas, schemaKeyRef);
249
+    _removeAllSchemas(this, this._refs, schemaKeyRef);
250
+    return this;
251
+  }
252
+  switch (typeof schemaKeyRef) {
253
+    case 'undefined':
254
+      _removeAllSchemas(this, this._schemas);
255
+      _removeAllSchemas(this, this._refs);
256
+      this._cache.clear();
257
+      return this;
258
+    case 'string':
259
+      var schemaObj = _getSchemaObj(this, schemaKeyRef);
260
+      if (schemaObj) this._cache.del(schemaObj.cacheKey);
261
+      delete this._schemas[schemaKeyRef];
262
+      delete this._refs[schemaKeyRef];
263
+      return this;
264
+    case 'object':
265
+      var serialize = this._opts.serialize;
266
+      var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
267
+      this._cache.del(cacheKey);
268
+      var id = this._getId(schemaKeyRef);
269
+      if (id) {
270
+        id = resolve.normalizeId(id);
271
+        delete this._schemas[id];
272
+        delete this._refs[id];
273
+      }
274
+  }
275
+  return this;
276
+}
277
+
278
+
279
+function _removeAllSchemas(self, schemas, regex) {
280
+  for (var keyRef in schemas) {
281
+    var schemaObj = schemas[keyRef];
282
+    if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
283
+      self._cache.del(schemaObj.cacheKey);
284
+      delete schemas[keyRef];
285
+    }
286
+  }
287
+}
288
+
289
+
290
+/* @this   Ajv */
291
+function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
292
+  if (typeof schema != 'object' && typeof schema != 'boolean')
293
+    throw new Error('schema should be object or boolean');
294
+  var serialize = this._opts.serialize;
295
+  var cacheKey = serialize ? serialize(schema) : schema;
296
+  var cached = this._cache.get(cacheKey);
297
+  if (cached) return cached;
298
+
299
+  shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
300
+
301
+  var id = resolve.normalizeId(this._getId(schema));
302
+  if (id && shouldAddSchema) checkUnique(this, id);
303
+
304
+  var willValidate = this._opts.validateSchema !== false && !skipValidation;
305
+  var recursiveMeta;
306
+  if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
307
+    this.validateSchema(schema, true);
308
+
309
+  var localRefs = resolve.ids.call(this, schema);
310
+
311
+  var schemaObj = new SchemaObject({
312
+    id: id,
313
+    schema: schema,
314
+    localRefs: localRefs,
315
+    cacheKey: cacheKey,
316
+    meta: meta
317
+  });
318
+
319
+  if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;
320
+  this._cache.put(cacheKey, schemaObj);
321
+
322
+  if (willValidate && recursiveMeta) this.validateSchema(schema, true);
323
+
324
+  return schemaObj;
325
+}
326
+
327
+
328
+/* @this   Ajv */
329
+function _compile(schemaObj, root) {
330
+  if (schemaObj.compiling) {
331
+    schemaObj.validate = callValidate;
332
+    callValidate.schema = schemaObj.schema;
333
+    callValidate.errors = null;
334
+    callValidate.root = root ? root : callValidate;
335
+    if (schemaObj.schema.$async === true)
336
+      callValidate.$async = true;
337
+    return callValidate;
338
+  }
339
+  schemaObj.compiling = true;
340
+
341
+  var currentOpts;
342
+  if (schemaObj.meta) {
343
+    currentOpts = this._opts;
344
+    this._opts = this._metaOpts;
345
+  }
346
+
347
+  var v;
348
+  try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
349
+  catch(e) {
350
+    delete schemaObj.validate;
351
+    throw e;
352
+  }
353
+  finally {
354
+    schemaObj.compiling = false;
355
+    if (schemaObj.meta) this._opts = currentOpts;
356
+  }
357
+
358
+  schemaObj.validate = v;
359
+  schemaObj.refs = v.refs;
360
+  schemaObj.refVal = v.refVal;
361
+  schemaObj.root = v.root;
362
+  return v;
363
+
364
+
365
+  /* @this   {*} - custom context, see passContext option */
366
+  function callValidate() {
367
+    /* jshint validthis: true */
368
+    var _validate = schemaObj.validate;
369
+    var result = _validate.apply(this, arguments);
370
+    callValidate.errors = _validate.errors;
371
+    return result;
372
+  }
373
+}
374
+
375
+
376
+function chooseGetId(opts) {
377
+  switch (opts.schemaId) {
378
+    case 'auto': return _get$IdOrId;
379
+    case 'id': return _getId;
380
+    default: return _get$Id;
381
+  }
382
+}
383
+
384
+/* @this   Ajv */
385
+function _getId(schema) {
386
+  if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
387
+  return schema.id;
388
+}
389
+
390
+/* @this   Ajv */
391
+function _get$Id(schema) {
392
+  if (schema.id) this.logger.warn('schema id ignored', schema.id);
393
+  return schema.$id;
394
+}
395
+
396
+
397
+function _get$IdOrId(schema) {
398
+  if (schema.$id && schema.id && schema.$id != schema.id)
399
+    throw new Error('schema $id is different from id');
400
+  return schema.$id || schema.id;
401
+}
402
+
403
+
404
+/**
405
+ * Convert array of error message objects to string
406
+ * @this   Ajv
407
+ * @param  {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
408
+ * @param  {Object} options optional options with properties `separator` and `dataVar`.
409
+ * @return {String} human readable string with all errors descriptions
410
+ */
411
+function errorsText(errors, options) {
412
+  errors = errors || this.errors;
413
+  if (!errors) return 'No errors';
414
+  options = options || {};
415
+  var separator = options.separator === undefined ? ', ' : options.separator;
416
+  var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
417
+
418
+  var text = '';
419
+  for (var i=0; i<errors.length; i++) {
420
+    var e = errors[i];
421
+    if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
422
+  }
423
+  return text.slice(0, -separator.length);
424
+}
425
+
426
+
427
+/**
428
+ * Add custom format
429
+ * @this   Ajv
430
+ * @param {String} name format name
431
+ * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
432
+ * @return {Ajv} this for method chaining
433
+ */
434
+function addFormat(name, format) {
435
+  if (typeof format == 'string') format = new RegExp(format);
436
+  this._formats[name] = format;
437
+  return this;
438
+}
439
+
440
+
441
+function addDefaultMetaSchema(self) {
442
+  var $dataSchema;
443
+  if (self._opts.$data) {
444
+    $dataSchema = require('./refs/data.json');
445
+    self.addMetaSchema($dataSchema, $dataSchema.$id, true);
446
+  }
447
+  if (self._opts.meta === false) return;
448
+  var metaSchema = require('./refs/json-schema-draft-07.json');
449
+  if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
450
+  self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
451
+  self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
452
+}
453
+
454
+
455
+function addInitialSchemas(self) {
456
+  var optsSchemas = self._opts.schemas;
457
+  if (!optsSchemas) return;
458
+  if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);
459
+  else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);
460
+}
461
+
462
+
463
+function addInitialFormats(self) {
464
+  for (var name in self._opts.formats) {
465
+    var format = self._opts.formats[name];
466
+    self.addFormat(name, format);
467
+  }
468
+}
469
+
470
+
471
+function addInitialKeywords(self) {
472
+  for (var name in self._opts.keywords) {
473
+    var keyword = self._opts.keywords[name];
474
+    self.addKeyword(name, keyword);
475
+  }
476
+}
477
+
478
+
479
+function checkUnique(self, id) {
480
+  if (self._schemas[id] || self._refs[id])
481
+    throw new Error('schema with key or id "' + id + '" already exists');
482
+}
483
+
484
+
485
+function getMetaSchemaOptions(self) {
486
+  var metaOpts = util.copy(self._opts);
487
+  for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
488
+    delete metaOpts[META_IGNORE_OPTIONS[i]];
489
+  return metaOpts;
490
+}
491
+
492
+
493
+function setLogger(self) {
494
+  var logger = self._opts.logger;
495
+  if (logger === false) {
496
+    self.logger = {log: noop, warn: noop, error: noop};
497
+  } else {
498
+    if (logger === undefined) logger = console;
499
+    if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
500
+      throw new Error('logger must implement log, warn and error methods');
501
+    self.logger = logger;
502
+  }
503
+}
504
+
505
+
506
+function noop() {}

+ 26
- 0
node_modules/ajv/lib/cache.js View File

@@ -0,0 +1,26 @@
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
+};

+ 90
- 0
node_modules/ajv/lib/compile/async.js View File

@@ -0,0 +1,90 @@
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
+}

+ 5
- 0
node_modules/ajv/lib/compile/equal.js View File

@@ -0,0 +1,5 @@
1
+'use strict';
2
+
3
+// do NOT remove this file - it would break pre-compiled schemas
4
+// https://github.com/ajv-validator/ajv/issues/889
5
+module.exports = require('fast-deep-equal');

+ 34
- 0
node_modules/ajv/lib/compile/error_classes.js View File

@@ -0,0 +1,34 @@
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
+}

+ 142
- 0
node_modules/ajv/lib/compile/formats.js View File

@@ -0,0 +1,142 @@
1
+'use strict';
2
+
3
+var util = require('./util');
4
+
5
+var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
6
+var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
7
+var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
8
+var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
9
+var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
10
+var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
11
+// uri-template: https://tools.ietf.org/html/rfc6570
12
+var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
13
+// For the source: https://gist.github.com/dperini/729294
14
+// For test cases: https://mathiasbynens.be/demo/url-regex
15
+// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
16
+// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
17
+var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
18
+var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
19
+var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
20
+var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
21
+var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
22
+
23
+
24
+module.exports = formats;
25
+
26
+function formats(mode) {
27
+  mode = mode == 'full' ? 'full' : 'fast';
28
+  return util.copy(formats[mode]);
29
+}
30
+
31
+
32
+formats.fast = {
33
+  // date: http://tools.ietf.org/html/rfc3339#section-5.6
34
+  date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
35
+  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
36
+  time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
37
+  'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
38
+  // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
39
+  uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
40
+  'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
41
+  'uri-template': URITEMPLATE,
42
+  url: URL,
43
+  // email (sources from jsen validator):
44
+  // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
45
+  // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
46
+  email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
47
+  hostname: HOSTNAME,
48
+  // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
49
+  ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
50
+  // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
51
+  ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
52
+  regex: regex,
53
+  // uuid: http://tools.ietf.org/html/rfc4122
54
+  uuid: UUID,
55
+  // JSON-pointer: https://tools.ietf.org/html/rfc6901
56
+  // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
57
+  'json-pointer': JSON_POINTER,
58
+  'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
59
+  // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
60
+  'relative-json-pointer': RELATIVE_JSON_POINTER
61
+};
62
+
63
+
64
+formats.full = {
65
+  date: date,
66
+  time: time,
67
+  'date-time': date_time,
68
+  uri: uri,
69
+  'uri-reference': URIREF,
70
+  'uri-template': URITEMPLATE,
71
+  url: URL,
72
+  email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
73
+  hostname: HOSTNAME,
74
+  ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
75
+  ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
76
+  regex: regex,
77
+  uuid: UUID,
78
+  'json-pointer': JSON_POINTER,
79
+  'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
80
+  'relative-json-pointer': RELATIVE_JSON_POINTER
81
+};
82
+
83
+
84
+function isLeapYear(year) {
85
+  // https://tools.ietf.org/html/rfc3339#appendix-C
86
+  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
87
+}
88
+
89
+
90
+function date(str) {
91
+  // full-date from http://tools.ietf.org/html/rfc3339#section-5.6
92
+  var matches = str.match(DATE);
93
+  if (!matches) return false;
94
+
95
+  var year = +matches[1];
96
+  var month = +matches[2];
97
+  var day = +matches[3];
98
+
99
+  return month >= 1 && month <= 12 && day >= 1 &&
100
+          day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
101
+}
102
+
103
+
104
+function time(str, full) {
105
+  var matches = str.match(TIME);
106
+  if (!matches) return false;
107
+
108
+  var hour = matches[1];
109
+  var minute = matches[2];
110
+  var second = matches[3];
111
+  var timeZone = matches[5];
112
+  return ((hour <= 23 && minute <= 59 && second <= 59) ||
113
+          (hour == 23 && minute == 59 && second == 60)) &&
114
+         (!full || timeZone);
115
+}
116
+
117
+
118
+var DATE_TIME_SEPARATOR = /t|\s/i;
119
+function date_time(str) {
120
+  // http://tools.ietf.org/html/rfc3339#section-5.6
121
+  var dateTime = str.split(DATE_TIME_SEPARATOR);
122
+  return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
123
+}
124
+
125
+
126
+var NOT_URI_FRAGMENT = /\/|:/;
127
+function uri(str) {
128
+  // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
129
+  return NOT_URI_FRAGMENT.test(str) && URI.test(str);
130
+}
131
+
132
+
133
+var Z_ANCHOR = /[^\\]\\Z/;
134
+function regex(str) {
135
+  if (Z_ANCHOR.test(str)) return false;
136
+  try {
137
+    new RegExp(str);
138
+    return true;
139
+  } catch(e) {
140
+    return false;
141
+  }
142
+}

+ 387
- 0
node_modules/ajv/lib/compile/index.js View File

@@ -0,0 +1,387 @@
1
+'use strict';
2
+
3
+var resolve = require('./resolve')
4
+  , util = require('./util')
5
+  , errorClasses = require('./error_classes')
6
+  , stableStringify = require('fast-json-stable-stringify');
7
+
8
+var validateGenerator = require('../dotjs/validate');
9
+
10
+/**
11
+ * Functions below are used inside compiled validations function
12
+ */
13
+
14
+var ucs2length = util.ucs2length;
15
+var equal = require('fast-deep-equal');
16
+
17
+// this error is thrown by async schemas to return validation errors via exception
18
+var ValidationError = errorClasses.Validation;
19
+
20
+module.exports = compile;
21
+
22
+
23
+/**
24
+ * Compiles schema to validation function
25
+ * @this   Ajv
26
+ * @param  {Object} schema schema object
27
+ * @param  {Object} root object with information about the root schema for this schema
28
+ * @param  {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
29
+ * @param  {String} baseId base ID for IDs in the schema
30
+ * @return {Function} validation function
31
+ */
32
+function compile(schema, root, localRefs, baseId) {
33
+  /* jshint validthis: true, evil: true */
34
+  /* eslint no-shadow: 0 */
35
+  var self = this
36
+    , opts = this._opts
37
+    , refVal = [ undefined ]
38
+    , refs = {}
39
+    , patterns = []
40
+    , patternsHash = {}
41
+    , defaults = []
42
+    , defaultsHash = {}
43
+    , customRules = [];
44
+
45
+  root = root || { schema: schema, refVal: refVal, refs: refs };
46
+
47
+  var c = checkCompiling.call(this, schema, root, baseId);
48
+  var compilation = this._compilations[c.index];
49
+  if (c.compiling) return (compilation.callValidate = callValidate);
50
+
51
+  var formats = this._formats;
52
+  var RULES = this.RULES;
53
+
54
+  try {
55
+    var v = localCompile(schema, root, localRefs, baseId);
56
+    compilation.validate = v;
57
+    var cv = compilation.callValidate;
58
+    if (cv) {
59
+      cv.schema = v.schema;
60
+      cv.errors = null;
61
+      cv.refs = v.refs;
62
+      cv.refVal = v.refVal;
63
+      cv.root = v.root;
64
+      cv.$async = v.$async;
65
+      if (opts.sourceCode) cv.source = v.source;
66
+    }
67
+    return v;
68
+  } finally {
69
+    endCompiling.call(this, schema, root, baseId);
70
+  }
71
+
72
+  /* @this   {*} - custom context, see passContext option */
73
+  function callValidate() {
74
+    /* jshint validthis: true */
75
+    var validate = compilation.validate;
76
+    var result = validate.apply(this, arguments);
77
+    callValidate.errors = validate.errors;
78
+    return result;
79
+  }
80
+
81
+  function localCompile(_schema, _root, localRefs, baseId) {
82
+    var isRoot = !_root || (_root && _root.schema == _schema);
83
+    if (_root.schema != root.schema)
84
+      return compile.call(self, _schema, _root, localRefs, baseId);
85
+
86
+    var $async = _schema.$async === true;
87
+
88
+    var sourceCode = validateGenerator({
89
+      isTop: true,
90
+      schema: _schema,
91
+      isRoot: isRoot,
92
+      baseId: baseId,
93
+      root: _root,
94
+      schemaPath: '',
95
+      errSchemaPath: '#',
96
+      errorPath: '""',
97
+      MissingRefError: errorClasses.MissingRef,
98
+      RULES: RULES,
99
+      validate: validateGenerator,
100
+      util: util,
101
+      resolve: resolve,
102
+      resolveRef: resolveRef,
103
+      usePattern: usePattern,
104
+      useDefault: useDefault,
105
+      useCustomRule: useCustomRule,
106
+      opts: opts,
107
+      formats: formats,
108
+      logger: self.logger,
109
+      self: self
110
+    });
111
+
112
+    sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
113
+                   + vars(defaults, defaultCode) + vars(customRules, customRuleCode)
114
+                   + sourceCode;
115
+
116
+    if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
117
+    // console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
118
+    var validate;
119
+    try {
120
+      var makeValidate = new Function(
121
+        'self',
122
+        'RULES',
123
+        'formats',
124
+        'root',
125
+        'refVal',
126
+        'defaults',
127
+        'customRules',
128
+        'equal',
129
+        'ucs2length',
130
+        'ValidationError',
131
+        sourceCode
132
+      );
133
+
134
+      validate = makeValidate(
135
+        self,
136
+        RULES,
137
+        formats,
138
+        root,
139
+        refVal,
140
+        defaults,
141
+        customRules,
142
+        equal,
143
+        ucs2length,
144
+        ValidationError
145
+      );
146
+
147
+      refVal[0] = validate;
148
+    } catch(e) {
149
+      self.logger.error('Error compiling schema, function code:', sourceCode);
150
+      throw e;
151
+    }
152
+
153
+    validate.schema = _schema;
154
+    validate.errors = null;
155
+    validate.refs = refs;
156
+    validate.refVal = refVal;
157
+    validate.root = isRoot ? validate : _root;
158
+    if ($async) validate.$async = true;
159
+    if (opts.sourceCode === true) {
160
+      validate.source = {
161
+        code: sourceCode,
162
+        patterns: patterns,
163
+        defaults: defaults
164
+      };
165
+    }
166
+
167
+    return validate;
168
+  }
169
+
170
+  function resolveRef(baseId, ref, isRoot) {
171
+    ref = resolve.url(baseId, ref);
172
+    var refIndex = refs[ref];
173
+    var _refVal, refCode;
174
+    if (refIndex !== undefined) {
175
+      _refVal = refVal[refIndex];
176
+      refCode = 'refVal[' + refIndex + ']';
177
+      return resolvedRef(_refVal, refCode);
178
+    }
179
+    if (!isRoot && root.refs) {
180
+      var rootRefId = root.refs[ref];
181
+      if (rootRefId !== undefined) {
182
+        _refVal = root.refVal[rootRefId];
183
+        refCode = addLocalRef(ref, _refVal);
184
+        return resolvedRef(_refVal, refCode);
185
+      }
186
+    }
187
+
188
+    refCode = addLocalRef(ref);
189
+    var v = resolve.call(self, localCompile, root, ref);
190
+    if (v === undefined) {
191
+      var localSchema = localRefs && localRefs[ref];
192
+      if (localSchema) {
193
+        v = resolve.inlineRef(localSchema, opts.inlineRefs)
194
+            ? localSchema
195
+            : compile.call(self, localSchema, root, localRefs, baseId);
196
+      }
197
+    }
198
+
199
+    if (v === undefined) {
200
+      removeLocalRef(ref);
201
+    } else {
202
+      replaceLocalRef(ref, v);
203
+      return resolvedRef(v, refCode);
204
+    }
205
+  }
206
+
207
+  function addLocalRef(ref, v) {
208
+    var refId = refVal.length;
209
+    refVal[refId] = v;
210
+    refs[ref] = refId;
211
+    return 'refVal' + refId;
212
+  }
213
+
214
+  function removeLocalRef(ref) {
215
+    delete refs[ref];
216
+  }
217
+
218
+  function replaceLocalRef(ref, v) {
219
+    var refId = refs[ref];
220
+    refVal[refId] = v;
221
+  }
222
+
223
+  function resolvedRef(refVal, code) {
224
+    return typeof refVal == 'object' || typeof refVal == 'boolean'
225
+            ? { code: code, schema: refVal, inline: true }
226
+            : { code: code, $async: refVal && !!refVal.$async };
227
+  }
228
+
229
+  function usePattern(regexStr) {
230
+    var index = patternsHash[regexStr];
231
+    if (index === undefined) {
232
+      index = patternsHash[regexStr] = patterns.length;
233
+      patterns[index] = regexStr;
234
+    }
235
+    return 'pattern' + index;
236
+  }
237
+
238
+  function useDefault(value) {
239
+    switch (typeof value) {
240
+      case 'boolean':
241
+      case 'number':
242
+        return '' + value;
243
+      case 'string':
244
+        return util.toQuotedString(value);
245
+      case 'object':
246
+        if (value === null) return 'null';
247
+        var valueStr = stableStringify(value);
248
+        var index = defaultsHash[valueStr];
249
+        if (index === undefined) {
250
+          index = defaultsHash[valueStr] = defaults.length;
251
+          defaults[index] = value;
252
+        }
253
+        return 'default' + index;
254
+    }
255
+  }
256
+
257
+  function useCustomRule(rule, schema, parentSchema, it) {
258
+    if (self._opts.validateSchema !== false) {
259
+      var deps = rule.definition.dependencies;
260
+      if (deps && !deps.every(function(keyword) {
261
+        return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
262
+      }))
263
+        throw new Error('parent schema must have all required keywords: ' + deps.join(','));
264
+
265
+      var validateSchema = rule.definition.validateSchema;
266
+      if (validateSchema) {
267
+        var valid = validateSchema(schema);
268
+        if (!valid) {
269
+          var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
270
+          if (self._opts.validateSchema == 'log') self.logger.error(message);
271
+          else throw new Error(message);
272
+        }
273
+      }
274
+    }
275
+
276
+    var compile = rule.definition.compile
277
+      , inline = rule.definition.inline
278
+      , macro = rule.definition.macro;
279
+
280
+    var validate;
281
+    if (compile) {
282
+      validate = compile.call(self, schema, parentSchema, it);
283
+    } else if (macro) {
284
+      validate = macro.call(self, schema, parentSchema, it);
285
+      if (opts.validateSchema !== false) self.validateSchema(validate, true);
286
+    } else if (inline) {
287
+      validate = inline.call(self, it, rule.keyword, schema, parentSchema);
288
+    } else {
289
+      validate = rule.definition.validate;
290
+      if (!validate) return;
291
+    }
292
+
293
+    if (validate === undefined)
294
+      throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
295
+
296
+    var index = customRules.length;
297
+    customRules[index] = validate;
298
+
299
+    return {
300
+      code: 'customRule' + index,
301
+      validate: validate
302
+    };
303
+  }
304
+}
305
+
306
+
307
+/**
308
+ * Checks if the schema is currently compiled
309
+ * @this   Ajv
310
+ * @param  {Object} schema schema to compile
311
+ * @param  {Object} root root object
312
+ * @param  {String} baseId base schema ID
313
+ * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
314
+ */
315
+function checkCompiling(schema, root, baseId) {
316
+  /* jshint validthis: true */
317
+  var index = compIndex.call(this, schema, root, baseId);
318
+  if (index >= 0) return { index: index, compiling: true };
319
+  index = this._compilations.length;
320
+  this._compilations[index] = {
321
+    schema: schema,
322
+    root: root,
323
+    baseId: baseId
324
+  };
325
+  return { index: index, compiling: false };
326
+}
327
+
328
+
329
+/**
330
+ * Removes the schema from the currently compiled list
331
+ * @this   Ajv
332
+ * @param  {Object} schema schema to compile
333
+ * @param  {Object} root root object
334
+ * @param  {String} baseId base schema ID
335
+ */
336
+function endCompiling(schema, root, baseId) {
337
+  /* jshint validthis: true */
338
+  var i = compIndex.call(this, schema, root, baseId);
339
+  if (i >= 0) this._compilations.splice(i, 1);
340
+}
341
+
342
+
343
+/**
344
+ * Index of schema compilation in the currently compiled list
345
+ * @this   Ajv
346
+ * @param  {Object} schema schema to compile
347
+ * @param  {Object} root root object
348
+ * @param  {String} baseId base schema ID
349
+ * @return {Integer} compilation index
350
+ */
351
+function compIndex(schema, root, baseId) {
352
+  /* jshint validthis: true */
353
+  for (var i=0; i<this._compilations.length; i++) {
354
+    var c = this._compilations[i];
355
+    if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
356
+  }
357
+  return -1;
358
+}
359
+
360
+
361
+function patternCode(i, patterns) {
362
+  return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
363
+}
364
+
365
+
366
+function defaultCode(i) {
367
+  return 'var default' + i + ' = defaults[' + i + '];';
368
+}
369
+
370
+
371
+function refValCode(i, refVal) {
372
+  return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';
373
+}
374
+
375
+
376
+function customRuleCode(i) {
377
+  return 'var customRule' + i + ' = customRules[' + i + '];';
378
+}
379
+
380
+
381
+function vars(arr, statement) {
382
+  if (!arr.length) return '';
383
+  var code = '';
384
+  for (var i=0; i<arr.length; i++)
385
+    code += statement(i, arr);
386
+  return code;
387
+}

+ 270
- 0
node_modules/ajv/lib/compile/resolve.js View File

@@ -0,0 +1,270 @@
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
+}

+ 66
- 0
node_modules/ajv/lib/compile/rules.js View File

@@ -0,0 +1,66 @@
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
+};

+ 9
- 0
node_modules/ajv/lib/compile/schema_obj.js View File

@@ -0,0 +1,9 @@
1
+'use strict';
2
+
3
+var util = require('./util');
4
+
5
+module.exports = SchemaObject;
6
+
7
+function SchemaObject(obj) {
8
+  util.copy(obj, this);
9
+}

+ 20
- 0
node_modules/ajv/lib/compile/ucs2length.js View File

@@ -0,0 +1,20 @@
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
+};

+ 239
- 0
node_modules/ajv/lib/compile/util.js View File

@@ -0,0 +1,239 @@
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
+  schemaHasRules: schemaHasRules,
17
+  schemaHasRulesExcept: schemaHasRulesExcept,
18
+  schemaUnknownRules: schemaUnknownRules,
19
+  toQuotedString: toQuotedString,
20
+  getPathExpr: getPathExpr,
21
+  getPath: getPath,
22
+  getData: getData,
23
+  unescapeFragment: unescapeFragment,
24
+  unescapeJsonPointer: unescapeJsonPointer,
25
+  escapeFragment: escapeFragment,
26
+  escapeJsonPointer: escapeJsonPointer
27
+};
28
+
29
+
30
+function copy(o, to) {
31
+  to = to || {};
32
+  for (var key in o) to[key] = o[key];
33
+  return to;
34
+}
35
+
36
+
37
+function checkDataType(dataType, data, strictNumbers, negate) {
38
+  var EQUAL = negate ? ' !== ' : ' === '
39
+    , AND = negate ? ' || ' : ' && '
40
+    , OK = negate ? '!' : ''
41
+    , NOT = negate ? '' : '!';
42
+  switch (dataType) {
43
+    case 'null': return data + EQUAL + 'null';
44
+    case 'array': return OK + 'Array.isArray(' + data + ')';
45
+    case 'object': return '(' + OK + data + AND +
46
+                          'typeof ' + data + EQUAL + '"object"' + AND +
47
+                          NOT + 'Array.isArray(' + data + '))';
48
+    case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
49
+                           NOT + '(' + data + ' % 1)' +
50
+                           AND + data + EQUAL + data +
51
+                           (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
52
+    case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
53
+                          (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
54
+    default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
55
+  }
56
+}
57
+
58
+
59
+function checkDataTypes(dataTypes, data, strictNumbers) {
60
+  switch (dataTypes.length) {
61
+    case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
62
+    default:
63
+      var code = '';
64
+      var types = toHash(dataTypes);
65
+      if (types.array && types.object) {
66
+        code = types.null ? '(': '(!' + data + ' || ';
67
+        code += 'typeof ' + data + ' !== "object")';
68
+        delete types.null;
69
+        delete types.array;
70
+        delete types.object;
71
+      }
72
+      if (types.number) delete types.integer;
73
+      for (var t in types)
74
+        code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
75
+
76
+      return code;
77
+  }
78
+}
79
+
80
+
81
+var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
82
+function coerceToTypes(optionCoerceTypes, dataTypes) {
83
+  if (Array.isArray(dataTypes)) {
84
+    var types = [];
85
+    for (var i=0; i<dataTypes.length; i++) {
86
+      var t = dataTypes[i];
87
+      if (COERCE_TO_TYPES[t]) types[types.length] = t;
88
+      else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
89
+    }
90
+    if (types.length) return types;
91
+  } else if (COERCE_TO_TYPES[dataTypes]) {
92
+    return [dataTypes];
93
+  } else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
94
+    return ['array'];
95
+  }
96
+}
97
+
98
+
99
+function toHash(arr) {
100
+  var hash = {};
101
+  for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
102
+  return hash;
103
+}
104
+
105
+
106
+var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
107
+var SINGLE_QUOTE = /'|\\/g;
108
+function getProperty(key) {
109
+  return typeof key == 'number'
110
+          ? '[' + key + ']'
111
+          : IDENTIFIER.test(key)
112
+            ? '.' + key
113
+            : "['" + escapeQuotes(key) + "']";
114
+}
115
+
116
+
117
+function escapeQuotes(str) {
118
+  return str.replace(SINGLE_QUOTE, '\\$&')
119
+            .replace(/\n/g, '\\n')
120
+            .replace(/\r/g, '\\r')
121
+            .replace(/\f/g, '\\f')
122
+            .replace(/\t/g, '\\t');
123
+}
124
+
125
+
126
+function varOccurences(str, dataVar) {
127
+  dataVar += '[^0-9]';
128
+  var matches = str.match(new RegExp(dataVar, 'g'));
129
+  return matches ? matches.length : 0;
130
+}
131
+
132
+
133
+function varReplace(str, dataVar, expr) {
134
+  dataVar += '([^0-9])';
135
+  expr = expr.replace(/\$/g, '$$$$');
136
+  return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
137
+}
138
+
139
+
140
+function schemaHasRules(schema, rules) {
141
+  if (typeof schema == 'boolean') return !schema;
142
+  for (var key in schema) if (rules[key]) return true;
143
+}
144
+
145
+
146
+function schemaHasRulesExcept(schema, rules, exceptKeyword) {
147
+  if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
148
+  for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
149
+}
150
+
151
+
152
+function schemaUnknownRules(schema, rules) {
153
+  if (typeof schema == 'boolean') return;
154
+  for (var key in schema) if (!rules[key]) return key;
155
+}
156
+
157
+
158
+function toQuotedString(str) {
159
+  return '\'' + escapeQuotes(str) + '\'';
160
+}
161
+
162
+
163
+function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
164
+  var path = jsonPointers // false by default
165
+              ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
166
+              : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
167
+  return joinPaths(currentPath, path);
168
+}
169
+
170
+
171
+function getPath(currentPath, prop, jsonPointers) {
172
+  var path = jsonPointers // false by default
173
+              ? toQuotedString('/' + escapeJsonPointer(prop))
174
+              : toQuotedString(getProperty(prop));
175
+  return joinPaths(currentPath, path);
176
+}
177
+
178
+
179
+var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
180
+var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
181
+function getData($data, lvl, paths) {
182
+  var up, jsonPointer, data, matches;
183
+  if ($data === '') return 'rootData';
184
+  if ($data[0] == '/') {
185
+    if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
186
+    jsonPointer = $data;
187
+    data = 'rootData';
188
+  } else {
189
+    matches = $data.match(RELATIVE_JSON_POINTER);
190
+    if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
191
+    up = +matches[1];
192
+    jsonPointer = matches[2];
193
+    if (jsonPointer == '#') {
194
+      if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
195
+      return paths[lvl - up];
196
+    }
197
+
198
+    if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
199
+    data = 'data' + ((lvl - up) || '');
200
+    if (!jsonPointer) return data;
201
+  }
202
+
203
+  var expr = data;
204
+  var segments = jsonPointer.split('/');
205
+  for (var i=0; i<segments.length; i++) {
206
+    var segment = segments[i];
207
+    if (segment) {
208
+      data += getProperty(unescapeJsonPointer(segment));
209
+      expr += ' && ' + data;
210
+    }
211
+  }
212
+  return expr;
213
+}
214
+
215
+
216
+function joinPaths (a, b) {
217
+  if (a == '""') return b;
218
+  return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
219
+}
220
+
221
+
222
+function unescapeFragment(str) {
223
+  return unescapeJsonPointer(decodeURIComponent(str));
224
+}
225
+
226
+
227
+function escapeFragment(str) {
228
+  return encodeURIComponent(escapeJsonPointer(str));
229
+}
230
+
231
+
232
+function escapeJsonPointer(str) {
233
+  return str.replace(/~/g, '~0').replace(/\//g, '~1');
234
+}
235
+
236
+
237
+function unescapeJsonPointer(str) {
238
+  return str.replace(/~1/g, '/').replace(/~0/g, '~');
239
+}

+ 49
- 0
node_modules/ajv/lib/data.js View File

@@ -0,0 +1,49 @@
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/ajv-validator/ajv/master/lib/refs/data.json#' }
42
+          ]
43
+        };
44
+      }
45
+    }
46
+  }
47
+
48
+  return metaSchema;
49
+};

+ 37
- 0
node_modules/ajv/lib/definition_schema.js View File

@@ -0,0 +1,37 @@
1
+'use strict';
2
+
3
+var metaSchema = require('./refs/json-schema-draft-07.json');
4
+
5
+module.exports = {
6
+  $id: 'https://github.com/ajv-validator/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
+};

+ 113
- 0
node_modules/ajv/lib/dot/_limit.jst View File

@@ -0,0 +1,113 @@
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
+  if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
22
+    throw new Error($keyword + ' must be number');
23
+  }
24
+  if (!($isDataExcl || $schemaExcl === undefined
25
+                    || typeof $schemaExcl == 'number'
26
+                    || typeof $schemaExcl == 'boolean')) {
27
+    throw new Error($exclusiveKeyword + ' must be number or boolean');
28
+  }
29
+}}
30
+
31
+{{? $isDataExcl }}
32
+  {{
33
+    var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
34
+      , $exclusive = 'exclusive' + $lvl
35
+      , $exclType = 'exclType' + $lvl
36
+      , $exclIsNumber = 'exclIsNumber' + $lvl
37
+      , $opExpr = 'op' + $lvl
38
+      , $opStr = '\' + ' + $opExpr + ' + \'';
39
+  }}
40
+  var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
41
+  {{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
42
+
43
+  var {{=$exclusive}};
44
+  var {{=$exclType}} = typeof {{=$schemaValueExcl}};
45
+  if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') {
46
+    {{ var $errorKeyword = $exclusiveKeyword; }}
47
+    {{# def.error:'_exclusiveLimit' }}
48
+  } else if ({{# def.$dataNotType:'number' }}
49
+            {{=$exclType}} == 'number'
50
+              ? (
51
+                  ({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}})
52
+                    ? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}}
53
+                    : {{=$data}} {{=$notOp}} {{=$schemaValue}}
54
+                )
55
+              : (
56
+                  ({{=$exclusive}} = {{=$schemaValueExcl}} === true)
57
+                    ? {{=$data}} {{=$notOp}}= {{=$schemaValue}}
58
+                    : {{=$data}} {{=$notOp}} {{=$schemaValue}}
59
+                )
60
+            || {{=$data}} !== {{=$data}}) {
61
+    var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
62
+    {{
63
+      if ($schema === undefined) {
64
+        $errorKeyword = $exclusiveKeyword;
65
+        $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
66
+        $schemaValue = $schemaValueExcl;
67
+        $isData = $isDataExcl;
68
+      }
69
+    }}
70
+{{??}}
71
+  {{
72
+    var $exclIsNumber = typeof $schemaExcl == 'number'
73
+      , $opStr = $op;  /*used in error*/
74
+  }}
75
+
76
+  {{? $exclIsNumber && $isData }}
77
+    {{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }}
78
+    if ({{# def.$dataNotType:'number' }}
79
+        ( {{=$schemaValue}} === undefined
80
+          || {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}}
81
+            ? {{=$data}} {{=$notOp}}= {{=$schemaExcl}}
82
+            : {{=$data}} {{=$notOp}} {{=$schemaValue}} )
83
+        || {{=$data}} !== {{=$data}}) {
84
+  {{??}}
85
+    {{
86
+      if ($exclIsNumber && $schema === undefined) {
87
+          {{# def.setExclusiveLimit }}
88
+          $schemaValue = $schemaExcl;
89
+          $notOp += '=';
90
+      } else {
91
+        if ($exclIsNumber)
92
+          $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
93
+
94
+        if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
95
+          {{# def.setExclusiveLimit }}
96
+          $notOp += '=';
97
+        } else {
98
+          $exclusive = false;
99
+          $opStr += '=';
100
+        }
101
+      }
102
+
103
+      var $opExpr = '\'' + $opStr + '\''; /*used in error*/
104
+    }}
105
+
106
+    if ({{# def.$dataNotType:'number' }}
107
+        {{=$data}} {{=$notOp}} {{=$schemaValue}}
108
+        || {{=$data}} !== {{=$data}}) {
109
+  {{?}}
110
+{{?}}
111
+    {{ $errorKeyword = $errorKeyword || $keyword; }}
112
+    {{# def.error:'_limit' }}
113
+  } {{? $breakOnError }} else { {{?}}

+ 12
- 0
node_modules/ajv/lib/dot/_limitItems.jst View File

@@ -0,0 +1,12 @@
1
+{{# def.definitions }}
2
+{{# def.errors }}
3
+{{# def.setupKeyword }}
4
+{{# def.$data }}
5
+
6
+{{# def.numberKeyword }}
7
+
8
+{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
9
+if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
10
+  {{ var $errorKeyword = $keyword; }}
11
+  {{# def.error:'_limitItems' }}
12
+} {{? $breakOnError }} else { {{?}}

+ 12
- 0
node_modules/ajv/lib/dot/_limitLength.jst View File

@@ -0,0 +1,12 @@
1
+{{# def.definitions }}
2
+{{# def.errors }}
3
+{{# def.setupKeyword }}
4
+{{# def.$data }}
5
+
6
+{{# def.numberKeyword }}
7
+
8
+{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
9
+if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
10
+  {{ var $errorKeyword = $keyword; }}
11
+  {{# def.error:'_limitLength' }}
12
+} {{? $breakOnError }} else { {{?}}

+ 12
- 0
node_modules/ajv/lib/dot/_limitProperties.jst View File

@@ -0,0 +1,12 @@
1
+{{# def.definitions }}
2
+{{# def.errors }}
3
+{{# def.setupKeyword }}
4
+{{# def.$data }}
5
+
6
+{{# def.numberKeyword }}
7
+
8
+{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
9
+if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
10
+  {{ var $errorKeyword = $keyword; }}
11
+  {{# def.error:'_limitProperties' }}
12
+} {{? $breakOnError }} else { {{?}}

+ 32
- 0
node_modules/ajv/lib/dot/allOf.jst View File

@@ -0,0 +1,32 @@
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
+{{?}}

+ 46
- 0
node_modules/ajv/lib/dot/anyOf.jst View File

@@ -0,0 +1,46 @@
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
+  {{? $breakOnError }}
44
+    if (true) {
45
+  {{?}}
46
+{{?}}

+ 51
- 0
node_modules/ajv/lib/dot/coerce.def View File

@@ -0,0 +1,51 @@
1
+{{## def.coerceType:
2
+  {{
3
+    var $dataType = 'dataType' + $lvl
4
+      , $coerced = 'coerced' + $lvl;
5
+  }}
6
+  var {{=$dataType}} = typeof {{=$data}};
7
+  var {{=$coerced}} = undefined;
8
+
9
+  {{? it.opts.coerceTypes == 'array' }}
10
+    if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) {
11
+      {{=$data}} = {{=$data}}[0];
12
+      {{=$dataType}} = typeof {{=$data}};
13
+      if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}};
14
+    }
15
+  {{?}}
16
+
17
+  if ({{=$coerced}} !== undefined) ;
18
+  {{~ $coerceToTypes:$type:$i }}
19
+    {{? $type == 'string' }}
20
+      else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
21
+        {{=$coerced}} = '' + {{=$data}};
22
+      else if ({{=$data}} === null) {{=$coerced}} = '';
23
+    {{?? $type == 'number' || $type == 'integer' }}
24
+      else if ({{=$dataType}} == 'boolean' || {{=$data}} === null
25
+          || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
26
+          {{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
27
+        {{=$coerced}} = +{{=$data}};
28
+    {{?? $type == 'boolean' }}
29
+      else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
30
+        {{=$coerced}} = false;
31
+      else if ({{=$data}} === 'true' || {{=$data}} === 1)
32
+        {{=$coerced}} = true;
33
+    {{?? $type == 'null' }}
34
+      else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
35
+        {{=$coerced}} = null;
36
+    {{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
37
+      else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
38
+        {{=$coerced}} = [{{=$data}}];
39
+    {{?}}
40
+  {{~}}
41
+  else {
42
+    {{# def.error:'type' }}
43
+  }
44
+
45
+  if ({{=$coerced}} !== undefined) {
46
+    {{# def.setParentData }}
47
+    {{=$data}} = {{=$coerced}};
48
+    {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
49
+      {{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
50
+  }
51
+#}}

+ 9
- 0
node_modules/ajv/lib/dot/comment.jst View File

@@ -0,0 +1,9 @@
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
+{{?}}

+ 11
- 0
node_modules/ajv/lib/dot/const.jst View File

@@ -0,0 +1,11 @@
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 { {{?}}

+ 55
- 0
node_modules/ajv/lib/dot/contains.jst View File

@@ -0,0 +1,55 @@
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 }} } {{?}}

+ 191
- 0
node_modules/ajv/lib/dot/custom.jst View File

@@ -0,0 +1,191 @@
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
+{{?}}

+ 47
- 0
node_modules/ajv/lib/dot/defaults.def View File

@@ -0,0 +1,47 @@
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
+#}}

+ 203
- 0
node_modules/ajv/lib/dot/definitions.def View File

@@ -0,0 +1,203 @@
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
+      || _schema === false
69
+    : it.util.schemaHasRules(_schema, it.RULES.all))
70
+#}}
71
+
72
+
73
+{{## def.strLength:
74
+  {{? it.opts.unicode === false }}
75
+    {{=$data}}.length
76
+  {{??}}
77
+    ucs2length({{=$data}})
78
+  {{?}}
79
+#}}
80
+
81
+
82
+{{## def.willOptimize:
83
+  it.util.varOccurences($code, $nextData) < 2
84
+#}}
85
+
86
+
87
+{{## def.generateSubschemaCode:
88
+  {{
89
+    var $code = it.validate($it);
90
+    $it.baseId = $currentBaseId;
91
+  }}
92
+#}}
93
+
94
+
95
+{{## def.insertSubschemaCode:
96
+  {{= it.validate($it) }}
97
+  {{ $it.baseId = $currentBaseId; }}
98
+#}}
99
+
100
+
101
+{{## def._optimizeValidate:
102
+  it.util.varReplace($code, $nextData, $passData)
103
+#}}
104
+
105
+
106
+{{## def.optimizeValidate:
107
+  {{? {{# def.willOptimize}} }}
108
+    {{= {{# def._optimizeValidate }} }}
109
+  {{??}}
110
+    var {{=$nextData}} = {{=$passData}};
111
+    {{= $code }}
112
+  {{?}}
113
+#}}
114
+
115
+
116
+{{## def.$data:
117
+  {{
118
+    var $isData = it.opts.$data && $schema && $schema.$data
119
+      , $schemaValue;
120
+  }}
121
+  {{? $isData }}
122
+    var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
123
+    {{ $schemaValue = 'schema' + $lvl; }}
124
+  {{??}}
125
+    {{ $schemaValue = $schema; }}
126
+  {{?}}
127
+#}}
128
+
129
+
130
+{{## def.$dataNotType:_type:
131
+  {{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
132
+#}}
133
+
134
+
135
+{{## def.check$dataIsArray:
136
+  if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
137
+  else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
138
+  else {
139
+#}}
140
+
141
+
142
+{{## def.numberKeyword:
143
+  {{? !($isData || typeof $schema == 'number') }}
144
+    {{ throw new Error($keyword + ' must be number'); }}
145
+  {{?}}
146
+#}}
147
+
148
+
149
+{{## def.beginDefOut:
150
+  {{
151
+    var $$outStack = $$outStack || [];
152
+    $$outStack.push(out);
153
+    out = '';
154
+  }}
155
+#}}
156
+
157
+
158
+{{## def.storeDefOut:_variable:
159
+  {{
160
+    var _variable = out;
161
+    out = $$outStack.pop();
162
+  }}
163
+#}}
164
+
165
+
166
+{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
167
+
168
+{{## def.setParentData:
169
+  {{
170
+    var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
171
+      , $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
172
+  }}
173
+#}}
174
+
175
+{{## def.passParentData:
176
+  {{# def.setParentData }}
177
+  , {{= $parentData }}
178
+  , {{= $parentDataProperty }}
179
+#}}
180
+
181
+
182
+{{## def.iterateProperties:
183
+  {{? $ownProperties }}
184
+    {{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}});
185
+    for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) {
186
+      var {{=$key}} = {{=$dataProperties}}[{{=$idx}}];
187
+  {{??}}
188
+    for (var {{=$key}} in {{=$data}}) {
189
+  {{?}}
190
+#}}
191
+
192
+
193
+{{## def.noPropertyInData:
194
+  {{=$useData}} === undefined
195
+  {{? $ownProperties }}
196
+    || !{{# def.isOwnProperty }}
197
+  {{?}}
198
+#}}
199
+
200
+
201
+{{## def.isOwnProperty:
202
+  Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}')
203
+#}}

+ 79
- 0
node_modules/ajv/lib/dot/dependencies.jst View File

@@ -0,0 +1,79 @@
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
+    if ($property == '__proto__') continue;
23
+    var $sch = $schema[$property];
24
+    var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
25
+    $deps[$property] = $sch;
26
+  }
27
+}}
28
+
29
+var {{=$errs}} = errors;
30
+
31
+{{ var $currentErrorPath = it.errorPath; }}
32
+
33
+var missing{{=$lvl}};
34
+{{ for (var $property in $propertyDeps) { }}
35
+  {{ $deps = $propertyDeps[$property]; }}
36
+  {{? $deps.length }}
37
+    if ({{# def.propertyInData }}
38
+      {{? $breakOnError }}
39
+          && ({{# def.checkMissingProperty:$deps }})) {
40
+          {{# def.errorMissingProperty:'dependencies' }}
41
+      {{??}}
42
+        ) {
43
+          {{~ $deps:$propertyKey }}
44
+            {{# def.allErrorsMissingProperty:'dependencies' }}
45
+          {{~}}
46
+      {{?}}
47
+    } {{# def.elseIfValid }}
48
+  {{?}}
49
+{{ } }}
50
+
51
+{{
52
+  it.errorPath = $currentErrorPath;
53
+  var $currentBaseId = $it.baseId;
54
+}}
55
+
56
+
57
+{{ for (var $property in $schemaDeps) { }}
58
+  {{ var $sch = $schemaDeps[$property]; }}
59
+  {{? {{# def.nonEmptySchema:$sch }} }}
60
+    {{=$nextValid}} = true;
61
+
62
+    if ({{# def.propertyInData }}) {
63
+      {{ 
64
+        $it.schema = $sch;
65
+        $it.schemaPath = $schemaPath + it.util.getProperty($property);
66
+        $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
67
+      }}
68
+
69
+      {{# def.insertSubschemaCode }}
70
+    }
71
+
72
+    {{# def.ifResultValid }}
73
+  {{?}}
74
+{{ } }}
75
+
76
+{{? $breakOnError }} 
77
+  {{= $closingBraces }}
78
+  if ({{=$errs}} == errors) {
79
+{{?}}

+ 30
- 0
node_modules/ajv/lib/dot/enum.jst View File

@@ -0,0 +1,30 @@
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 { {{?}}

+ 194
- 0
node_modules/ajv/lib/dot/errors.def View File

@@ -0,0 +1,194 @@
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
+} #}}

+ 106
- 0
node_modules/ajv/lib/dot/format.jst View File

@@ -0,0 +1,106 @@
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 { {{?}}

+ 73
- 0
node_modules/ajv/lib/dot/if.jst View File

@@ -0,0 +1,73 @@
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
+  {{? $breakOnError }}
70
+    if (true) {
71
+  {{?}}
72
+{{?}}
73
+

+ 98
- 0
node_modules/ajv/lib/dot/items.jst View File

@@ -0,0 +1,98 @@
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
+{{?}}

+ 39
- 0
node_modules/ajv/lib/dot/missing.def View File

@@ -0,0 +1,39 @@
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
+#}}

+ 22
- 0
node_modules/ajv/lib/dot/multipleOf.jst View File

@@ -0,0 +1,22 @@
1
+{{# def.definitions }}
2
+{{# def.errors }}
3
+{{# def.setupKeyword }}
4
+{{# def.$data }}
5
+
6
+{{# def.numberKeyword }}
7
+
8
+var division{{=$lvl}};
9
+if ({{?$isData}}
10
+      {{=$schemaValue}} !== undefined && (
11
+      typeof {{=$schemaValue}} != 'number' ||
12
+    {{?}}
13
+      (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
14
+      {{? it.opts.multipleOfPrecision }}
15
+        Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
16
+      {{??}}
17
+        division{{=$lvl}} !== parseInt(division{{=$lvl}})
18
+      {{?}}
19
+      )
20
+    {{?$isData}}  )  {{?}} ) {
21
+  {{# def.error:'multipleOf' }}
22
+} {{? $breakOnError }} else { {{?}}

+ 43
- 0
node_modules/ajv/lib/dot/not.jst View File

@@ -0,0 +1,43 @@
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
+{{?}}

+ 54
- 0
node_modules/ajv/lib/dot/oneOf.jst View File

@@ -0,0 +1,54 @@
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 }} } {{?}}

+ 14
- 0
node_modules/ajv/lib/dot/pattern.jst View File

@@ -0,0 +1,14 @@
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 { {{?}}

+ 245
- 0
node_modules/ajv/lib/dot/properties.jst View File

@@ -0,0 +1,245 @@
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 || {}).filter(notProto)
32
+    , $pProperties = it.schema.patternProperties || {}
33
+    , $pPropertyKeys = Object.keys($pProperties).filter(notProto)
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
+  function notProto(p) { return p !== '__proto__'; }
50
+}}
51
+
52
+
53
+var {{=$errs}} = errors;
54
+var {{=$nextValid}} = true;
55
+{{? $ownProperties }}
56
+  var {{=$dataProperties}} = undefined;
57
+{{?}}
58
+
59
+{{? $checkAdditional }}
60
+  {{# def.iterateProperties }}
61
+    {{? $someProperties }}
62
+      var isAdditional{{=$lvl}} = !(false
63
+        {{? $schemaKeys.length }}
64
+          {{? $schemaKeys.length > 8 }}
65
+            || validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}})
66
+          {{??}}
67
+            {{~ $schemaKeys:$propertyKey }}
68
+              || {{=$key}} == {{= it.util.toQuotedString($propertyKey) }}
69
+            {{~}}
70
+          {{?}}
71
+        {{?}}
72
+        {{? $pPropertyKeys.length }}
73
+          {{~ $pPropertyKeys:$pProperty:$i }}
74
+            || {{= it.usePattern($pProperty) }}.test({{=$key}})
75
+          {{~}}
76
+        {{?}}
77
+      );
78
+
79
+      if (isAdditional{{=$lvl}}) {
80
+    {{?}}
81
+    {{? $removeAdditional == 'all' }}
82
+      delete {{=$data}}[{{=$key}}];
83
+    {{??}}
84
+      {{
85
+        var $currentErrorPath = it.errorPath;
86
+        var $additionalProperty = '\' + ' + $key + ' + \'';
87
+        if (it.opts._errorDataPathProperty) {
88
+          it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
89
+        }
90
+      }}
91
+      {{? $noAdditional }}
92
+        {{? $removeAdditional }}
93
+          delete {{=$data}}[{{=$key}}];
94
+        {{??}}
95
+          {{=$nextValid}} = false;
96
+          {{
97
+            var $currErrSchemaPath = $errSchemaPath;
98
+            $errSchemaPath = it.errSchemaPath + '/additionalProperties';
99
+          }}
100
+          {{# def.error:'additionalProperties' }}
101
+          {{ $errSchemaPath = $currErrSchemaPath; }}
102
+          {{? $breakOnError }} break; {{?}}
103
+        {{?}}
104
+      {{?? $additionalIsSchema }}
105
+        {{? $removeAdditional == 'failing' }}
106
+          var {{=$errs}} = errors;
107
+          {{# def.setCompositeRule }}
108
+
109
+          {{# def.validateAdditional }}
110
+
111
+          if (!{{=$nextValid}}) {
112
+            errors = {{=$errs}};
113
+            if (validate.errors !== null) {
114
+              if (errors) validate.errors.length = errors;
115
+              else validate.errors = null;
116
+            }
117
+            delete {{=$data}}[{{=$key}}];
118
+          }
119
+
120
+          {{# def.resetCompositeRule }}
121
+        {{??}}
122
+          {{# def.validateAdditional }}
123
+          {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
124
+        {{?}}
125
+      {{?}}
126
+      {{ it.errorPath = $currentErrorPath; }}
127
+    {{?}}
128
+    {{? $someProperties }}
129
+      }
130
+    {{?}}
131
+  }
132
+
133
+  {{# def.ifResultValid }}
134
+{{?}}
135
+
136
+{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }}
137
+
138
+{{? $schemaKeys.length }}
139
+  {{~ $schemaKeys:$propertyKey }}
140
+    {{ var $sch = $schema[$propertyKey]; }}
141
+
142
+    {{? {{# def.nonEmptySchema:$sch}} }}
143
+      {{
144
+        var $prop = it.util.getProperty($propertyKey)
145
+          , $passData = $data + $prop
146
+          , $hasDefault = $useDefaults && $sch.default !== undefined;
147
+        $it.schema = $sch;
148
+        $it.schemaPath = $schemaPath + $prop;
149
+        $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
150
+        $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
151
+        $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
152
+      }}
153
+
154
+      {{# def.generateSubschemaCode }}
155
+
156
+      {{? {{# def.willOptimize }} }}
157
+        {{
158
+          $code = {{# def._optimizeValidate }};
159
+          var $useData = $passData;
160
+        }}
161
+      {{??}}
162
+        {{ var $useData = $nextData; }}
163
+        var {{=$nextData}} = {{=$passData}};
164
+      {{?}}
165
+
166
+      {{? $hasDefault }}
167
+        {{= $code }}
168
+      {{??}}
169
+        {{? $requiredHash && $requiredHash[$propertyKey] }}
170
+          if ({{# def.noPropertyInData }}) {
171
+            {{=$nextValid}} = false;
172
+            {{
173
+              var $currentErrorPath = it.errorPath
174
+                , $currErrSchemaPath = $errSchemaPath
175
+                , $missingProperty = it.util.escapeQuotes($propertyKey);
176
+              if (it.opts._errorDataPathProperty) {
177
+                it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
178
+              }
179
+              $errSchemaPath = it.errSchemaPath + '/required';
180
+            }}
181
+            {{# def.error:'required' }}
182
+            {{ $errSchemaPath = $currErrSchemaPath; }}
183
+            {{ it.errorPath = $currentErrorPath; }}
184
+          } else {
185
+        {{??}}
186
+          {{? $breakOnError }}
187
+            if ({{# def.noPropertyInData }}) {
188
+              {{=$nextValid}} = true;
189
+            } else {
190
+          {{??}}
191
+            if ({{=$useData}} !== undefined
192
+              {{? $ownProperties }}
193
+                && {{# def.isOwnProperty }}
194
+              {{?}}
195
+            ) {
196
+          {{?}}
197
+        {{?}}
198
+
199
+          {{= $code }}
200
+        }
201
+      {{?}}  {{ /* $hasDefault */ }}
202
+    {{?}} {{ /* def.nonEmptySchema */ }}
203
+
204
+    {{# def.ifResultValid }}
205
+  {{~}}
206
+{{?}}
207
+
208
+{{? $pPropertyKeys.length }}
209
+  {{~ $pPropertyKeys:$pProperty }}
210
+    {{ var $sch = $pProperties[$pProperty]; }}
211
+
212
+    {{? {{# def.nonEmptySchema:$sch}} }}
213
+      {{
214
+        $it.schema = $sch;
215
+        $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
216
+        $it.errSchemaPath = it.errSchemaPath + '/patternProperties/'
217
+                                             + it.util.escapeFragment($pProperty);
218
+      }}
219
+
220
+      {{# def.iterateProperties }}
221
+        if ({{= it.usePattern($pProperty) }}.test({{=$key}})) {
222
+          {{
223
+            $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
224
+            var $passData = $data + '[' + $key + ']';
225
+            $it.dataPathArr[$dataNxt] = $key;
226
+          }}
227
+
228
+          {{# def.generateSubschemaCode }}
229
+          {{# def.optimizeValidate }}
230
+
231
+          {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
232
+        }
233
+        {{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
234
+      }
235
+
236
+      {{# def.ifResultValid }}
237
+    {{?}} {{ /* def.nonEmptySchema */ }}
238
+  {{~}}
239
+{{?}}
240
+
241
+
242
+{{? $breakOnError }}
243
+  {{= $closingBraces }}
244
+  if ({{=$errs}} == errors) {
245
+{{?}}

+ 52
- 0
node_modules/ajv/lib/dot/propertyNames.jst View File

@@ -0,0 +1,52 @@
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
+{{?}}

+ 85
- 0
node_modules/ajv/lib/dot/ref.jst View File

@@ -0,0 +1,85 @@
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
+{{?}}

+ 108
- 0
node_modules/ajv/lib/dot/required.jst View File

@@ -0,0 +1,108 @@
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
+{{?}}

+ 62
- 0
node_modules/ajv/lib/dot/uniqueItems.jst View File

@@ -0,0 +1,62 @@
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', it.opts.strictNumbers, 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
+{{?}}

+ 276
- 0
node_modules/ajv/lib/dot/validate.jst View File

@@ -0,0 +1,276 @@
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 = [""];
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, it.opts.strictNumbers, 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, it.opts.strictNumbers) }}) {
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
+{{
258
+  function $shouldUseGroup($rulesGroup) {
259
+    var rules = $rulesGroup.rules;
260
+    for (var i=0; i < rules.length; i++)
261
+      if ($shouldUseRule(rules[i]))
262
+        return true;
263
+  }
264
+
265
+  function $shouldUseRule($rule) {
266
+    return it.schema[$rule.keyword] !== undefined ||
267
+           ($rule.implements && $ruleImplementsSomeKeyword($rule));
268
+  }
269
+
270
+  function $ruleImplementsSomeKeyword($rule) {
271
+    var impl = $rule.implements;
272
+    for (var i=0; i < impl.length; i++)
273
+      if (it.schema[impl[i]] !== undefined)
274
+        return true;
275
+  }
276
+}}

+ 3
- 0
node_modules/ajv/lib/dotjs/README.md View File

@@ -0,0 +1,3 @@
1
+These files are compiled dot templates from dot folder.
2
+
3
+Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder.

+ 163
- 0
node_modules/ajv/lib/dotjs/_limit.js View File

@@ -0,0 +1,163 @@
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 (!($isData || typeof $schema == 'number' || $schema === undefined)) {
28
+    throw new Error($keyword + ' must be number');
29
+  }
30
+  if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
31
+    throw new Error($exclusiveKeyword + ' must be number or boolean');
32
+  }
33
+  if ($isDataExcl) {
34
+    var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
35
+      $exclusive = 'exclusive' + $lvl,
36
+      $exclType = 'exclType' + $lvl,
37
+      $exclIsNumber = 'exclIsNumber' + $lvl,
38
+      $opExpr = 'op' + $lvl,
39
+      $opStr = '\' + ' + $opExpr + ' + \'';
40
+    out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
41
+    $schemaValueExcl = 'schemaExcl' + $lvl;
42
+    out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { ';
43
+    var $errorKeyword = $exclusiveKeyword;
44
+    var $$outStack = $$outStack || [];
45
+    $$outStack.push(out);
46
+    out = ''; /* istanbul ignore else */
47
+    if (it.createErrors !== false) {
48
+      out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
49
+      if (it.opts.messages !== false) {
50
+        out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
51
+      }
52
+      if (it.opts.verbose) {
53
+        out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
54
+      }
55
+      out += ' } ';
56
+    } else {
57
+      out += ' {} ';
58
+    }
59
+    var __err = out;
60
+    out = $$outStack.pop();
61
+    if (!it.compositeRule && $breakOnError) {
62
+      /* istanbul ignore if */
63
+      if (it.async) {
64
+        out += ' throw new ValidationError([' + (__err) + ']); ';
65
+      } else {
66
+        out += ' validate.errors = [' + (__err) + ']; return false; ';
67
+      }
68
+    } else {
69
+      out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
70
+    }
71
+    out += ' } else if ( ';
72
+    if ($isData) {
73
+      out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
74
+    }
75
+    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) + '=\'; ';
76
+    if ($schema === undefined) {
77
+      $errorKeyword = $exclusiveKeyword;
78
+      $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
79
+      $schemaValue = $schemaValueExcl;
80
+      $isData = $isDataExcl;
81
+    }
82
+  } else {
83
+    var $exclIsNumber = typeof $schemaExcl == 'number',
84
+      $opStr = $op;
85
+    if ($exclIsNumber && $isData) {
86
+      var $opExpr = '\'' + $opStr + '\'';
87
+      out += ' if ( ';
88
+      if ($isData) {
89
+        out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
90
+      }
91
+      out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';
92
+    } else {
93
+      if ($exclIsNumber && $schema === undefined) {
94
+        $exclusive = true;
95
+        $errorKeyword = $exclusiveKeyword;
96
+        $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
97
+        $schemaValue = $schemaExcl;
98
+        $notOp += '=';
99
+      } else {
100
+        if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
101
+        if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
102
+          $exclusive = true;
103
+          $errorKeyword = $exclusiveKeyword;
104
+          $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
105
+          $notOp += '=';
106
+        } else {
107
+          $exclusive = false;
108
+          $opStr += '=';
109
+        }
110
+      }
111
+      var $opExpr = '\'' + $opStr + '\'';
112
+      out += ' if ( ';
113
+      if ($isData) {
114
+        out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
115
+      }
116
+      out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';
117
+    }
118
+  }
119
+  $errorKeyword = $errorKeyword || $keyword;
120
+  var $$outStack = $$outStack || [];
121
+  $$outStack.push(out);
122
+  out = ''; /* istanbul ignore else */
123
+  if (it.createErrors !== false) {
124
+    out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
125
+    if (it.opts.messages !== false) {
126
+      out += ' , message: \'should be ' + ($opStr) + ' ';
127
+      if ($isData) {
128
+        out += '\' + ' + ($schemaValue);
129
+      } else {
130
+        out += '' + ($schemaValue) + '\'';
131
+      }
132
+    }
133
+    if (it.opts.verbose) {
134
+      out += ' , schema:  ';
135
+      if ($isData) {
136
+        out += 'validate.schema' + ($schemaPath);
137
+      } else {
138
+        out += '' + ($schema);
139
+      }
140
+      out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
141
+    }
142
+    out += ' } ';
143
+  } else {
144
+    out += ' {} ';
145
+  }
146
+  var __err = out;
147
+  out = $$outStack.pop();
148
+  if (!it.compositeRule && $breakOnError) {
149
+    /* istanbul ignore if */
150
+    if (it.async) {
151
+      out += ' throw new ValidationError([' + (__err) + ']); ';
152
+    } else {
153
+      out += ' validate.errors = [' + (__err) + ']; return false; ';
154
+    }
155
+  } else {
156
+    out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
157
+  }
158
+  out += ' } ';
159
+  if ($breakOnError) {
160
+    out += ' else { ';
161
+  }
162
+  return out;
163
+}

+ 80
- 0
node_modules/ajv/lib/dotjs/_limitItems.js View File

@@ -0,0 +1,80 @@
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
+  if (!($isData || typeof $schema == 'number')) {
21
+    throw new Error($keyword + ' must be number');
22
+  }
23
+  var $op = $keyword == 'maxItems' ? '>' : '<';
24
+  out += 'if ( ';
25
+  if ($isData) {
26
+    out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
27
+  }
28
+  out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';
29
+  var $errorKeyword = $keyword;
30
+  var $$outStack = $$outStack || [];
31
+  $$outStack.push(out);
32
+  out = ''; /* istanbul ignore else */
33
+  if (it.createErrors !== false) {
34
+    out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
35
+    if (it.opts.messages !== false) {
36
+      out += ' , message: \'should NOT have ';
37
+      if ($keyword == 'maxItems') {
38
+        out += 'more';
39
+      } else {
40
+        out += 'fewer';
41
+      }
42
+      out += ' than ';
43
+      if ($isData) {
44
+        out += '\' + ' + ($schemaValue) + ' + \'';
45
+      } else {
46
+        out += '' + ($schema);
47
+      }
48
+      out += ' items\' ';
49
+    }
50
+    if (it.opts.verbose) {
51
+      out += ' , schema:  ';
52
+      if ($isData) {
53
+        out += 'validate.schema' + ($schemaPath);
54
+      } else {
55
+        out += '' + ($schema);
56
+      }
57
+      out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
58
+    }
59
+    out += ' } ';
60
+  } else {
61
+    out += ' {} ';
62
+  }
63
+  var __err = out;
64
+  out = $$outStack.pop();
65
+  if (!it.compositeRule && $breakOnError) {
66
+    /* istanbul ignore if */
67
+    if (it.async) {
68
+      out += ' throw new ValidationError([' + (__err) + ']); ';
69
+    } else {
70
+      out += ' validate.errors = [' + (__err) + ']; return false; ';
71
+    }
72
+  } else {
73
+    out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
74
+  }
75
+  out += '} ';
76
+  if ($breakOnError) {
77
+    out += ' else { ';
78
+  }
79
+  return out;
80
+}

+ 85
- 0
node_modules/ajv/lib/dotjs/_limitLength.js View File

@@ -0,0 +1,85 @@
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
+  if (!($isData || typeof $schema == 'number')) {
21
+    throw new Error($keyword + ' must be number');
22
+  }
23
+  var $op = $keyword == 'maxLength' ? '>' : '<';
24
+  out += 'if ( ';
25
+  if ($isData) {
26
+    out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
27
+  }
28
+  if (it.opts.unicode === false) {
29
+    out += ' ' + ($data) + '.length ';
30
+  } else {
31
+    out += ' ucs2length(' + ($data) + ') ';
32
+  }
33
+  out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
34
+  var $errorKeyword = $keyword;
35
+  var $$outStack = $$outStack || [];
36
+  $$outStack.push(out);
37
+  out = ''; /* istanbul ignore else */
38
+  if (it.createErrors !== false) {
39
+    out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
40
+    if (it.opts.messages !== false) {
41
+      out += ' , message: \'should NOT be ';
42
+      if ($keyword == 'maxLength') {
43
+        out += 'longer';
44
+      } else {
45
+        out += 'shorter';
46
+      }
47
+      out += ' than ';
48
+      if ($isData) {
49
+        out += '\' + ' + ($schemaValue) + ' + \'';
50
+      } else {
51
+        out += '' + ($schema);
52
+      }
53
+      out += ' characters\' ';
54
+    }
55
+    if (it.opts.verbose) {
56
+      out += ' , schema:  ';
57
+      if ($isData) {
58
+        out += 'validate.schema' + ($schemaPath);
59
+      } else {
60
+        out += '' + ($schema);
61
+      }
62
+      out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
63
+    }
64
+    out += ' } ';
65
+  } else {
66
+    out += ' {} ';
67
+  }
68
+  var __err = out;
69
+  out = $$outStack.pop();
70
+  if (!it.compositeRule && $breakOnError) {
71
+    /* istanbul ignore if */
72
+    if (it.async) {
73
+      out += ' throw new ValidationError([' + (__err) + ']); ';
74
+    } else {
75
+      out += ' validate.errors = [' + (__err) + ']; return false; ';
76
+    }
77
+  } else {
78
+    out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
79
+  }
80
+  out += '} ';
81
+  if ($breakOnError) {
82
+    out += ' else { ';
83
+  }
84
+  return out;
85
+}

+ 80
- 0
node_modules/ajv/lib/dotjs/_limitProperties.js View File

@@ -0,0 +1,80 @@
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
+  if (!($isData || typeof $schema == 'number')) {
21
+    throw new Error($keyword + ' must be number');
22
+  }
23
+  var $op = $keyword == 'maxProperties' ? '>' : '<';
24
+  out += 'if ( ';
25
+  if ($isData) {
26
+    out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
27
+  }
28
+  out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';
29
+  var $errorKeyword = $keyword;
30
+  var $$outStack = $$outStack || [];
31
+  $$outStack.push(out);
32
+  out = ''; /* istanbul ignore else */
33
+  if (it.createErrors !== false) {
34
+    out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
35
+    if (it.opts.messages !== false) {
36
+      out += ' , message: \'should NOT have ';
37
+      if ($keyword == 'maxProperties') {
38
+        out += 'more';
39
+      } else {
40
+        out += 'fewer';
41
+      }
42
+      out += ' than ';
43
+      if ($isData) {
44
+        out += '\' + ' + ($schemaValue) + ' + \'';
45
+      } else {
46
+        out += '' + ($schema);
47
+      }
48
+      out += ' properties\' ';
49
+    }
50
+    if (it.opts.verbose) {
51
+      out += ' , schema:  ';
52
+      if ($isData) {
53
+        out += 'validate.schema' + ($schemaPath);
54
+      } else {
55
+        out += '' + ($schema);
56
+      }
57
+      out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
58
+    }
59
+    out += ' } ';
60
+  } else {
61
+    out += ' {} ';
62
+  }
63
+  var __err = out;
64
+  out = $$outStack.pop();
65
+  if (!it.compositeRule && $breakOnError) {
66
+    /* istanbul ignore if */
67
+    if (it.async) {
68
+      out += ' throw new ValidationError([' + (__err) + ']); ';
69
+    } else {
70
+      out += ' validate.errors = [' + (__err) + ']; return false; ';
71
+    }
72
+  } else {
73
+    out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
74
+  }
75
+  out += '} ';
76
+  if ($breakOnError) {
77
+    out += ' else { ';
78
+  }
79
+  return out;
80
+}

+ 42
- 0
node_modules/ajv/lib/dotjs/allOf.js View File

@@ -0,0 +1,42 @@
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) || $sch === false : 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
+  return out;
42
+}

+ 73
- 0
node_modules/ajv/lib/dotjs/anyOf.js View File

@@ -0,0 +1,73 @@
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) || $sch === false : 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
+  } else {
68
+    if ($breakOnError) {
69
+      out += ' if (true) { ';
70
+    }
71
+  }
72
+  return out;
73
+}

+ 14
- 0
node_modules/ajv/lib/dotjs/comment.js View File

@@ -0,0 +1,14 @@
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
+}

+ 56
- 0
node_modules/ajv/lib/dotjs/const.js View File

@@ -0,0 +1,56 @@
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
+}

+ 81
- 0
node_modules/ajv/lib/dotjs/contains.js View File

@@ -0,0 +1,81 @@
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) || $schema === false : 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
+  return out;
81
+}

+ 228
- 0
node_modules/ajv/lib/dotjs/custom.js View File

@@ -0,0 +1,228 @@
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
+}

+ 168
- 0
node_modules/ajv/lib/dotjs/dependencies.js View File

@@ -0,0 +1,168 @@
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
+    if ($property == '__proto__') continue;
21
+    var $sch = $schema[$property];
22
+    var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
23
+    $deps[$property] = $sch;
24
+  }
25
+  out += 'var ' + ($errs) + ' = errors;';
26
+  var $currentErrorPath = it.errorPath;
27
+  out += 'var missing' + ($lvl) + ';';
28
+  for (var $property in $propertyDeps) {
29
+    $deps = $propertyDeps[$property];
30
+    if ($deps.length) {
31
+      out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
32
+      if ($ownProperties) {
33
+        out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
34
+      }
35
+      if ($breakOnError) {
36
+        out += ' && ( ';
37
+        var arr1 = $deps;
38
+        if (arr1) {
39
+          var $propertyKey, $i = -1,
40
+            l1 = arr1.length - 1;
41
+          while ($i < l1) {
42
+            $propertyKey = arr1[$i += 1];
43
+            if ($i) {
44
+              out += ' || ';
45
+            }
46
+            var $prop = it.util.getProperty($propertyKey),
47
+              $useData = $data + $prop;
48
+            out += ' ( ( ' + ($useData) + ' === undefined ';
49
+            if ($ownProperties) {
50
+              out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
51
+            }
52
+            out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
53
+          }
54
+        }
55
+        out += ')) {  ';
56
+        var $propertyPath = 'missing' + $lvl,
57
+          $missingProperty = '\' + ' + $propertyPath + ' + \'';
58
+        if (it.opts._errorDataPathProperty) {
59
+          it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
60
+        }
61
+        var $$outStack = $$outStack || [];
62
+        $$outStack.push(out);
63
+        out = ''; /* istanbul ignore else */
64
+        if (it.createErrors !== false) {
65
+          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(", "))) + '\' } ';
66
+          if (it.opts.messages !== false) {
67
+            out += ' , message: \'should have ';
68
+            if ($deps.length == 1) {
69
+              out += 'property ' + (it.util.escapeQuotes($deps[0]));
70
+            } else {
71
+              out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
72
+            }
73
+            out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
74
+          }
75
+          if (it.opts.verbose) {
76
+            out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
77
+          }
78
+          out += ' } ';
79
+        } else {
80
+          out += ' {} ';
81
+        }
82
+        var __err = out;
83
+        out = $$outStack.pop();
84
+        if (!it.compositeRule && $breakOnError) {
85
+          /* istanbul ignore if */
86
+          if (it.async) {
87
+            out += ' throw new ValidationError([' + (__err) + ']); ';
88
+          } else {
89
+            out += ' validate.errors = [' + (__err) + ']; return false; ';
90
+          }
91
+        } else {
92
+          out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
93
+        }
94
+      } else {
95
+        out += ' ) { ';
96
+        var arr2 = $deps;
97
+        if (arr2) {
98
+          var $propertyKey, i2 = -1,
99
+            l2 = arr2.length - 1;
100
+          while (i2 < l2) {
101
+            $propertyKey = arr2[i2 += 1];
102
+            var $prop = it.util.getProperty($propertyKey),
103
+              $missingProperty = it.util.escapeQuotes($propertyKey),
104
+              $useData = $data + $prop;
105
+            if (it.opts._errorDataPathProperty) {
106
+              it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
107
+            }
108
+            out += ' if ( ' + ($useData) + ' === undefined ';
109
+            if ($ownProperties) {
110
+              out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
111
+            }
112
+            out += ') {  var err =   '; /* istanbul ignore else */
113
+            if (it.createErrors !== false) {
114
+              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(", "))) + '\' } ';
115
+              if (it.opts.messages !== false) {
116
+                out += ' , message: \'should have ';
117
+                if ($deps.length == 1) {
118
+                  out += 'property ' + (it.util.escapeQuotes($deps[0]));
119
+                } else {
120
+                  out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
121
+                }
122
+                out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
123
+              }
124
+              if (it.opts.verbose) {
125
+                out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
126
+              }
127
+              out += ' } ';
128
+            } else {
129
+              out += ' {} ';
130
+            }
131
+            out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
132
+          }
133
+        }
134
+      }
135
+      out += ' }   ';
136
+      if ($breakOnError) {
137
+        $closingBraces += '}';
138
+        out += ' else { ';
139
+      }
140
+    }
141
+  }
142
+  it.errorPath = $currentErrorPath;
143
+  var $currentBaseId = $it.baseId;
144
+  for (var $property in $schemaDeps) {
145
+    var $sch = $schemaDeps[$property];
146
+    if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
147
+      out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
148
+      if ($ownProperties) {
149
+        out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
150
+      }
151
+      out += ') { ';
152
+      $it.schema = $sch;
153
+      $it.schemaPath = $schemaPath + it.util.getProperty($property);
154
+      $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
155
+      out += '  ' + (it.validate($it)) + ' ';
156
+      $it.baseId = $currentBaseId;
157
+      out += ' }  ';
158
+      if ($breakOnError) {
159
+        out += ' if (' + ($nextValid) + ') { ';
160
+        $closingBraces += '}';
161
+      }
162
+    }
163
+  }
164
+  if ($breakOnError) {
165
+    out += '   ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
166
+  }
167
+  return out;
168
+}

+ 66
- 0
node_modules/ajv/lib/dotjs/enum.js View File

@@ -0,0 +1,66 @@
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
+}

+ 150
- 0
node_modules/ajv/lib/dotjs/format.js View File

@@ -0,0 +1,150 @@
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
+}

+ 103
- 0
node_modules/ajv/lib/dotjs/if.js View File

@@ -0,0 +1,103 @@
1
+'use strict';
2
+module.exports = function generate_if(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
+  $it.level++;
15
+  var $nextValid = 'valid' + $it.level;
16
+  var $thenSch = it.schema['then'],
17
+    $elseSch = it.schema['else'],
18
+    $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
19
+    $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
20
+    $currentBaseId = $it.baseId;
21
+  if ($thenPresent || $elsePresent) {
22
+    var $ifClause;
23
+    $it.createErrors = false;
24
+    $it.schema = $schema;
25
+    $it.schemaPath = $schemaPath;
26
+    $it.errSchemaPath = $errSchemaPath;
27
+    out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true;  ';
28
+    var $wasComposite = it.compositeRule;
29
+    it.compositeRule = $it.compositeRule = true;
30
+    out += '  ' + (it.validate($it)) + ' ';
31
+    $it.baseId = $currentBaseId;
32
+    $it.createErrors = true;
33
+    out += '  errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }  ';
34
+    it.compositeRule = $it.compositeRule = $wasComposite;
35
+    if ($thenPresent) {
36
+      out += ' if (' + ($nextValid) + ') {  ';
37
+      $it.schema = it.schema['then'];
38
+      $it.schemaPath = it.schemaPath + '.then';
39
+      $it.errSchemaPath = it.errSchemaPath + '/then';
40
+      out += '  ' + (it.validate($it)) + ' ';
41
+      $it.baseId = $currentBaseId;
42
+      out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
43
+      if ($thenPresent && $elsePresent) {
44
+        $ifClause = 'ifClause' + $lvl;
45
+        out += ' var ' + ($ifClause) + ' = \'then\'; ';
46
+      } else {
47
+        $ifClause = '\'then\'';
48
+      }
49
+      out += ' } ';
50
+      if ($elsePresent) {
51
+        out += ' else { ';
52
+      }
53
+    } else {
54
+      out += ' if (!' + ($nextValid) + ') { ';
55
+    }
56
+    if ($elsePresent) {
57
+      $it.schema = it.schema['else'];
58
+      $it.schemaPath = it.schemaPath + '.else';
59
+      $it.errSchemaPath = it.errSchemaPath + '/else';
60
+      out += '  ' + (it.validate($it)) + ' ';
61
+      $it.baseId = $currentBaseId;
62
+      out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
63
+      if ($thenPresent && $elsePresent) {
64
+        $ifClause = 'ifClause' + $lvl;
65
+        out += ' var ' + ($ifClause) + ' = \'else\'; ';
66
+      } else {
67
+        $ifClause = '\'else\'';
68
+      }
69
+      out += ' } ';
70
+    }
71
+    out += ' if (!' + ($valid) + ') {   var err =   '; /* istanbul ignore else */
72
+    if (it.createErrors !== false) {
73
+      out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';
74
+      if (it.opts.messages !== false) {
75
+        out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' ';
76
+      }
77
+      if (it.opts.verbose) {
78
+        out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
79
+      }
80
+      out += ' } ';
81
+    } else {
82
+      out += ' {} ';
83
+    }
84
+    out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
85
+    if (!it.compositeRule && $breakOnError) {
86
+      /* istanbul ignore if */
87
+      if (it.async) {
88
+        out += ' throw new ValidationError(vErrors); ';
89
+      } else {
90
+        out += ' validate.errors = vErrors; return false; ';
91
+      }
92
+    }
93
+    out += ' }   ';
94
+    if ($breakOnError) {
95
+      out += ' else { ';
96
+    }
97
+  } else {
98
+    if ($breakOnError) {
99
+      out += ' if (true) { ';
100
+    }
101
+  }
102
+  return out;
103
+}

+ 33
- 0
node_modules/ajv/lib/dotjs/index.js View File

@@ -0,0 +1,33 @@
1
+'use strict';
2
+
3
+//all requires must be explicit because browserify won't work with dynamic requires
4
+module.exports = {
5
+  '$ref': require('./ref'),
6
+  allOf: require('./allOf'),
7
+  anyOf: require('./anyOf'),
8
+  '$comment': require('./comment'),
9
+  const: require('./const'),
10
+  contains: require('./contains'),
11
+  dependencies: require('./dependencies'),
12
+  'enum': require('./enum'),
13
+  format: require('./format'),
14
+  'if': require('./if'),
15
+  items: require('./items'),
16
+  maximum: require('./_limit'),
17
+  minimum: require('./_limit'),
18
+  maxItems: require('./_limitItems'),
19
+  minItems: require('./_limitItems'),
20
+  maxLength: require('./_limitLength'),
21
+  minLength: require('./_limitLength'),
22
+  maxProperties: require('./_limitProperties'),
23
+  minProperties: require('./_limitProperties'),
24
+  multipleOf: require('./multipleOf'),
25
+  not: require('./not'),
26
+  oneOf: require('./oneOf'),
27
+  pattern: require('./pattern'),
28
+  properties: require('./properties'),
29
+  propertyNames: require('./propertyNames'),
30
+  required: require('./required'),
31
+  uniqueItems: require('./uniqueItems'),
32
+  validate: require('./validate')
33
+};

+ 140
- 0
node_modules/ajv/lib/dotjs/items.js View File

@@ -0,0 +1,140 @@
1
+'use strict';
2
+module.exports = function generate_items(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
+  out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
22
+  if (Array.isArray($schema)) {
23
+    var $additionalItems = it.schema.additionalItems;
24
+    if ($additionalItems === false) {
25
+      out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';
26
+      var $currErrSchemaPath = $errSchemaPath;
27
+      $errSchemaPath = it.errSchemaPath + '/additionalItems';
28
+      out += '  if (!' + ($valid) + ') {   ';
29
+      var $$outStack = $$outStack || [];
30
+      $$outStack.push(out);
31
+      out = ''; /* istanbul ignore else */
32
+      if (it.createErrors !== false) {
33
+        out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';
34
+        if (it.opts.messages !== false) {
35
+          out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' ';
36
+        }
37
+        if (it.opts.verbose) {
38
+          out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
39
+        }
40
+        out += ' } ';
41
+      } else {
42
+        out += ' {} ';
43
+      }
44
+      var __err = out;
45
+      out = $$outStack.pop();
46
+      if (!it.compositeRule && $breakOnError) {
47
+        /* istanbul ignore if */
48
+        if (it.async) {
49
+          out += ' throw new ValidationError([' + (__err) + ']); ';
50
+        } else {
51
+          out += ' validate.errors = [' + (__err) + ']; return false; ';
52
+        }
53
+      } else {
54
+        out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
55
+      }
56
+      out += ' } ';
57
+      $errSchemaPath = $currErrSchemaPath;
58
+      if ($breakOnError) {
59
+        $closingBraces += '}';
60
+        out += ' else { ';
61
+      }
62
+    }
63
+    var arr1 = $schema;
64
+    if (arr1) {
65
+      var $sch, $i = -1,
66
+        l1 = arr1.length - 1;
67
+      while ($i < l1) {
68
+        $sch = arr1[$i += 1];
69
+        if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
70
+          out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
71
+          var $passData = $data + '[' + $i + ']';
72
+          $it.schema = $sch;
73
+          $it.schemaPath = $schemaPath + '[' + $i + ']';
74
+          $it.errSchemaPath = $errSchemaPath + '/' + $i;
75
+          $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
76
+          $it.dataPathArr[$dataNxt] = $i;
77
+          var $code = it.validate($it);
78
+          $it.baseId = $currentBaseId;
79
+          if (it.util.varOccurences($code, $nextData) < 2) {
80
+            out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
81
+          } else {
82
+            out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
83
+          }
84
+          out += ' }  ';
85
+          if ($breakOnError) {
86
+            out += ' if (' + ($nextValid) + ') { ';
87
+            $closingBraces += '}';
88
+          }
89
+        }
90
+      }
91
+    }
92
+    if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
93
+      $it.schema = $additionalItems;
94
+      $it.schemaPath = it.schemaPath + '.additionalItems';
95
+      $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
96
+      out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') {  for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
97
+      $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
98
+      var $passData = $data + '[' + $idx + ']';
99
+      $it.dataPathArr[$dataNxt] = $idx;
100
+      var $code = it.validate($it);
101
+      $it.baseId = $currentBaseId;
102
+      if (it.util.varOccurences($code, $nextData) < 2) {
103
+        out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
104
+      } else {
105
+        out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
106
+      }
107
+      if ($breakOnError) {
108
+        out += ' if (!' + ($nextValid) + ') break; ';
109
+      }
110
+      out += ' } }  ';
111
+      if ($breakOnError) {
112
+        out += ' if (' + ($nextValid) + ') { ';
113
+        $closingBraces += '}';
114
+      }
115
+    }
116
+  } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
117
+    $it.schema = $schema;
118
+    $it.schemaPath = $schemaPath;
119
+    $it.errSchemaPath = $errSchemaPath;
120
+    out += '  for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
121
+    $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
122
+    var $passData = $data + '[' + $idx + ']';
123
+    $it.dataPathArr[$dataNxt] = $idx;
124
+    var $code = it.validate($it);
125
+    $it.baseId = $currentBaseId;
126
+    if (it.util.varOccurences($code, $nextData) < 2) {
127
+      out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
128
+    } else {
129
+      out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
130
+    }
131
+    if ($breakOnError) {
132
+      out += ' if (!' + ($nextValid) + ') break; ';
133
+    }
134
+    out += ' }';
135
+  }
136
+  if ($breakOnError) {
137
+    out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
138
+  }
139
+  return out;
140
+}

+ 80
- 0
node_modules/ajv/lib/dotjs/multipleOf.js View File

@@ -0,0 +1,80 @@
1
+'use strict';
2
+module.exports = function generate_multipleOf(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 $isData = it.opts.$data && $schema && $schema.$data,
12
+    $schemaValue;
13
+  if ($isData) {
14
+    out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
15
+    $schemaValue = 'schema' + $lvl;
16
+  } else {
17
+    $schemaValue = $schema;
18
+  }
19
+  if (!($isData || typeof $schema == 'number')) {
20
+    throw new Error($keyword + ' must be number');
21
+  }
22
+  out += 'var division' + ($lvl) + ';if (';
23
+  if ($isData) {
24
+    out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
25
+  }
26
+  out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
27
+  if (it.opts.multipleOfPrecision) {
28
+    out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
29
+  } else {
30
+    out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
31
+  }
32
+  out += ' ) ';
33
+  if ($isData) {
34
+    out += '  )  ';
35
+  }
36
+  out += ' ) {   ';
37
+  var $$outStack = $$outStack || [];
38
+  $$outStack.push(out);
39
+  out = ''; /* istanbul ignore else */
40
+  if (it.createErrors !== false) {
41
+    out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
42
+    if (it.opts.messages !== false) {
43
+      out += ' , message: \'should be multiple of ';
44
+      if ($isData) {
45
+        out += '\' + ' + ($schemaValue);
46
+      } else {
47
+        out += '' + ($schemaValue) + '\'';
48
+      }
49
+    }
50
+    if (it.opts.verbose) {
51
+      out += ' , schema:  ';
52
+      if ($isData) {
53
+        out += 'validate.schema' + ($schemaPath);
54
+      } else {
55
+        out += '' + ($schema);
56
+      }
57
+      out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
58
+    }
59
+    out += ' } ';
60
+  } else {
61
+    out += ' {} ';
62
+  }
63
+  var __err = out;
64
+  out = $$outStack.pop();
65
+  if (!it.compositeRule && $breakOnError) {
66
+    /* istanbul ignore if */
67
+    if (it.async) {
68
+      out += ' throw new ValidationError([' + (__err) + ']); ';
69
+    } else {
70
+      out += ' validate.errors = [' + (__err) + ']; return false; ';
71
+    }
72
+  } else {
73
+    out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
74
+  }
75
+  out += '} ';
76
+  if ($breakOnError) {
77
+    out += ' else { ';
78
+  }
79
+  return out;
80
+}

+ 84
- 0
node_modules/ajv/lib/dotjs/not.js View File

@@ -0,0 +1,84 @@
1
+'use strict';
2
+module.exports = function generate_not(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
+  $it.level++;
14
+  var $nextValid = 'valid' + $it.level;
15
+  if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
16
+    $it.schema = $schema;
17
+    $it.schemaPath = $schemaPath;
18
+    $it.errSchemaPath = $errSchemaPath;
19
+    out += ' var ' + ($errs) + ' = errors;  ';
20
+    var $wasComposite = it.compositeRule;
21
+    it.compositeRule = $it.compositeRule = true;
22
+    $it.createErrors = false;
23
+    var $allErrorsOption;
24
+    if ($it.opts.allErrors) {
25
+      $allErrorsOption = $it.opts.allErrors;
26
+      $it.opts.allErrors = false;
27
+    }
28
+    out += ' ' + (it.validate($it)) + ' ';
29
+    $it.createErrors = true;
30
+    if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
31
+    it.compositeRule = $it.compositeRule = $wasComposite;
32
+    out += ' if (' + ($nextValid) + ') {   ';
33
+    var $$outStack = $$outStack || [];
34
+    $$outStack.push(out);
35
+    out = ''; /* istanbul ignore else */
36
+    if (it.createErrors !== false) {
37
+      out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
38
+      if (it.opts.messages !== false) {
39
+        out += ' , message: \'should NOT be valid\' ';
40
+      }
41
+      if (it.opts.verbose) {
42
+        out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
43
+      }
44
+      out += ' } ';
45
+    } else {
46
+      out += ' {} ';
47
+    }
48
+    var __err = out;
49
+    out = $$outStack.pop();
50
+    if (!it.compositeRule && $breakOnError) {
51
+      /* istanbul ignore if */
52
+      if (it.async) {
53
+        out += ' throw new ValidationError([' + (__err) + ']); ';
54
+      } else {
55
+        out += ' validate.errors = [' + (__err) + ']; return false; ';
56
+      }
57
+    } else {
58
+      out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
59
+    }
60
+    out += ' } else {  errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
61
+    if (it.opts.allErrors) {
62
+      out += ' } ';
63
+    }
64
+  } else {
65
+    out += '  var err =   '; /* istanbul ignore else */
66
+    if (it.createErrors !== false) {
67
+      out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
68
+      if (it.opts.messages !== false) {
69
+        out += ' , message: \'should NOT be valid\' ';
70
+      }
71
+      if (it.opts.verbose) {
72
+        out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
73
+      }
74
+      out += ' } ';
75
+    } else {
76
+      out += ' {} ';
77
+    }
78
+    out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
79
+    if ($breakOnError) {
80
+      out += ' if (false) { ';
81
+    }
82
+  }
83
+  return out;
84
+}

+ 73
- 0
node_modules/ajv/lib/dotjs/oneOf.js View File

@@ -0,0 +1,73 @@
1
+'use strict';
2
+module.exports = function generate_oneOf(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 $currentBaseId = $it.baseId,
18
+    $prevValid = 'prevValid' + $lvl,
19
+    $passingSchemas = 'passingSchemas' + $lvl;
20
+  out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';
21
+  var $wasComposite = it.compositeRule;
22
+  it.compositeRule = $it.compositeRule = true;
23
+  var arr1 = $schema;
24
+  if (arr1) {
25
+    var $sch, $i = -1,
26
+      l1 = arr1.length - 1;
27
+    while ($i < l1) {
28
+      $sch = arr1[$i += 1];
29
+      if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
30
+        $it.schema = $sch;
31
+        $it.schemaPath = $schemaPath + '[' + $i + ']';
32
+        $it.errSchemaPath = $errSchemaPath + '/' + $i;
33
+        out += '  ' + (it.validate($it)) + ' ';
34
+        $it.baseId = $currentBaseId;
35
+      } else {
36
+        out += ' var ' + ($nextValid) + ' = true; ';
37
+      }
38
+      if ($i) {
39
+        out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';
40
+        $closingBraces += '}';
41
+      }
42
+      out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';
43
+    }
44
+  }
45
+  it.compositeRule = $it.compositeRule = $wasComposite;
46
+  out += '' + ($closingBraces) + 'if (!' + ($valid) + ') {   var err =   '; /* istanbul ignore else */
47
+  if (it.createErrors !== false) {
48
+    out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';
49
+    if (it.opts.messages !== false) {
50
+      out += ' , message: \'should match exactly one schema in oneOf\' ';
51
+    }
52
+    if (it.opts.verbose) {
53
+      out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
54
+    }
55
+    out += ' } ';
56
+  } else {
57
+    out += ' {} ';
58
+  }
59
+  out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
60
+  if (!it.compositeRule && $breakOnError) {
61
+    /* istanbul ignore if */
62
+    if (it.async) {
63
+      out += ' throw new ValidationError(vErrors); ';
64
+    } else {
65
+      out += ' validate.errors = vErrors; return false; ';
66
+    }
67
+  }
68
+  out += '} else {  errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';
69
+  if (it.opts.allErrors) {
70
+    out += ' } ';
71
+  }
72
+  return out;
73
+}

+ 75
- 0
node_modules/ajv/lib/dotjs/pattern.js View File

@@ -0,0 +1,75 @@
1
+'use strict';
2
+module.exports = function generate_pattern(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 $isData = it.opts.$data && $schema && $schema.$data,
12
+    $schemaValue;
13
+  if ($isData) {
14
+    out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
15
+    $schemaValue = 'schema' + $lvl;
16
+  } else {
17
+    $schemaValue = $schema;
18
+  }
19
+  var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
20
+  out += 'if ( ';
21
+  if ($isData) {
22
+    out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
23
+  }
24
+  out += ' !' + ($regexp) + '.test(' + ($data) + ') ) {   ';
25
+  var $$outStack = $$outStack || [];
26
+  $$outStack.push(out);
27
+  out = ''; /* istanbul ignore else */
28
+  if (it.createErrors !== false) {
29
+    out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern:  ';
30
+    if ($isData) {
31
+      out += '' + ($schemaValue);
32
+    } else {
33
+      out += '' + (it.util.toQuotedString($schema));
34
+    }
35
+    out += '  } ';
36
+    if (it.opts.messages !== false) {
37
+      out += ' , message: \'should match pattern "';
38
+      if ($isData) {
39
+        out += '\' + ' + ($schemaValue) + ' + \'';
40
+      } else {
41
+        out += '' + (it.util.escapeQuotes($schema));
42
+      }
43
+      out += '"\' ';
44
+    }
45
+    if (it.opts.verbose) {
46
+      out += ' , schema:  ';
47
+      if ($isData) {
48
+        out += 'validate.schema' + ($schemaPath);
49
+      } else {
50
+        out += '' + (it.util.toQuotedString($schema));
51
+      }
52
+      out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
53
+    }
54
+    out += ' } ';
55
+  } else {
56
+    out += ' {} ';
57
+  }
58
+  var __err = out;
59
+  out = $$outStack.pop();
60
+  if (!it.compositeRule && $breakOnError) {
61
+    /* istanbul ignore if */
62
+    if (it.async) {
63
+      out += ' throw new ValidationError([' + (__err) + ']); ';
64
+    } else {
65
+      out += ' validate.errors = [' + (__err) + ']; return false; ';
66
+    }
67
+  } else {
68
+    out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
69
+  }
70
+  out += '} ';
71
+  if ($breakOnError) {
72
+    out += ' else { ';
73
+  }
74
+  return out;
75
+}

+ 335
- 0
node_modules/ajv/lib/dotjs/properties.js View File

@@ -0,0 +1,335 @@
1
+'use strict';
2
+module.exports = function generate_properties(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 $key = 'key' + $lvl,
17
+    $idx = 'idx' + $lvl,
18
+    $dataNxt = $it.dataLevel = it.dataLevel + 1,
19
+    $nextData = 'data' + $dataNxt,
20
+    $dataProperties = 'dataProperties' + $lvl;
21
+  var $schemaKeys = Object.keys($schema || {}).filter(notProto),
22
+    $pProperties = it.schema.patternProperties || {},
23
+    $pPropertyKeys = Object.keys($pProperties).filter(notProto),
24
+    $aProperties = it.schema.additionalProperties,
25
+    $someProperties = $schemaKeys.length || $pPropertyKeys.length,
26
+    $noAdditional = $aProperties === false,
27
+    $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,
28
+    $removeAdditional = it.opts.removeAdditional,
29
+    $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,
30
+    $ownProperties = it.opts.ownProperties,
31
+    $currentBaseId = it.baseId;
32
+  var $required = it.schema.required;
33
+  if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
34
+    var $requiredHash = it.util.toHash($required);
35
+  }
36
+
37
+  function notProto(p) {
38
+    return p !== '__proto__';
39
+  }
40
+  out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
41
+  if ($ownProperties) {
42
+    out += ' var ' + ($dataProperties) + ' = undefined;';
43
+  }
44
+  if ($checkAdditional) {
45
+    if ($ownProperties) {
46
+      out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
47
+    } else {
48
+      out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
49
+    }
50
+    if ($someProperties) {
51
+      out += ' var isAdditional' + ($lvl) + ' = !(false ';
52
+      if ($schemaKeys.length) {
53
+        if ($schemaKeys.length > 8) {
54
+          out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';
55
+        } else {
56
+          var arr1 = $schemaKeys;
57
+          if (arr1) {
58
+            var $propertyKey, i1 = -1,
59
+              l1 = arr1.length - 1;
60
+            while (i1 < l1) {
61
+              $propertyKey = arr1[i1 += 1];
62
+              out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';
63
+            }
64
+          }
65
+        }
66
+      }
67
+      if ($pPropertyKeys.length) {
68
+        var arr2 = $pPropertyKeys;
69
+        if (arr2) {
70
+          var $pProperty, $i = -1,
71
+            l2 = arr2.length - 1;
72
+          while ($i < l2) {
73
+            $pProperty = arr2[$i += 1];
74
+            out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';
75
+          }
76
+        }
77
+      }
78
+      out += ' ); if (isAdditional' + ($lvl) + ') { ';
79
+    }
80
+    if ($removeAdditional == 'all') {
81
+      out += ' delete ' + ($data) + '[' + ($key) + ']; ';
82
+    } else {
83
+      var $currentErrorPath = it.errorPath;
84
+      var $additionalProperty = '\' + ' + $key + ' + \'';
85
+      if (it.opts._errorDataPathProperty) {
86
+        it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
87
+      }
88
+      if ($noAdditional) {
89
+        if ($removeAdditional) {
90
+          out += ' delete ' + ($data) + '[' + ($key) + ']; ';
91
+        } else {
92
+          out += ' ' + ($nextValid) + ' = false; ';
93
+          var $currErrSchemaPath = $errSchemaPath;
94
+          $errSchemaPath = it.errSchemaPath + '/additionalProperties';
95
+          var $$outStack = $$outStack || [];
96
+          $$outStack.push(out);
97
+          out = ''; /* istanbul ignore else */
98
+          if (it.createErrors !== false) {
99
+            out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';
100
+            if (it.opts.messages !== false) {
101
+              out += ' , message: \'';
102
+              if (it.opts._errorDataPathProperty) {
103
+                out += 'is an invalid additional property';
104
+              } else {
105
+                out += 'should NOT have additional properties';
106
+              }
107
+              out += '\' ';
108
+            }
109
+            if (it.opts.verbose) {
110
+              out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
111
+            }
112
+            out += ' } ';
113
+          } else {
114
+            out += ' {} ';
115
+          }
116
+          var __err = out;
117
+          out = $$outStack.pop();
118
+          if (!it.compositeRule && $breakOnError) {
119
+            /* istanbul ignore if */
120
+            if (it.async) {
121
+              out += ' throw new ValidationError([' + (__err) + ']); ';
122
+            } else {
123
+              out += ' validate.errors = [' + (__err) + ']; return false; ';
124
+            }
125
+          } else {
126
+            out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
127
+          }
128
+          $errSchemaPath = $currErrSchemaPath;
129
+          if ($breakOnError) {
130
+            out += ' break; ';
131
+          }
132
+        }
133
+      } else if ($additionalIsSchema) {
134
+        if ($removeAdditional == 'failing') {
135
+          out += ' var ' + ($errs) + ' = errors;  ';
136
+          var $wasComposite = it.compositeRule;
137
+          it.compositeRule = $it.compositeRule = true;
138
+          $it.schema = $aProperties;
139
+          $it.schemaPath = it.schemaPath + '.additionalProperties';
140
+          $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
141
+          $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
142
+          var $passData = $data + '[' + $key + ']';
143
+          $it.dataPathArr[$dataNxt] = $key;
144
+          var $code = it.validate($it);
145
+          $it.baseId = $currentBaseId;
146
+          if (it.util.varOccurences($code, $nextData) < 2) {
147
+            out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
148
+          } else {
149
+            out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
150
+          }
151
+          out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; }  ';
152
+          it.compositeRule = $it.compositeRule = $wasComposite;
153
+        } else {
154
+          $it.schema = $aProperties;
155
+          $it.schemaPath = it.schemaPath + '.additionalProperties';
156
+          $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
157
+          $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
158
+          var $passData = $data + '[' + $key + ']';
159
+          $it.dataPathArr[$dataNxt] = $key;
160
+          var $code = it.validate($it);
161
+          $it.baseId = $currentBaseId;
162
+          if (it.util.varOccurences($code, $nextData) < 2) {
163
+            out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
164
+          } else {
165
+            out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
166
+          }
167
+          if ($breakOnError) {
168
+            out += ' if (!' + ($nextValid) + ') break; ';
169
+          }
170
+        }
171
+      }
172
+      it.errorPath = $currentErrorPath;
173
+    }
174
+    if ($someProperties) {
175
+      out += ' } ';
176
+    }
177
+    out += ' }  ';
178
+    if ($breakOnError) {
179
+      out += ' if (' + ($nextValid) + ') { ';
180
+      $closingBraces += '}';
181
+    }
182
+  }
183
+  var $useDefaults = it.opts.useDefaults && !it.compositeRule;
184
+  if ($schemaKeys.length) {
185
+    var arr3 = $schemaKeys;
186
+    if (arr3) {
187
+      var $propertyKey, i3 = -1,
188
+        l3 = arr3.length - 1;
189
+      while (i3 < l3) {
190
+        $propertyKey = arr3[i3 += 1];
191
+        var $sch = $schema[$propertyKey];
192
+        if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
193
+          var $prop = it.util.getProperty($propertyKey),
194
+            $passData = $data + $prop,
195
+            $hasDefault = $useDefaults && $sch.default !== undefined;
196
+          $it.schema = $sch;
197
+          $it.schemaPath = $schemaPath + $prop;
198
+          $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
199
+          $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
200
+          $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
201
+          var $code = it.validate($it);
202
+          $it.baseId = $currentBaseId;
203
+          if (it.util.varOccurences($code, $nextData) < 2) {
204
+            $code = it.util.varReplace($code, $nextData, $passData);
205
+            var $useData = $passData;
206
+          } else {
207
+            var $useData = $nextData;
208
+            out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';
209
+          }
210
+          if ($hasDefault) {
211
+            out += ' ' + ($code) + ' ';
212
+          } else {
213
+            if ($requiredHash && $requiredHash[$propertyKey]) {
214
+              out += ' if ( ' + ($useData) + ' === undefined ';
215
+              if ($ownProperties) {
216
+                out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
217
+              }
218
+              out += ') { ' + ($nextValid) + ' = false; ';
219
+              var $currentErrorPath = it.errorPath,
220
+                $currErrSchemaPath = $errSchemaPath,
221
+                $missingProperty = it.util.escapeQuotes($propertyKey);
222
+              if (it.opts._errorDataPathProperty) {
223
+                it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
224
+              }
225
+              $errSchemaPath = it.errSchemaPath + '/required';
226
+              var $$outStack = $$outStack || [];
227
+              $$outStack.push(out);
228
+              out = ''; /* istanbul ignore else */
229
+              if (it.createErrors !== false) {
230
+                out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
231
+                if (it.opts.messages !== false) {
232
+                  out += ' , message: \'';
233
+                  if (it.opts._errorDataPathProperty) {
234
+                    out += 'is a required property';
235
+                  } else {
236
+                    out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
237
+                  }
238
+                  out += '\' ';
239
+                }
240
+                if (it.opts.verbose) {
241
+                  out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
242
+                }
243
+                out += ' } ';
244
+              } else {
245
+                out += ' {} ';
246
+              }
247
+              var __err = out;
248
+              out = $$outStack.pop();
249
+              if (!it.compositeRule && $breakOnError) {
250
+                /* istanbul ignore if */
251
+                if (it.async) {
252
+                  out += ' throw new ValidationError([' + (__err) + ']); ';
253
+                } else {
254
+                  out += ' validate.errors = [' + (__err) + ']; return false; ';
255
+                }
256
+              } else {
257
+                out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
258
+              }
259
+              $errSchemaPath = $currErrSchemaPath;
260
+              it.errorPath = $currentErrorPath;
261
+              out += ' } else { ';
262
+            } else {
263
+              if ($breakOnError) {
264
+                out += ' if ( ' + ($useData) + ' === undefined ';
265
+                if ($ownProperties) {
266
+                  out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
267
+                }
268
+                out += ') { ' + ($nextValid) + ' = true; } else { ';
269
+              } else {
270
+                out += ' if (' + ($useData) + ' !== undefined ';
271
+                if ($ownProperties) {
272
+                  out += ' &&   Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
273
+                }
274
+                out += ' ) { ';
275
+              }
276
+            }
277
+            out += ' ' + ($code) + ' } ';
278
+          }
279
+        }
280
+        if ($breakOnError) {
281
+          out += ' if (' + ($nextValid) + ') { ';
282
+          $closingBraces += '}';
283
+        }
284
+      }
285
+    }
286
+  }
287
+  if ($pPropertyKeys.length) {
288
+    var arr4 = $pPropertyKeys;
289
+    if (arr4) {
290
+      var $pProperty, i4 = -1,
291
+        l4 = arr4.length - 1;
292
+      while (i4 < l4) {
293
+        $pProperty = arr4[i4 += 1];
294
+        var $sch = $pProperties[$pProperty];
295
+        if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
296
+          $it.schema = $sch;
297
+          $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
298
+          $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
299
+          if ($ownProperties) {
300
+            out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
301
+          } else {
302
+            out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
303
+          }
304
+          out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';
305
+          $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
306
+          var $passData = $data + '[' + $key + ']';
307
+          $it.dataPathArr[$dataNxt] = $key;
308
+          var $code = it.validate($it);
309
+          $it.baseId = $currentBaseId;
310
+          if (it.util.varOccurences($code, $nextData) < 2) {
311
+            out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
312
+          } else {
313
+            out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
314
+          }
315
+          if ($breakOnError) {
316
+            out += ' if (!' + ($nextValid) + ') break; ';
317
+          }
318
+          out += ' } ';
319
+          if ($breakOnError) {
320
+            out += ' else ' + ($nextValid) + ' = true; ';
321
+          }
322
+          out += ' }  ';
323
+          if ($breakOnError) {
324
+            out += ' if (' + ($nextValid) + ') { ';
325
+            $closingBraces += '}';
326
+          }
327
+        }
328
+      }
329
+    }
330
+  }
331
+  if ($breakOnError) {
332
+    out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
333
+  }
334
+  return out;
335
+}

+ 81
- 0
node_modules/ajv/lib/dotjs/propertyNames.js View File

@@ -0,0 +1,81 @@
1
+'use strict';
2
+module.exports = function generate_propertyNames(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
+  out += 'var ' + ($errs) + ' = errors;';
17
+  if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
18
+    $it.schema = $schema;
19
+    $it.schemaPath = $schemaPath;
20
+    $it.errSchemaPath = $errSchemaPath;
21
+    var $key = 'key' + $lvl,
22
+      $idx = 'idx' + $lvl,
23
+      $i = 'i' + $lvl,
24
+      $invalidName = '\' + ' + $key + ' + \'',
25
+      $dataNxt = $it.dataLevel = it.dataLevel + 1,
26
+      $nextData = 'data' + $dataNxt,
27
+      $dataProperties = 'dataProperties' + $lvl,
28
+      $ownProperties = it.opts.ownProperties,
29
+      $currentBaseId = it.baseId;
30
+    if ($ownProperties) {
31
+      out += ' var ' + ($dataProperties) + ' = undefined; ';
32
+    }
33
+    if ($ownProperties) {
34
+      out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
35
+    } else {
36
+      out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
37
+    }
38
+    out += ' var startErrs' + ($lvl) + ' = errors; ';
39
+    var $passData = $key;
40
+    var $wasComposite = it.compositeRule;
41
+    it.compositeRule = $it.compositeRule = true;
42
+    var $code = it.validate($it);
43
+    $it.baseId = $currentBaseId;
44
+    if (it.util.varOccurences($code, $nextData) < 2) {
45
+      out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
46
+    } else {
47
+      out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
48
+    }
49
+    it.compositeRule = $it.compositeRule = $wasComposite;
50
+    out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + '<errors; ' + ($i) + '++) { vErrors[' + ($i) + '].propertyName = ' + ($key) + '; }   var err =   '; /* istanbul ignore else */
51
+    if (it.createErrors !== false) {
52
+      out += ' { keyword: \'' + ('propertyNames') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { propertyName: \'' + ($invalidName) + '\' } ';
53
+      if (it.opts.messages !== false) {
54
+        out += ' , message: \'property name \\\'' + ($invalidName) + '\\\' is invalid\' ';
55
+      }
56
+      if (it.opts.verbose) {
57
+        out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
58
+      }
59
+      out += ' } ';
60
+    } else {
61
+      out += ' {} ';
62
+    }
63
+    out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
64
+    if (!it.compositeRule && $breakOnError) {
65
+      /* istanbul ignore if */
66
+      if (it.async) {
67
+        out += ' throw new ValidationError(vErrors); ';
68
+      } else {
69
+        out += ' validate.errors = vErrors; return false; ';
70
+      }
71
+    }
72
+    if ($breakOnError) {
73
+      out += ' break; ';
74
+    }
75
+    out += ' } }';
76
+  }
77
+  if ($breakOnError) {
78
+    out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
79
+  }
80
+  return out;
81
+}

+ 124
- 0
node_modules/ajv/lib/dotjs/ref.js View File

@@ -0,0 +1,124 @@
1
+'use strict';
2
+module.exports = function generate_ref(it, $keyword, $ruleType) {
3
+  var out = ' ';
4
+  var $lvl = it.level;
5
+  var $dataLvl = it.dataLevel;
6
+  var $schema = it.schema[$keyword];
7
+  var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
8
+  var $breakOnError = !it.opts.allErrors;
9
+  var $data = 'data' + ($dataLvl || '');
10
+  var $valid = 'valid' + $lvl;
11
+  var $async, $refCode;
12
+  if ($schema == '#' || $schema == '#/') {
13
+    if (it.isRoot) {
14
+      $async = it.async;
15
+      $refCode = 'validate';
16
+    } else {
17
+      $async = it.root.schema.$async === true;
18
+      $refCode = 'root.refVal[0]';
19
+    }
20
+  } else {
21
+    var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);
22
+    if ($refVal === undefined) {
23
+      var $message = it.MissingRefError.message(it.baseId, $schema);
24
+      if (it.opts.missingRefs == 'fail') {
25
+        it.logger.error($message);
26
+        var $$outStack = $$outStack || [];
27
+        $$outStack.push(out);
28
+        out = ''; /* istanbul ignore else */
29
+        if (it.createErrors !== false) {
30
+          out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } ';
31
+          if (it.opts.messages !== false) {
32
+            out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
33
+          }
34
+          if (it.opts.verbose) {
35
+            out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
36
+          }
37
+          out += ' } ';
38
+        } else {
39
+          out += ' {} ';
40
+        }
41
+        var __err = out;
42
+        out = $$outStack.pop();
43
+        if (!it.compositeRule && $breakOnError) {
44
+          /* istanbul ignore if */
45
+          if (it.async) {
46
+            out += ' throw new ValidationError([' + (__err) + ']); ';
47
+          } else {
48
+            out += ' validate.errors = [' + (__err) + ']; return false; ';
49
+          }
50
+        } else {
51
+          out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
52
+        }
53
+        if ($breakOnError) {
54
+          out += ' if (false) { ';
55
+        }
56
+      } else if (it.opts.missingRefs == 'ignore') {
57
+        it.logger.warn($message);
58
+        if ($breakOnError) {
59
+          out += ' if (true) { ';
60
+        }
61
+      } else {
62
+        throw new it.MissingRefError(it.baseId, $schema, $message);
63
+      }
64
+    } else if ($refVal.inline) {
65
+      var $it = it.util.copy(it);
66
+      $it.level++;
67
+      var $nextValid = 'valid' + $it.level;
68
+      $it.schema = $refVal.schema;
69
+      $it.schemaPath = '';
70
+      $it.errSchemaPath = $schema;
71
+      var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);
72
+      out += ' ' + ($code) + ' ';
73
+      if ($breakOnError) {
74
+        out += ' if (' + ($nextValid) + ') { ';
75
+      }
76
+    } else {
77
+      $async = $refVal.$async === true || (it.async && $refVal.$async !== false);
78
+      $refCode = $refVal.code;
79
+    }
80
+  }
81
+  if ($refCode) {
82
+    var $$outStack = $$outStack || [];
83
+    $$outStack.push(out);
84
+    out = '';
85
+    if (it.opts.passContext) {
86
+      out += ' ' + ($refCode) + '.call(this, ';
87
+    } else {
88
+      out += ' ' + ($refCode) + '( ';
89
+    }
90
+    out += ' ' + ($data) + ', (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 __callValidate = out;
98
+    out = $$outStack.pop();
99
+    if ($async) {
100
+      if (!it.async) throw new Error('async schema referenced by sync schema');
101
+      if ($breakOnError) {
102
+        out += ' var ' + ($valid) + '; ';
103
+      }
104
+      out += ' try { await ' + (__callValidate) + '; ';
105
+      if ($breakOnError) {
106
+        out += ' ' + ($valid) + ' = true; ';
107
+      }
108
+      out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ';
109
+      if ($breakOnError) {
110
+        out += ' ' + ($valid) + ' = false; ';
111
+      }
112
+      out += ' } ';
113
+      if ($breakOnError) {
114
+        out += ' if (' + ($valid) + ') { ';
115
+      }
116
+    } else {
117
+      out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';
118
+      if ($breakOnError) {
119
+        out += ' else { ';
120
+      }
121
+    }
122
+  }
123
+  return out;
124
+}

+ 270
- 0
node_modules/ajv/lib/dotjs/required.js View File

@@ -0,0 +1,270 @@
1
+'use strict';
2
+module.exports = function generate_required(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 $vSchema = 'schema' + $lvl;
21
+  if (!$isData) {
22
+    if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
23
+      var $required = [];
24
+      var arr1 = $schema;
25
+      if (arr1) {
26
+        var $property, i1 = -1,
27
+          l1 = arr1.length - 1;
28
+        while (i1 < l1) {
29
+          $property = arr1[i1 += 1];
30
+          var $propertySch = it.schema.properties[$property];
31
+          if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
32
+            $required[$required.length] = $property;
33
+          }
34
+        }
35
+      }
36
+    } else {
37
+      var $required = $schema;
38
+    }
39
+  }
40
+  if ($isData || $required.length) {
41
+    var $currentErrorPath = it.errorPath,
42
+      $loopRequired = $isData || $required.length >= it.opts.loopRequired,
43
+      $ownProperties = it.opts.ownProperties;
44
+    if ($breakOnError) {
45
+      out += ' var missing' + ($lvl) + '; ';
46
+      if ($loopRequired) {
47
+        if (!$isData) {
48
+          out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
49
+        }
50
+        var $i = 'i' + $lvl,
51
+          $propertyPath = 'schema' + $lvl + '[' + $i + ']',
52
+          $missingProperty = '\' + ' + $propertyPath + ' + \'';
53
+        if (it.opts._errorDataPathProperty) {
54
+          it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
55
+        }
56
+        out += ' var ' + ($valid) + ' = true; ';
57
+        if ($isData) {
58
+          out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
59
+        }
60
+        out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';
61
+        if ($ownProperties) {
62
+          out += ' &&   Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
63
+        }
64
+        out += '; if (!' + ($valid) + ') break; } ';
65
+        if ($isData) {
66
+          out += '  }  ';
67
+        }
68
+        out += '  if (!' + ($valid) + ') {   ';
69
+        var $$outStack = $$outStack || [];
70
+        $$outStack.push(out);
71
+        out = ''; /* istanbul ignore else */
72
+        if (it.createErrors !== false) {
73
+          out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
74
+          if (it.opts.messages !== false) {
75
+            out += ' , message: \'';
76
+            if (it.opts._errorDataPathProperty) {
77
+              out += 'is a required property';
78
+            } else {
79
+              out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
80
+            }
81
+            out += '\' ';
82
+          }
83
+          if (it.opts.verbose) {
84
+            out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
85
+          }
86
+          out += ' } ';
87
+        } else {
88
+          out += ' {} ';
89
+        }
90
+        var __err = out;
91
+        out = $$outStack.pop();
92
+        if (!it.compositeRule && $breakOnError) {
93
+          /* istanbul ignore if */
94
+          if (it.async) {
95
+            out += ' throw new ValidationError([' + (__err) + ']); ';
96
+          } else {
97
+            out += ' validate.errors = [' + (__err) + ']; return false; ';
98
+          }
99
+        } else {
100
+          out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
101
+        }
102
+        out += ' } else { ';
103
+      } else {
104
+        out += ' if ( ';
105
+        var arr2 = $required;
106
+        if (arr2) {
107
+          var $propertyKey, $i = -1,
108
+            l2 = arr2.length - 1;
109
+          while ($i < l2) {
110
+            $propertyKey = arr2[$i += 1];
111
+            if ($i) {
112
+              out += ' || ';
113
+            }
114
+            var $prop = it.util.getProperty($propertyKey),
115
+              $useData = $data + $prop;
116
+            out += ' ( ( ' + ($useData) + ' === undefined ';
117
+            if ($ownProperties) {
118
+              out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
119
+            }
120
+            out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
121
+          }
122
+        }
123
+        out += ') {  ';
124
+        var $propertyPath = 'missing' + $lvl,
125
+          $missingProperty = '\' + ' + $propertyPath + ' + \'';
126
+        if (it.opts._errorDataPathProperty) {
127
+          it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
128
+        }
129
+        var $$outStack = $$outStack || [];
130
+        $$outStack.push(out);
131
+        out = ''; /* istanbul ignore else */
132
+        if (it.createErrors !== false) {
133
+          out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
134
+          if (it.opts.messages !== false) {
135
+            out += ' , message: \'';
136
+            if (it.opts._errorDataPathProperty) {
137
+              out += 'is a required property';
138
+            } else {
139
+              out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
140
+            }
141
+            out += '\' ';
142
+          }
143
+          if (it.opts.verbose) {
144
+            out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
145
+          }
146
+          out += ' } ';
147
+        } else {
148
+          out += ' {} ';
149
+        }
150
+        var __err = out;
151
+        out = $$outStack.pop();
152
+        if (!it.compositeRule && $breakOnError) {
153
+          /* istanbul ignore if */
154
+          if (it.async) {
155
+            out += ' throw new ValidationError([' + (__err) + ']); ';
156
+          } else {
157
+            out += ' validate.errors = [' + (__err) + ']; return false; ';
158
+          }
159
+        } else {
160
+          out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
161
+        }
162
+        out += ' } else { ';
163
+      }
164
+    } else {
165
+      if ($loopRequired) {
166
+        if (!$isData) {
167
+          out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
168
+        }
169
+        var $i = 'i' + $lvl,
170
+          $propertyPath = 'schema' + $lvl + '[' + $i + ']',
171
+          $missingProperty = '\' + ' + $propertyPath + ' + \'';
172
+        if (it.opts._errorDataPathProperty) {
173
+          it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
174
+        }
175
+        if ($isData) {
176
+          out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) {  var err =   '; /* istanbul ignore else */
177
+          if (it.createErrors !== false) {
178
+            out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
179
+            if (it.opts.messages !== false) {
180
+              out += ' , message: \'';
181
+              if (it.opts._errorDataPathProperty) {
182
+                out += 'is a required property';
183
+              } else {
184
+                out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
185
+              }
186
+              out += '\' ';
187
+            }
188
+            if (it.opts.verbose) {
189
+              out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
190
+            }
191
+            out += ' } ';
192
+          } else {
193
+            out += ' {} ';
194
+          }
195
+          out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';
196
+        }
197
+        out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';
198
+        if ($ownProperties) {
199
+          out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';
200
+        }
201
+        out += ') {  var err =   '; /* istanbul ignore else */
202
+        if (it.createErrors !== false) {
203
+          out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
204
+          if (it.opts.messages !== false) {
205
+            out += ' , message: \'';
206
+            if (it.opts._errorDataPathProperty) {
207
+              out += 'is a required property';
208
+            } else {
209
+              out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
210
+            }
211
+            out += '\' ';
212
+          }
213
+          if (it.opts.verbose) {
214
+            out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
215
+          }
216
+          out += ' } ';
217
+        } else {
218
+          out += ' {} ';
219
+        }
220
+        out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';
221
+        if ($isData) {
222
+          out += '  }  ';
223
+        }
224
+      } else {
225
+        var arr3 = $required;
226
+        if (arr3) {
227
+          var $propertyKey, i3 = -1,
228
+            l3 = arr3.length - 1;
229
+          while (i3 < l3) {
230
+            $propertyKey = arr3[i3 += 1];
231
+            var $prop = it.util.getProperty($propertyKey),
232
+              $missingProperty = it.util.escapeQuotes($propertyKey),
233
+              $useData = $data + $prop;
234
+            if (it.opts._errorDataPathProperty) {
235
+              it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
236
+            }
237
+            out += ' if ( ' + ($useData) + ' === undefined ';
238
+            if ($ownProperties) {
239
+              out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
240
+            }
241
+            out += ') {  var err =   '; /* istanbul ignore else */
242
+            if (it.createErrors !== false) {
243
+              out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
244
+              if (it.opts.messages !== false) {
245
+                out += ' , message: \'';
246
+                if (it.opts._errorDataPathProperty) {
247
+                  out += 'is a required property';
248
+                } else {
249
+                  out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
250
+                }
251
+                out += '\' ';
252
+              }
253
+              if (it.opts.verbose) {
254
+                out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
255
+              }
256
+              out += ' } ';
257
+            } else {
258
+              out += ' {} ';
259
+            }
260
+            out += ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
261
+          }
262
+        }
263
+      }
264
+    }
265
+    it.errorPath = $currentErrorPath;
266
+  } else if ($breakOnError) {
267
+    out += ' if (true) {';
268
+  }
269
+  return out;
270
+}

+ 86
- 0
node_modules/ajv/lib/dotjs/uniqueItems.js View File

@@ -0,0 +1,86 @@
1
+'use strict';
2
+module.exports = function generate_uniqueItems(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 (($schema || $isData) && it.opts.uniqueItems !== false) {
21
+    if ($isData) {
22
+      out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { ';
23
+    }
24
+    out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';
25
+    var $itemType = it.schema.items && it.schema.items.type,
26
+      $typeIsArray = Array.isArray($itemType);
27
+    if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {
28
+      out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';
29
+    } else {
30
+      out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
31
+      var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
32
+      out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
33
+      if ($typeIsArray) {
34
+        out += ' if (typeof item == \'string\') item = \'"\' + item; ';
35
+      }
36
+      out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';
37
+    }
38
+    out += ' } ';
39
+    if ($isData) {
40
+      out += '  }  ';
41
+    }
42
+    out += ' if (!' + ($valid) + ') {   ';
43
+    var $$outStack = $$outStack || [];
44
+    $$outStack.push(out);
45
+    out = ''; /* istanbul ignore else */
46
+    if (it.createErrors !== false) {
47
+      out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';
48
+      if (it.opts.messages !== false) {
49
+        out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' ';
50
+      }
51
+      if (it.opts.verbose) {
52
+        out += ' , schema:  ';
53
+        if ($isData) {
54
+          out += 'validate.schema' + ($schemaPath);
55
+        } else {
56
+          out += '' + ($schema);
57
+        }
58
+        out += '         , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
59
+      }
60
+      out += ' } ';
61
+    } else {
62
+      out += ' {} ';
63
+    }
64
+    var __err = out;
65
+    out = $$outStack.pop();
66
+    if (!it.compositeRule && $breakOnError) {
67
+      /* istanbul ignore if */
68
+      if (it.async) {
69
+        out += ' throw new ValidationError([' + (__err) + ']); ';
70
+      } else {
71
+        out += ' validate.errors = [' + (__err) + ']; return false; ';
72
+      }
73
+    } else {
74
+      out += ' var err = ' + (__err) + ';  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
75
+    }
76
+    out += ' } ';
77
+    if ($breakOnError) {
78
+      out += ' else { ';
79
+    }
80
+  } else {
81
+    if ($breakOnError) {
82
+      out += ' if (true) { ';
83
+    }
84
+  }
85
+  return out;
86
+}

+ 0
- 0
node_modules/ajv/lib/dotjs/validate.js View File


Some files were not shown because too many files changed in this diff