trusty-cms 5.0.6 → 5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +60 -59
  3. data/app/models/asset.rb +8 -2
  4. data/app/views/admin/assets/_asset_table.html.haml +1 -1
  5. data/app/views/admin/assets/_search.html.haml +1 -1
  6. data/app/views/admin/assets/_search_results.html.haml +2 -2
  7. data/app/views/admin/assets/edit.html.haml +5 -5
  8. data/app/views/admin/assets/index.html.haml +1 -1
  9. data/app/views/admin/configuration/_clipped_show.html.haml +1 -1
  10. data/app/views/admin/pages/_asset_popups.html.haml +5 -5
  11. data/app/views/admin/removed/_assets_bucket.html.haml +2 -2
  12. data/app/views/admin/removed/_assets_container.html.haml +6 -6
  13. data/app/views/admin/removed/_bucket.html.haml +1 -1
  14. data/app/views/admin/removed/_upload_to_page.html.haml +1 -1
  15. data/app/views/admin/sites/_form.haml +2 -2
  16. data/app/views/admin/snippets/edit.html.haml +1 -1
  17. data/app/views/admin/snippets/new.html.haml +1 -1
  18. data/config/database.yml +4 -0
  19. data/coverage/index.html +154 -154
  20. data/lib/generators/extension_controller/templates/view_spec.rb +1 -1
  21. data/lib/generators/generator_base_extension.rb +0 -1
  22. data/lib/generators/instance/instance_generator.rb +1 -1
  23. data/lib/generators/language_extension/language_extension_generator.rb +0 -1
  24. data/lib/generators/language_extension/templates/test_helper.rb +0 -1
  25. data/lib/generators/trusty_cms/trusty_cms_generator.rb +0 -2
  26. data/lib/trusty_cms.rb +1 -1
  27. data/node_modules/ajv/README.md +158 -72
  28. data/node_modules/ajv/dist/ajv.bundle.js +136 -112
  29. data/node_modules/ajv/dist/ajv.min.js +2 -2
  30. data/node_modules/ajv/dist/ajv.min.js.map +1 -1
  31. data/node_modules/ajv/lib/ajv.d.ts +3 -1
  32. data/node_modules/ajv/lib/compile/equal.js +1 -1
  33. data/node_modules/ajv/lib/compile/formats.js +4 -4
  34. data/node_modules/ajv/lib/compile/index.js +1 -1
  35. data/node_modules/ajv/lib/compile/util.js +9 -44
  36. data/node_modules/ajv/lib/data.js +1 -1
  37. data/node_modules/ajv/lib/definition_schema.js +1 -1
  38. data/node_modules/ajv/lib/dot/_limit.jst +9 -0
  39. data/node_modules/ajv/lib/dot/_limitItems.jst +2 -0
  40. data/node_modules/ajv/lib/dot/_limitLength.jst +2 -0
  41. data/node_modules/ajv/lib/dot/_limitProperties.jst +2 -0
  42. data/node_modules/ajv/lib/dot/allOf.jst +0 -2
  43. data/node_modules/ajv/lib/dot/anyOf.jst +0 -2
  44. data/node_modules/ajv/lib/dot/coerce.def +18 -28
  45. data/node_modules/ajv/lib/dot/contains.jst +0 -2
  46. data/node_modules/ajv/lib/dot/definitions.def +9 -7
  47. data/node_modules/ajv/lib/dot/dependencies.jst +1 -2
  48. data/node_modules/ajv/lib/dot/if.jst +0 -2
  49. data/node_modules/ajv/lib/dot/items.jst +0 -2
  50. data/node_modules/ajv/lib/dot/multipleOf.jst +2 -0
  51. data/node_modules/ajv/lib/dot/properties.jst +6 -5
  52. data/node_modules/ajv/lib/dot/propertyNames.jst +0 -2
  53. data/node_modules/ajv/lib/dot/uniqueItems.jst +1 -1
  54. data/node_modules/ajv/lib/dot/validate.jst +3 -9
  55. data/node_modules/ajv/lib/dotjs/_limit.js +6 -0
  56. data/node_modules/ajv/lib/dotjs/_limitItems.js +3 -0
  57. data/node_modules/ajv/lib/dotjs/_limitLength.js +3 -0
  58. data/node_modules/ajv/lib/dotjs/_limitProperties.js +3 -0
  59. data/node_modules/ajv/lib/dotjs/allOf.js +1 -2
  60. data/node_modules/ajv/lib/dotjs/anyOf.js +1 -2
  61. data/node_modules/ajv/lib/dotjs/contains.js +1 -2
  62. data/node_modules/ajv/lib/dotjs/dependencies.js +2 -2
  63. data/node_modules/ajv/lib/dotjs/if.js +2 -3
  64. data/node_modules/ajv/lib/dotjs/items.js +3 -4
  65. data/node_modules/ajv/lib/dotjs/multipleOf.js +3 -0
  66. data/node_modules/ajv/lib/dotjs/not.js +1 -1
  67. data/node_modules/ajv/lib/dotjs/oneOf.js +1 -1
  68. data/node_modules/ajv/lib/dotjs/properties.js +11 -6
  69. data/node_modules/ajv/lib/dotjs/propertyNames.js +1 -2
  70. data/node_modules/ajv/lib/dotjs/required.js +1 -1
  71. data/node_modules/ajv/lib/dotjs/uniqueItems.js +1 -1
  72. data/node_modules/ajv/lib/dotjs/validate.js +13 -25
  73. data/node_modules/ajv/lib/keyword.js +1 -1
  74. data/node_modules/ajv/lib/refs/data.json +1 -1
  75. data/node_modules/ajv/lib/refs/json-schema-secure.json +1 -1
  76. data/node_modules/ajv/package.json +18 -10
  77. data/node_modules/ajv/scripts/info +0 -0
  78. data/node_modules/ajv/scripts/prepare-tests +0 -0
  79. data/node_modules/ajv/scripts/publish-built-version +1 -1
  80. data/node_modules/ajv/scripts/travis-gh-pages +1 -1
  81. data/node_modules/fast-deep-equal/es6/index.d.ts +1 -1
  82. data/node_modules/fast-deep-equal/es6/react.d.ts +1 -1
  83. data/node_modules/fast-deep-equal/package.json +7 -7
  84. data/node_modules/fast-deep-equal/react.d.ts +1 -1
  85. data/node_modules/uri-js/LICENSE +11 -0
  86. data/node_modules/uri-js/README.md +22 -18
  87. data/node_modules/uri-js/dist/es5/uri.all.d.ts +59 -59
  88. data/node_modules/uri-js/dist/es5/uri.all.js +61 -7
  89. data/node_modules/uri-js/dist/es5/uri.all.js.map +1 -1
  90. data/node_modules/uri-js/dist/es5/uri.all.min.d.ts +59 -59
  91. data/node_modules/uri-js/dist/es5/uri.all.min.js +2 -2
  92. data/node_modules/uri-js/dist/es5/uri.all.min.js.map +1 -1
  93. data/node_modules/uri-js/dist/esnext/index.d.ts +1 -1
  94. data/node_modules/uri-js/dist/esnext/index.js +16 -12
  95. data/node_modules/uri-js/dist/esnext/index.js.map +1 -1
  96. data/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +3 -3
  97. data/node_modules/uri-js/dist/esnext/regexps-iri.js +2 -2
  98. data/node_modules/uri-js/dist/esnext/regexps-iri.js.map +0 -0
  99. data/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +4 -4
  100. data/node_modules/uri-js/dist/esnext/regexps-uri.js +41 -41
  101. data/node_modules/uri-js/dist/esnext/regexps-uri.js.map +0 -0
  102. data/node_modules/uri-js/dist/esnext/schemes/http.d.ts +3 -3
  103. data/node_modules/uri-js/dist/esnext/schemes/http.js +27 -26
  104. data/node_modules/uri-js/dist/esnext/schemes/http.js.map +1 -1
  105. data/node_modules/uri-js/dist/esnext/schemes/https.d.ts +3 -3
  106. data/node_modules/uri-js/dist/esnext/schemes/https.js +8 -8
  107. data/node_modules/uri-js/dist/esnext/schemes/https.js.map +0 -0
  108. data/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +12 -12
  109. data/node_modules/uri-js/dist/esnext/schemes/mailto.js +0 -0
  110. data/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +0 -0
  111. data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +7 -7
  112. data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +22 -22
  113. data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +0 -0
  114. data/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +10 -10
  115. data/node_modules/uri-js/dist/esnext/schemes/urn.js +48 -48
  116. data/node_modules/uri-js/dist/esnext/schemes/urn.js.map +0 -0
  117. data/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +7 -0
  118. data/node_modules/uri-js/dist/esnext/schemes/ws.js +41 -0
  119. data/node_modules/uri-js/dist/esnext/schemes/ws.js.map +1 -0
  120. data/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +3 -0
  121. data/node_modules/uri-js/dist/esnext/schemes/wss.js +9 -0
  122. data/node_modules/uri-js/dist/esnext/schemes/wss.js.map +1 -0
  123. data/node_modules/uri-js/dist/esnext/uri.d.ts +59 -59
  124. data/node_modules/uri-js/dist/esnext/uri.js +2 -2
  125. data/node_modules/uri-js/dist/esnext/uri.js.map +1 -1
  126. data/node_modules/uri-js/dist/esnext/util.d.ts +6 -6
  127. data/node_modules/uri-js/dist/esnext/util.js +35 -35
  128. data/node_modules/uri-js/dist/esnext/util.js.map +0 -0
  129. data/node_modules/uri-js/package.json +19 -7
  130. data/node_modules/uri-js/yarn.lock +1271 -615
  131. data/spec/dummy/log/test.log +635 -0
  132. data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
  133. data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +1 -0
  134. data/trusty_cms.gemspec +2 -1
  135. data/yarn.lock +9 -9
  136. metadata +48 -57
  137. data/node_modules/uri-js/bower.json +0 -47
  138. data/node_modules/uri-js/rollup.config.js +0 -32
  139. data/node_modules/uri-js/src/index.ts +0 -18
  140. data/node_modules/uri-js/src/punycode.d.ts +0 -24
  141. data/node_modules/uri-js/src/regexps-iri.ts +0 -4
  142. data/node_modules/uri-js/src/regexps-uri.ts +0 -89
  143. data/node_modules/uri-js/src/schemes/http.ts +0 -36
  144. data/node_modules/uri-js/src/schemes/https.ts +0 -11
  145. data/node_modules/uri-js/src/schemes/mailto.ts +0 -182
  146. data/node_modules/uri-js/src/schemes/urn-uuid.ts +0 -36
  147. data/node_modules/uri-js/src/schemes/urn.ts +0 -69
  148. data/node_modules/uri-js/src/uri.ts +0 -556
  149. data/node_modules/uri-js/src/util.ts +0 -40
  150. data/node_modules/uri-js/tests/qunit.css +0 -118
  151. data/node_modules/uri-js/tests/qunit.js +0 -1042
  152. data/node_modules/uri-js/tests/test-es5-min.html +0 -17
  153. data/node_modules/uri-js/tests/test-es5.html +0 -17
  154. data/node_modules/uri-js/tests/tests.js +0 -774
  155. data/node_modules/uri-js/tsconfig.json +0 -20
  156. data/spec/dummy/log/development.log +0 -456
@@ -170,8 +170,8 @@ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|
170
170
  // For the source: https://gist.github.com/dperini/729294
171
171
  // For test cases: https://mathiasbynens.be/demo/url-regex
172
172
  // @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
173
- // 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;
174
- 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-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-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;
173
+ // 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;
174
+ 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;
175
175
  var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
176
176
  var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
177
177
  var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
@@ -193,8 +193,8 @@ formats.fast = {
193
193
  time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
194
194
  '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,
195
195
  // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
196
- uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,
197
- 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
196
+ uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
197
+ 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
198
198
  'uri-template': URITEMPLATE,
199
199
  url: URL,
200
200
  // email (sources from jsen validator):
@@ -414,7 +414,7 @@ function compile(schema, root, localRefs, baseId) {
414
414
  + vars(defaults, defaultCode) + vars(customRules, customRuleCode)
415
415
  + sourceCode;
416
416
 
417
- if (opts.processCode) sourceCode = opts.processCode(sourceCode);
417
+ if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
418
418
  // console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
419
419
  var validate;
420
420
  try {
@@ -1076,8 +1076,6 @@ module.exports = {
1076
1076
  ucs2length: require('./ucs2length'),
1077
1077
  varOccurences: varOccurences,
1078
1078
  varReplace: varReplace,
1079
- cleanUpCode: cleanUpCode,
1080
- finalCleanUpCode: finalCleanUpCode,
1081
1079
  schemaHasRules: schemaHasRules,
1082
1080
  schemaHasRulesExcept: schemaHasRulesExcept,
1083
1081
  schemaUnknownRules: schemaUnknownRules,
@@ -1099,7 +1097,7 @@ function copy(o, to) {
1099
1097
  }
1100
1098
 
1101
1099
 
1102
- function checkDataType(dataType, data, negate) {
1100
+ function checkDataType(dataType, data, strictNumbers, negate) {
1103
1101
  var EQUAL = negate ? ' !== ' : ' === '
1104
1102
  , AND = negate ? ' || ' : ' && '
1105
1103
  , OK = negate ? '!' : ''
@@ -1112,15 +1110,18 @@ function checkDataType(dataType, data, negate) {
1112
1110
  NOT + 'Array.isArray(' + data + '))';
1113
1111
  case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
1114
1112
  NOT + '(' + data + ' % 1)' +
1115
- AND + data + EQUAL + data + ')';
1113
+ AND + data + EQUAL + data +
1114
+ (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
1115
+ case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
1116
+ (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
1116
1117
  default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
1117
1118
  }
1118
1119
  }
1119
1120
 
1120
1121
 
1121
- function checkDataTypes(dataTypes, data) {
1122
+ function checkDataTypes(dataTypes, data, strictNumbers) {
1122
1123
  switch (dataTypes.length) {
1123
- case 1: return checkDataType(dataTypes[0], data, true);
1124
+ case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
1124
1125
  default:
1125
1126
  var code = '';
1126
1127
  var types = toHash(dataTypes);
@@ -1133,7 +1134,7 @@ function checkDataTypes(dataTypes, data) {
1133
1134
  }
1134
1135
  if (types.number) delete types.integer;
1135
1136
  for (var t in types)
1136
- code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
1137
+ code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
1137
1138
 
1138
1139
  return code;
1139
1140
  }
@@ -1199,42 +1200,6 @@ function varReplace(str, dataVar, expr) {
1199
1200
  }
1200
1201
 
1201
1202
 
1202
- var EMPTY_ELSE = /else\s*{\s*}/g
1203
- , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
1204
- , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
1205
- function cleanUpCode(out) {
1206
- return out.replace(EMPTY_ELSE, '')
1207
- .replace(EMPTY_IF_NO_ELSE, '')
1208
- .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
1209
- }
1210
-
1211
-
1212
- var ERRORS_REGEXP = /[^v.]errors/g
1213
- , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
1214
- , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
1215
- , RETURN_VALID = 'return errors === 0;'
1216
- , RETURN_TRUE = 'validate.errors = null; return true;'
1217
- , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
1218
- , RETURN_DATA_ASYNC = 'return data;'
1219
- , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
1220
- , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
1221
-
1222
- function finalCleanUpCode(out, async) {
1223
- var matches = out.match(ERRORS_REGEXP);
1224
- if (matches && matches.length == 2) {
1225
- out = async
1226
- ? out.replace(REMOVE_ERRORS_ASYNC, '')
1227
- .replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
1228
- : out.replace(REMOVE_ERRORS, '')
1229
- .replace(RETURN_VALID, RETURN_TRUE);
1230
- }
1231
-
1232
- matches = out.match(ROOTDATA_REGEXP);
1233
- if (!matches || matches.length !== 3) return out;
1234
- return out.replace(REMOVE_ROOTDATA, '');
1235
- }
1236
-
1237
-
1238
1203
  function schemaHasRules(schema, rules) {
1239
1204
  if (typeof schema == 'boolean') return !schema;
1240
1205
  for (var key in schema) if (rules[key]) return true;
@@ -1313,7 +1278,7 @@ function getData($data, lvl, paths) {
1313
1278
 
1314
1279
  function joinPaths (a, b) {
1315
1280
  if (a == '""') return b;
1316
- return (a + ' + ' + b).replace(/' \+ '/g, '');
1281
+ return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
1317
1282
  }
1318
1283
 
1319
1284
 
@@ -1377,7 +1342,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
1377
1342
  keywords[key] = {
1378
1343
  anyOf: [
1379
1344
  schema,
1380
- { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
1345
+ { $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
1381
1346
  ]
1382
1347
  };
1383
1348
  }
@@ -1393,7 +1358,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
1393
1358
  var metaSchema = require('./refs/json-schema-draft-07.json');
1394
1359
 
1395
1360
  module.exports = {
1396
- $id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js',
1361
+ $id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
1397
1362
  definitions: {
1398
1363
  simpleTypes: metaSchema.definitions.simpleTypes
1399
1364
  },
@@ -1453,6 +1418,12 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
1453
1418
  $op = $isMax ? '<' : '>',
1454
1419
  $notOp = $isMax ? '>' : '<',
1455
1420
  $errorKeyword = undefined;
1421
+ if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
1422
+ throw new Error($keyword + ' must be number');
1423
+ }
1424
+ if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
1425
+ throw new Error($exclusiveKeyword + ' must be number or boolean');
1426
+ }
1456
1427
  if ($isDataExcl) {
1457
1428
  var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
1458
1429
  $exclusive = 'exclusive' + $lvl,
@@ -1605,6 +1576,9 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
1605
1576
  } else {
1606
1577
  $schemaValue = $schema;
1607
1578
  }
1579
+ if (!($isData || typeof $schema == 'number')) {
1580
+ throw new Error($keyword + ' must be number');
1581
+ }
1608
1582
  var $op = $keyword == 'maxItems' ? '>' : '<';
1609
1583
  out += 'if ( ';
1610
1584
  if ($isData) {
@@ -1684,6 +1658,9 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) {
1684
1658
  } else {
1685
1659
  $schemaValue = $schema;
1686
1660
  }
1661
+ if (!($isData || typeof $schema == 'number')) {
1662
+ throw new Error($keyword + ' must be number');
1663
+ }
1687
1664
  var $op = $keyword == 'maxLength' ? '>' : '<';
1688
1665
  out += 'if ( ';
1689
1666
  if ($isData) {
@@ -1768,6 +1745,9 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
1768
1745
  } else {
1769
1746
  $schemaValue = $schema;
1770
1747
  }
1748
+ if (!($isData || typeof $schema == 'number')) {
1749
+ throw new Error($keyword + ' must be number');
1750
+ }
1771
1751
  var $op = $keyword == 'maxProperties' ? '>' : '<';
1772
1752
  out += 'if ( ';
1773
1753
  if ($isData) {
@@ -1847,7 +1827,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
1847
1827
  l1 = arr1.length - 1;
1848
1828
  while ($i < l1) {
1849
1829
  $sch = arr1[$i += 1];
1850
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
1830
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
1851
1831
  $allSchemasEmpty = false;
1852
1832
  $it.schema = $sch;
1853
1833
  $it.schemaPath = $schemaPath + '[' + $i + ']';
@@ -1868,7 +1848,6 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
1868
1848
  out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
1869
1849
  }
1870
1850
  }
1871
- out = it.util.cleanUpCode(out);
1872
1851
  return out;
1873
1852
  }
1874
1853
 
@@ -1890,7 +1869,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
1890
1869
  $it.level++;
1891
1870
  var $nextValid = 'valid' + $it.level;
1892
1871
  var $noEmptySchema = $schema.every(function($sch) {
1893
- return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all));
1872
+ return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
1894
1873
  });
1895
1874
  if ($noEmptySchema) {
1896
1875
  var $currentBaseId = $it.baseId;
@@ -1939,7 +1918,6 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
1939
1918
  if (it.opts.allErrors) {
1940
1919
  out += ' } ';
1941
1920
  }
1942
- out = it.util.cleanUpCode(out);
1943
1921
  } else {
1944
1922
  if ($breakOnError) {
1945
1923
  out += ' if (true) { ';
@@ -2043,7 +2021,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
2043
2021
  $dataNxt = $it.dataLevel = it.dataLevel + 1,
2044
2022
  $nextData = 'data' + $dataNxt,
2045
2023
  $currentBaseId = it.baseId,
2046
- $nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all));
2024
+ $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
2047
2025
  out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
2048
2026
  if ($nonEmptySchema) {
2049
2027
  var $wasComposite = it.compositeRule;
@@ -2102,7 +2080,6 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
2102
2080
  if (it.opts.allErrors) {
2103
2081
  out += ' } ';
2104
2082
  }
2105
- out = it.util.cleanUpCode(out);
2106
2083
  return out;
2107
2084
  }
2108
2085
 
@@ -2356,6 +2333,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
2356
2333
  $propertyDeps = {},
2357
2334
  $ownProperties = it.opts.ownProperties;
2358
2335
  for ($property in $schema) {
2336
+ if ($property == '__proto__') continue;
2359
2337
  var $sch = $schema[$property];
2360
2338
  var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
2361
2339
  $deps[$property] = $sch;
@@ -2481,7 +2459,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
2481
2459
  var $currentBaseId = $it.baseId;
2482
2460
  for (var $property in $schemaDeps) {
2483
2461
  var $sch = $schemaDeps[$property];
2484
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
2462
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
2485
2463
  out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
2486
2464
  if ($ownProperties) {
2487
2465
  out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
@@ -2502,7 +2480,6 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
2502
2480
  if ($breakOnError) {
2503
2481
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
2504
2482
  }
2505
- out = it.util.cleanUpCode(out);
2506
2483
  return out;
2507
2484
  }
2508
2485
 
@@ -2744,8 +2721,8 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
2744
2721
  var $nextValid = 'valid' + $it.level;
2745
2722
  var $thenSch = it.schema['then'],
2746
2723
  $elseSch = it.schema['else'],
2747
- $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)),
2748
- $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)),
2724
+ $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
2725
+ $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
2749
2726
  $currentBaseId = $it.baseId;
2750
2727
  if ($thenPresent || $elsePresent) {
2751
2728
  var $ifClause;
@@ -2823,7 +2800,6 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
2823
2800
  if ($breakOnError) {
2824
2801
  out += ' else { ';
2825
2802
  }
2826
- out = it.util.cleanUpCode(out);
2827
2803
  } else {
2828
2804
  if ($breakOnError) {
2829
2805
  out += ' if (true) { ';
@@ -2936,7 +2912,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
2936
2912
  l1 = arr1.length - 1;
2937
2913
  while ($i < l1) {
2938
2914
  $sch = arr1[$i += 1];
2939
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
2915
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
2940
2916
  out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
2941
2917
  var $passData = $data + '[' + $i + ']';
2942
2918
  $it.schema = $sch;
@@ -2959,7 +2935,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
2959
2935
  }
2960
2936
  }
2961
2937
  }
2962
- if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
2938
+ if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
2963
2939
  $it.schema = $additionalItems;
2964
2940
  $it.schemaPath = it.schemaPath + '.additionalItems';
2965
2941
  $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
@@ -2983,7 +2959,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
2983
2959
  $closingBraces += '}';
2984
2960
  }
2985
2961
  }
2986
- } else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
2962
+ } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
2987
2963
  $it.schema = $schema;
2988
2964
  $it.schemaPath = $schemaPath;
2989
2965
  $it.errSchemaPath = $errSchemaPath;
@@ -3006,7 +2982,6 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
3006
2982
  if ($breakOnError) {
3007
2983
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
3008
2984
  }
3009
- out = it.util.cleanUpCode(out);
3010
2985
  return out;
3011
2986
  }
3012
2987
 
@@ -3029,6 +3004,9 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
3029
3004
  } else {
3030
3005
  $schemaValue = $schema;
3031
3006
  }
3007
+ if (!($isData || typeof $schema == 'number')) {
3008
+ throw new Error($keyword + ' must be number');
3009
+ }
3032
3010
  out += 'var division' + ($lvl) + ';if (';
3033
3011
  if ($isData) {
3034
3012
  out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
@@ -3104,7 +3082,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) {
3104
3082
  var $it = it.util.copy(it);
3105
3083
  $it.level++;
3106
3084
  var $nextValid = 'valid' + $it.level;
3107
- if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
3085
+ if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
3108
3086
  $it.schema = $schema;
3109
3087
  $it.schemaPath = $schemaPath;
3110
3088
  $it.errSchemaPath = $errSchemaPath;
@@ -3204,7 +3182,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
3204
3182
  l1 = arr1.length - 1;
3205
3183
  while ($i < l1) {
3206
3184
  $sch = arr1[$i += 1];
3207
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
3185
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
3208
3186
  $it.schema = $sch;
3209
3187
  $it.schemaPath = $schemaPath + '[' + $i + ']';
3210
3188
  $it.errSchemaPath = $errSchemaPath + '/' + $i;
@@ -3348,9 +3326,9 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
3348
3326
  $dataNxt = $it.dataLevel = it.dataLevel + 1,
3349
3327
  $nextData = 'data' + $dataNxt,
3350
3328
  $dataProperties = 'dataProperties' + $lvl;
3351
- var $schemaKeys = Object.keys($schema || {}),
3329
+ var $schemaKeys = Object.keys($schema || {}).filter(notProto),
3352
3330
  $pProperties = it.schema.patternProperties || {},
3353
- $pPropertyKeys = Object.keys($pProperties),
3331
+ $pPropertyKeys = Object.keys($pProperties).filter(notProto),
3354
3332
  $aProperties = it.schema.additionalProperties,
3355
3333
  $someProperties = $schemaKeys.length || $pPropertyKeys.length,
3356
3334
  $noAdditional = $aProperties === false,
@@ -3360,7 +3338,13 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
3360
3338
  $ownProperties = it.opts.ownProperties,
3361
3339
  $currentBaseId = it.baseId;
3362
3340
  var $required = it.schema.required;
3363
- if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
3341
+ if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
3342
+ var $requiredHash = it.util.toHash($required);
3343
+ }
3344
+
3345
+ function notProto(p) {
3346
+ return p !== '__proto__';
3347
+ }
3364
3348
  out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
3365
3349
  if ($ownProperties) {
3366
3350
  out += ' var ' + ($dataProperties) + ' = undefined;';
@@ -3513,7 +3497,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
3513
3497
  while (i3 < l3) {
3514
3498
  $propertyKey = arr3[i3 += 1];
3515
3499
  var $sch = $schema[$propertyKey];
3516
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
3500
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
3517
3501
  var $prop = it.util.getProperty($propertyKey),
3518
3502
  $passData = $data + $prop,
3519
3503
  $hasDefault = $useDefaults && $sch.default !== undefined;
@@ -3616,7 +3600,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
3616
3600
  while (i4 < l4) {
3617
3601
  $pProperty = arr4[i4 += 1];
3618
3602
  var $sch = $pProperties[$pProperty];
3619
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
3603
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
3620
3604
  $it.schema = $sch;
3621
3605
  $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
3622
3606
  $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
@@ -3655,7 +3639,6 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
3655
3639
  if ($breakOnError) {
3656
3640
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
3657
3641
  }
3658
- out = it.util.cleanUpCode(out);
3659
3642
  return out;
3660
3643
  }
3661
3644
 
@@ -3676,7 +3659,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
3676
3659
  $it.level++;
3677
3660
  var $nextValid = 'valid' + $it.level;
3678
3661
  out += 'var ' + ($errs) + ' = errors;';
3679
- if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
3662
+ if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
3680
3663
  $it.schema = $schema;
3681
3664
  $it.schemaPath = $schemaPath;
3682
3665
  $it.errSchemaPath = $errSchemaPath;
@@ -3739,7 +3722,6 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
3739
3722
  if ($breakOnError) {
3740
3723
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
3741
3724
  }
3742
- out = it.util.cleanUpCode(out);
3743
3725
  return out;
3744
3726
  }
3745
3727
 
@@ -3900,7 +3882,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) {
3900
3882
  while (i1 < l1) {
3901
3883
  $property = arr1[i1 += 1];
3902
3884
  var $propertySch = it.schema.properties[$property];
3903
- if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == 'object' && Object.keys($propertySch).length > 0 : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
3885
+ if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
3904
3886
  $required[$required.length] = $property;
3905
3887
  }
3906
3888
  }
@@ -4173,7 +4155,7 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
4173
4155
  } else {
4174
4156
  out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
4175
4157
  var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
4176
- out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
4158
+ out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
4177
4159
  if ($typeIsArray) {
4178
4160
  out += ' if (typeof item == \'string\') item = \'"\' + item; ';
4179
4161
  }
@@ -4323,7 +4305,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
4323
4305
  it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
4324
4306
  it.baseId = it.baseId || it.rootId;
4325
4307
  delete it.isTop;
4326
- it.dataPathArr = [undefined];
4308
+ it.dataPathArr = [""];
4327
4309
  if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
4328
4310
  var $defaultMsg = 'default is ignored in the schema root';
4329
4311
  if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
@@ -4381,47 +4363,39 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
4381
4363
  var $schemaPath = it.schemaPath + '.type',
4382
4364
  $errSchemaPath = it.errSchemaPath + '/type',
4383
4365
  $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
4384
- out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
4366
+ out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
4385
4367
  if ($coerceToTypes) {
4386
4368
  var $dataType = 'dataType' + $lvl,
4387
4369
  $coerced = 'coerced' + $lvl;
4388
- out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
4370
+ out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
4389
4371
  if (it.opts.coerceTypes == 'array') {
4390
- out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; ';
4372
+ out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';
4391
4373
  }
4392
- out += ' var ' + ($coerced) + ' = undefined; ';
4393
- var $bracesCoercion = '';
4374
+ out += ' if (' + ($coerced) + ' !== undefined) ; ';
4394
4375
  var arr1 = $coerceToTypes;
4395
4376
  if (arr1) {
4396
4377
  var $type, $i = -1,
4397
4378
  l1 = arr1.length - 1;
4398
4379
  while ($i < l1) {
4399
4380
  $type = arr1[$i += 1];
4400
- if ($i) {
4401
- out += ' if (' + ($coerced) + ' === undefined) { ';
4402
- $bracesCoercion += '}';
4403
- }
4404
- if (it.opts.coerceTypes == 'array' && $type != 'array') {
4405
- out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
4406
- }
4407
4381
  if ($type == 'string') {
4408
- out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
4382
+ out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
4409
4383
  } else if ($type == 'number' || $type == 'integer') {
4410
- out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
4384
+ out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
4411
4385
  if ($type == 'integer') {
4412
4386
  out += ' && !(' + ($data) + ' % 1)';
4413
4387
  }
4414
4388
  out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
4415
4389
  } else if ($type == 'boolean') {
4416
- out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
4390
+ out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
4417
4391
  } else if ($type == 'null') {
4418
- out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
4392
+ out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
4419
4393
  } else if (it.opts.coerceTypes == 'array' && $type == 'array') {
4420
- out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
4394
+ out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
4421
4395
  }
4422
4396
  }
4423
4397
  }
4424
- out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { ';
4398
+ out += ' else { ';
4425
4399
  var $$outStack = $$outStack || [];
4426
4400
  $$outStack.push(out);
4427
4401
  out = ''; /* istanbul ignore else */
@@ -4461,7 +4435,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
4461
4435
  } else {
4462
4436
  out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
4463
4437
  }
4464
- out += ' } else { ';
4438
+ out += ' } if (' + ($coerced) + ' !== undefined) { ';
4465
4439
  var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
4466
4440
  $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
4467
4441
  out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
@@ -4534,7 +4508,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
4534
4508
  $rulesGroup = arr2[i2 += 1];
4535
4509
  if ($shouldUseGroup($rulesGroup)) {
4536
4510
  if ($rulesGroup.type) {
4537
- out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
4511
+ out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
4538
4512
  }
4539
4513
  if (it.opts.useDefaults) {
4540
4514
  if ($rulesGroup.type == 'object' && it.schema.properties) {
@@ -4702,10 +4676,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
4702
4676
  } else {
4703
4677
  out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
4704
4678
  }
4705
- out = it.util.cleanUpCode(out);
4706
- if ($top) {
4707
- out = it.util.finalCleanUpCode(out, $async);
4708
- }
4709
4679
 
4710
4680
  function $shouldUseGroup($rulesGroup) {
4711
4681
  var rules = $rulesGroup.rules;
@@ -4774,7 +4744,7 @@ function addKeyword(keyword, definition) {
4774
4744
  metaSchema = {
4775
4745
  anyOf: [
4776
4746
  metaSchema,
4777
- { '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
4747
+ { '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
4778
4748
  ]
4779
4749
  };
4780
4750
  }
@@ -4876,7 +4846,7 @@ function validateKeyword(definition, throwError) {
4876
4846
  },{"./definition_schema":12,"./dotjs/custom":22}],40:[function(require,module,exports){
4877
4847
  module.exports={
4878
4848
  "$schema": "http://json-schema.org/draft-07/schema#",
4879
- "$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#",
4849
+ "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
4880
4850
  "description": "Meta-schema for $data reference (JSON Schema extension proposal)",
4881
4851
  "type": "object",
4882
4852
  "required": [ "$data" ],
@@ -5263,7 +5233,7 @@ function escapeJsonPtr(str) {
5263
5233
  }
5264
5234
 
5265
5235
  },{}],45:[function(require,module,exports){
5266
- /** @license URI.js v4.2.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5236
+ /** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5267
5237
  (function (global, factory) {
5268
5238
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5269
5239
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -6226,9 +6196,9 @@ function _recomposeAuthority(components, options) {
6226
6196
  return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
6227
6197
  }));
6228
6198
  }
6229
- if (typeof components.port === "number") {
6199
+ if (typeof components.port === "number" || typeof components.port === "string") {
6230
6200
  uriTokens.push(":");
6231
- uriTokens.push(components.port.toString(10));
6201
+ uriTokens.push(String(components.port));
6232
6202
  }
6233
6203
  return uriTokens.length ? uriTokens.join("") : undefined;
6234
6204
  }
@@ -6431,8 +6401,9 @@ var handler = {
6431
6401
  return components;
6432
6402
  },
6433
6403
  serialize: function serialize(components, options) {
6404
+ var secure = String(components.scheme).toLowerCase() === "https";
6434
6405
  //normalize the default port
6435
- if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
6406
+ if (components.port === (secure ? 443 : 80) || components.port === "") {
6436
6407
  components.port = undefined;
6437
6408
  }
6438
6409
  //normalize the empty path
@@ -6453,6 +6424,57 @@ var handler$1 = {
6453
6424
  serialize: handler.serialize
6454
6425
  };
6455
6426
 
6427
+ function isSecure(wsComponents) {
6428
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
6429
+ }
6430
+ //RFC 6455
6431
+ var handler$2 = {
6432
+ scheme: "ws",
6433
+ domainHost: true,
6434
+ parse: function parse(components, options) {
6435
+ var wsComponents = components;
6436
+ //indicate if the secure flag is set
6437
+ wsComponents.secure = isSecure(wsComponents);
6438
+ //construct resouce name
6439
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
6440
+ wsComponents.path = undefined;
6441
+ wsComponents.query = undefined;
6442
+ return wsComponents;
6443
+ },
6444
+ serialize: function serialize(wsComponents, options) {
6445
+ //normalize the default port
6446
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
6447
+ wsComponents.port = undefined;
6448
+ }
6449
+ //ensure scheme matches secure flag
6450
+ if (typeof wsComponents.secure === 'boolean') {
6451
+ wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
6452
+ wsComponents.secure = undefined;
6453
+ }
6454
+ //reconstruct path from resource name
6455
+ if (wsComponents.resourceName) {
6456
+ var _wsComponents$resourc = wsComponents.resourceName.split('?'),
6457
+ _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
6458
+ path = _wsComponents$resourc2[0],
6459
+ query = _wsComponents$resourc2[1];
6460
+
6461
+ wsComponents.path = path && path !== '/' ? path : undefined;
6462
+ wsComponents.query = query;
6463
+ wsComponents.resourceName = undefined;
6464
+ }
6465
+ //forbid fragment component
6466
+ wsComponents.fragment = undefined;
6467
+ return wsComponents;
6468
+ }
6469
+ };
6470
+
6471
+ var handler$3 = {
6472
+ scheme: "wss",
6473
+ domainHost: handler$2.domainHost,
6474
+ parse: handler$2.parse,
6475
+ serialize: handler$2.serialize
6476
+ };
6477
+
6456
6478
  var O = {};
6457
6479
  var isIRI = true;
6458
6480
  //RFC 3986
@@ -6483,7 +6505,7 @@ function decodeUnreserved(str) {
6483
6505
  var decStr = pctDecChars(str);
6484
6506
  return !decStr.match(UNRESERVED) ? str : decStr;
6485
6507
  }
6486
- var handler$2 = {
6508
+ var handler$4 = {
6487
6509
  scheme: "mailto",
6488
6510
  parse: function parse$$1(components, options) {
6489
6511
  var mailtoComponents = components;
@@ -6571,7 +6593,7 @@ var handler$2 = {
6571
6593
 
6572
6594
  var URN_PARSE = /^([^\:]+)\:(.*)/;
6573
6595
  //RFC 2141
6574
- var handler$3 = {
6596
+ var handler$5 = {
6575
6597
  scheme: "urn",
6576
6598
  parse: function parse$$1(components, options) {
6577
6599
  var matches = components.path && components.path.match(URN_PARSE);
@@ -6610,7 +6632,7 @@ var handler$3 = {
6610
6632
 
6611
6633
  var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
6612
6634
  //RFC 4122
6613
- var handler$4 = {
6635
+ var handler$6 = {
6614
6636
  scheme: "urn:uuid",
6615
6637
  parse: function parse(urnComponents, options) {
6616
6638
  var uuidComponents = urnComponents;
@@ -6634,6 +6656,8 @@ SCHEMES[handler$1.scheme] = handler$1;
6634
6656
  SCHEMES[handler$2.scheme] = handler$2;
6635
6657
  SCHEMES[handler$3.scheme] = handler$3;
6636
6658
  SCHEMES[handler$4.scheme] = handler$4;
6659
+ SCHEMES[handler$5.scheme] = handler$5;
6660
+ SCHEMES[handler$6.scheme] = handler$6;
6637
6661
 
6638
6662
  exports.SCHEMES = SCHEMES;
6639
6663
  exports.pctEncChar = pctEncChar;