trusty-cms 5.0.6 → 5.0.7

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -66,7 +66,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
66
66
  l1 = arr1.length - 1;
67
67
  while ($i < l1) {
68
68
  $sch = arr1[$i += 1];
69
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
69
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
70
70
  out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
71
71
  var $passData = $data + '[' + $i + ']';
72
72
  $it.schema = $sch;
@@ -89,7 +89,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
89
89
  }
90
90
  }
91
91
  }
92
- if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
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
93
  $it.schema = $additionalItems;
94
94
  $it.schemaPath = it.schemaPath + '.additionalItems';
95
95
  $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
@@ -113,7 +113,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
113
113
  $closingBraces += '}';
114
114
  }
115
115
  }
116
- } else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
116
+ } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
117
117
  $it.schema = $schema;
118
118
  $it.schemaPath = $schemaPath;
119
119
  $it.errSchemaPath = $errSchemaPath;
@@ -136,6 +136,5 @@ module.exports = function generate_items(it, $keyword, $ruleType) {
136
136
  if ($breakOnError) {
137
137
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
138
138
  }
139
- out = it.util.cleanUpCode(out);
140
139
  return out;
141
140
  }
@@ -16,6 +16,9 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
16
16
  } else {
17
17
  $schemaValue = $schema;
18
18
  }
19
+ if (!($isData || typeof $schema == 'number')) {
20
+ throw new Error($keyword + ' must be number');
21
+ }
19
22
  out += 'var division' + ($lvl) + ';if (';
20
23
  if ($isData) {
21
24
  out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
@@ -12,7 +12,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) {
12
12
  var $it = it.util.copy(it);
13
13
  $it.level++;
14
14
  var $nextValid = 'valid' + $it.level;
15
- if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
15
+ if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
16
16
  $it.schema = $schema;
17
17
  $it.schemaPath = $schemaPath;
18
18
  $it.errSchemaPath = $errSchemaPath;
@@ -26,7 +26,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) {
26
26
  l1 = arr1.length - 1;
27
27
  while ($i < l1) {
28
28
  $sch = arr1[$i += 1];
29
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
29
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
30
30
  $it.schema = $sch;
31
31
  $it.schemaPath = $schemaPath + '[' + $i + ']';
32
32
  $it.errSchemaPath = $errSchemaPath + '/' + $i;
@@ -18,9 +18,9 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
18
18
  $dataNxt = $it.dataLevel = it.dataLevel + 1,
19
19
  $nextData = 'data' + $dataNxt,
20
20
  $dataProperties = 'dataProperties' + $lvl;
21
- var $schemaKeys = Object.keys($schema || {}),
21
+ var $schemaKeys = Object.keys($schema || {}).filter(notProto),
22
22
  $pProperties = it.schema.patternProperties || {},
23
- $pPropertyKeys = Object.keys($pProperties),
23
+ $pPropertyKeys = Object.keys($pProperties).filter(notProto),
24
24
  $aProperties = it.schema.additionalProperties,
25
25
  $someProperties = $schemaKeys.length || $pPropertyKeys.length,
26
26
  $noAdditional = $aProperties === false,
@@ -30,7 +30,13 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
30
30
  $ownProperties = it.opts.ownProperties,
31
31
  $currentBaseId = it.baseId;
32
32
  var $required = it.schema.required;
33
- if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($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
+ }
34
40
  out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
35
41
  if ($ownProperties) {
36
42
  out += ' var ' + ($dataProperties) + ' = undefined;';
@@ -183,7 +189,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
183
189
  while (i3 < l3) {
184
190
  $propertyKey = arr3[i3 += 1];
185
191
  var $sch = $schema[$propertyKey];
186
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
192
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
187
193
  var $prop = it.util.getProperty($propertyKey),
188
194
  $passData = $data + $prop,
189
195
  $hasDefault = $useDefaults && $sch.default !== undefined;
@@ -286,7 +292,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
286
292
  while (i4 < l4) {
287
293
  $pProperty = arr4[i4 += 1];
288
294
  var $sch = $pProperties[$pProperty];
289
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
295
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
290
296
  $it.schema = $sch;
291
297
  $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
292
298
  $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
@@ -325,6 +331,5 @@ module.exports = function generate_properties(it, $keyword, $ruleType) {
325
331
  if ($breakOnError) {
326
332
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
327
333
  }
328
- out = it.util.cleanUpCode(out);
329
334
  return out;
330
335
  }
@@ -14,7 +14,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
14
14
  $it.level++;
15
15
  var $nextValid = 'valid' + $it.level;
16
16
  out += 'var ' + ($errs) + ' = errors;';
17
- if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
17
+ if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
18
18
  $it.schema = $schema;
19
19
  $it.schemaPath = $schemaPath;
20
20
  $it.errSchemaPath = $errSchemaPath;
@@ -77,6 +77,5 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) {
77
77
  if ($breakOnError) {
78
78
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
79
79
  }
80
- out = it.util.cleanUpCode(out);
81
80
  return out;
82
81
  }
@@ -28,7 +28,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) {
28
28
  while (i1 < l1) {
29
29
  $property = arr1[i1 += 1];
30
30
  var $propertySch = it.schema.properties[$property];
31
- if (!($propertySch && (it.opts.strictKeywords ? typeof $propertySch == 'object' && Object.keys($propertySch).length > 0 : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
31
+ if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
32
32
  $required[$required.length] = $property;
33
33
  }
34
34
  }
@@ -29,7 +29,7 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) {
29
29
  } else {
30
30
  out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
31
31
  var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
32
- out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
32
+ out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
33
33
  if ($typeIsArray) {
34
34
  out += ' if (typeof item == \'string\') item = \'"\' + item; ';
35
35
  }
@@ -91,7 +91,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
91
91
  it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
92
92
  it.baseId = it.baseId || it.rootId;
93
93
  delete it.isTop;
94
- it.dataPathArr = [undefined];
94
+ it.dataPathArr = [""];
95
95
  if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
96
96
  var $defaultMsg = 'default is ignored in the schema root';
97
97
  if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
@@ -149,47 +149,39 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
149
149
  var $schemaPath = it.schemaPath + '.type',
150
150
  $errSchemaPath = it.errSchemaPath + '/type',
151
151
  $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
152
- out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
152
+ out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
153
153
  if ($coerceToTypes) {
154
154
  var $dataType = 'dataType' + $lvl,
155
155
  $coerced = 'coerced' + $lvl;
156
- out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
156
+ out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
157
157
  if (it.opts.coerceTypes == 'array') {
158
- out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; ';
158
+ 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) + '; } ';
159
159
  }
160
- out += ' var ' + ($coerced) + ' = undefined; ';
161
- var $bracesCoercion = '';
160
+ out += ' if (' + ($coerced) + ' !== undefined) ; ';
162
161
  var arr1 = $coerceToTypes;
163
162
  if (arr1) {
164
163
  var $type, $i = -1,
165
164
  l1 = arr1.length - 1;
166
165
  while ($i < l1) {
167
166
  $type = arr1[$i += 1];
168
- if ($i) {
169
- out += ' if (' + ($coerced) + ' === undefined) { ';
170
- $bracesCoercion += '}';
171
- }
172
- if (it.opts.coerceTypes == 'array' && $type != 'array') {
173
- out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
174
- }
175
167
  if ($type == 'string') {
176
- out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
168
+ out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
177
169
  } else if ($type == 'number' || $type == 'integer') {
178
- out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
170
+ out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
179
171
  if ($type == 'integer') {
180
172
  out += ' && !(' + ($data) + ' % 1)';
181
173
  }
182
174
  out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
183
175
  } else if ($type == 'boolean') {
184
- out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
176
+ out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
185
177
  } else if ($type == 'null') {
186
- out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
178
+ out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
187
179
  } else if (it.opts.coerceTypes == 'array' && $type == 'array') {
188
- out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
180
+ out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
189
181
  }
190
182
  }
191
183
  }
192
- out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { ';
184
+ out += ' else { ';
193
185
  var $$outStack = $$outStack || [];
194
186
  $$outStack.push(out);
195
187
  out = ''; /* istanbul ignore else */
@@ -229,7 +221,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
229
221
  } else {
230
222
  out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
231
223
  }
232
- out += ' } else { ';
224
+ out += ' } if (' + ($coerced) + ' !== undefined) { ';
233
225
  var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
234
226
  $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
235
227
  out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
@@ -302,7 +294,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
302
294
  $rulesGroup = arr2[i2 += 1];
303
295
  if ($shouldUseGroup($rulesGroup)) {
304
296
  if ($rulesGroup.type) {
305
- out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
297
+ out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
306
298
  }
307
299
  if (it.opts.useDefaults) {
308
300
  if ($rulesGroup.type == 'object' && it.schema.properties) {
@@ -470,10 +462,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
470
462
  } else {
471
463
  out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
472
464
  }
473
- out = it.util.cleanUpCode(out);
474
- if ($top) {
475
- out = it.util.finalCleanUpCode(out, $async);
476
- }
477
465
 
478
466
  function $shouldUseGroup($rulesGroup) {
479
467
  var rules = $rulesGroup.rules;
@@ -46,7 +46,7 @@ function addKeyword(keyword, definition) {
46
46
  metaSchema = {
47
47
  anyOf: [
48
48
  metaSchema,
49
- { '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
49
+ { '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
50
50
  ]
51
51
  };
52
52
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#",
3
+ "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
4
4
  "description": "Meta-schema for $data reference (JSON Schema extension proposal)",
5
5
  "type": "object",
6
6
  "required": [ "$data" ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-secure.json#",
3
+ "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#",
4
4
  "title": "Meta-schema for the security assessment of JSON Schemas",
5
5
  "description": "If a JSON Schema fails validation against this meta-schema, it may be unsafe to validate untrusted data",
6
6
  "definitions": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ajv",
3
- "version": "6.12.0",
3
+ "version": "6.12.6",
4
4
  "description": "Another JSON Schema Validator",
5
5
  "main": "lib/ajv.js",
6
6
  "typings": "lib/ajv.d.ts",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "https://github.com/epoberezkin/ajv.git"
45
+ "url": "https://github.com/ajv-validator/ajv.git"
46
46
  },
47
47
  "keywords": [
48
48
  "JSON",
@@ -57,9 +57,9 @@
57
57
  "author": "Evgeny Poberezkin",
58
58
  "license": "MIT",
59
59
  "bugs": {
60
- "url": "https://github.com/epoberezkin/ajv/issues"
60
+ "url": "https://github.com/ajv-validator/ajv/issues"
61
61
  },
62
- "homepage": "https://github.com/epoberezkin/ajv",
62
+ "homepage": "https://github.com/ajv-validator/ajv",
63
63
  "tonicExampleFilename": ".tonic_example.js",
64
64
  "dependencies": {
65
65
  "fast-deep-equal": "^3.1.1",
@@ -76,23 +76,31 @@
76
76
  "coveralls": "^3.0.1",
77
77
  "del-cli": "^3.0.0",
78
78
  "dot": "^1.0.3",
79
- "eslint": "^6.0.0",
79
+ "eslint": "^7.3.1",
80
80
  "gh-pages-generator": "^0.2.3",
81
81
  "glob": "^7.0.0",
82
82
  "if-node-version": "^1.0.0",
83
83
  "js-beautify": "^1.7.3",
84
84
  "jshint": "^2.10.2",
85
85
  "json-schema-test": "^2.0.0",
86
- "karma": "^4.0.1",
86
+ "karma": "^5.0.0",
87
87
  "karma-chrome-launcher": "^3.0.0",
88
- "karma-mocha": "^1.1.1",
89
- "karma-sauce-launcher": "^2.0.0",
90
- "mocha": "^7.0.1",
88
+ "karma-mocha": "^2.0.0",
89
+ "karma-sauce-launcher": "^4.1.3",
90
+ "mocha": "^8.0.1",
91
91
  "nyc": "^15.0.0",
92
92
  "pre-commit": "^1.1.1",
93
93
  "require-globify": "^1.3.0",
94
- "typescript": "^2.8.3",
94
+ "typescript": "^3.9.5",
95
95
  "uglify-js": "^3.6.9",
96
96
  "watch": "^1.0.0"
97
+ },
98
+ "collective": {
99
+ "type": "opencollective",
100
+ "url": "https://opencollective.com/ajv"
101
+ },
102
+ "funding": {
103
+ "type": "github",
104
+ "url": "https://github.com/sponsors/epoberezkin"
97
105
  }
98
106
  }
File without changes
File without changes
@@ -8,7 +8,7 @@ if [[ -n $TRAVIS_TAG && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
8
8
  git config user.email "$GIT_USER_EMAIL"
9
9
  git config user.name "$GIT_USER_NAME"
10
10
 
11
- git clone https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv-dist.git ../ajv-dist
11
+ git clone https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv-dist.git ../ajv-dist
12
12
 
13
13
  rm -rf ../ajv-dist/dist
14
14
  mkdir ../ajv-dist/dist
@@ -5,7 +5,7 @@ set -e
5
5
  if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then
6
6
  git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && {
7
7
  rm -rf ../gh-pages
8
- git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages
8
+ git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv.git ../gh-pages
9
9
  mkdir -p ../gh-pages/_source
10
10
  cp *.md ../gh-pages/_source
11
11
  cp LICENSE ../gh-pages/_source
@@ -1,2 +1,2 @@
1
- const equal: (a: any, b: any) => boolean;
1
+ declare const equal: (a: any, b: any) => boolean;
2
2
  export = equal;
@@ -1,2 +1,2 @@
1
- const equal: (a: any, b: any) => boolean;
1
+ declare const equal: (a: any, b: any) => boolean;
2
2
  export = equal;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-deep-equal",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "Fast deep equal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,16 +29,16 @@
29
29
  },
30
30
  "homepage": "https://github.com/epoberezkin/fast-deep-equal#readme",
31
31
  "devDependencies": {
32
- "coveralls": "^2.13.1",
32
+ "coveralls": "^3.1.0",
33
33
  "dot": "^1.1.2",
34
- "eslint": "^4.0.0",
35
- "mocha": "^3.4.2",
36
- "nyc": "^11.0.2",
34
+ "eslint": "^7.2.0",
35
+ "mocha": "^7.2.0",
36
+ "nyc": "^15.1.0",
37
37
  "pre-commit": "^1.2.2",
38
38
  "react": "^16.12.0",
39
39
  "react-test-renderer": "^16.12.0",
40
- "sinon": "^7.5.0",
41
- "typescript": "^2.6.1"
40
+ "sinon": "^9.0.2",
41
+ "typescript": "^3.9.5"
42
42
  },
43
43
  "nyc": {
44
44
  "exclude": [
@@ -1,2 +1,2 @@
1
- const equal: (a: any, b: any) => boolean;
1
+ declare const equal: (a: any, b: any) => boolean;
2
2
  export = equal;
@@ -0,0 +1,11 @@
1
+ Copyright 2011 Gary Court. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10
+
11
+ The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court.
@@ -3,7 +3,7 @@
3
3
  URI.js is an [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) compliant, scheme extendable URI parsing/validating/resolving library for all JavaScript environments (browsers, Node.js, etc).
4
4
  It is also compliant with the IRI ([RFC 3987](http://www.ietf.org/rfc/rfc3987.txt)), IDNA ([RFC 5890](http://www.ietf.org/rfc/rfc5890.txt)), IPv6 Address ([RFC 5952](http://www.ietf.org/rfc/rfc5952.txt)), IPv6 Zone Identifier ([RFC 6874](http://www.ietf.org/rfc/rfc6874.txt)) specifications.
5
5
 
6
- URI.js has an extensive test suite, and works in all (Node.js, web) environments. It weighs in at 6.2kb (gzipped, 16kb deflated).
6
+ URI.js has an extensive test suite, and works in all (Node.js, web) environments. It weighs in at 6.4kb (gzipped, 17kb deflated).
7
7
 
8
8
  ## API
9
9
 
@@ -97,13 +97,29 @@ URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_schem
97
97
 
98
98
  * http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
99
99
  * https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
100
+ * ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
101
+ * wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
100
102
  * mailto \[[RFC 6068](http://www.ietf.org/rfc/rfc6068.txt)\]
101
103
  * urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\]
102
104
  * urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\]
103
105
 
104
- ### HTTP Support
106
+ ### HTTP/HTTPS Support
105
107
 
106
108
  URI.equal("HTTP://ABC.COM:80", "http://abc.com/") === true
109
+ URI.equal("https://abc.com", "HTTPS://ABC.COM:443/") === true
110
+
111
+ ### WS/WSS Support
112
+
113
+ URI.parse("wss://example.com/foo?bar=baz");
114
+ //returns:
115
+ //{
116
+ // scheme : "wss",
117
+ // host: "example.com",
118
+ // resourceName: "/foo?bar=baz",
119
+ // secure: true,
120
+ //}
121
+
122
+ URI.equal("WS://ABC.COM:80/chat#one", "ws://abc.com/chat") === true
107
123
 
108
124
  ### Mailto Support
109
125
 
@@ -142,7 +158,7 @@ URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_schem
142
158
  //returns:
143
159
  //{
144
160
  // scheme : "urn",
145
- // nid : "example",
161
+ // nid : "uuid",
146
162
  // uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
147
163
  //}
148
164
 
@@ -152,9 +168,11 @@ To load in a browser, use the following tag:
152
168
 
153
169
  <script type="text/javascript" src="uri-js/dist/es5/uri.all.min.js"></script>
154
170
 
155
- To load in a CommonJS (Node.js) environment, first install with npm by running on the command line:
171
+ To load in a CommonJS/Module environment, first install with npm/yarn by running on the command line:
156
172
 
157
173
  npm install uri-js
174
+ # OR
175
+ yarn add uri-js
158
176
 
159
177
  Then, in your code, load it using:
160
178
 
@@ -183,17 +201,3 @@ URI validation has been removed as it was slow, exposed a vulnerabilty, and was
183
201
  ### Breaking changes from 1.x
184
202
 
185
203
  The `errors` array on parsed components is now an `error` string.
186
-
187
- ## License ([Simplified BSD](http://en.wikipedia.org/wiki/BSD_licenses#2-clause))
188
-
189
- Copyright 2011 Gary Court. All rights reserved.
190
-
191
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
192
-
193
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
194
-
195
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
196
-
197
- THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
198
-
199
- The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court.
@@ -1,59 +1,59 @@
1
- export interface URIComponents {
2
- scheme?: string;
3
- userinfo?: string;
4
- host?: string;
5
- port?: number | string;
6
- path?: string;
7
- query?: string;
8
- fragment?: string;
9
- reference?: string;
10
- error?: string;
11
- }
12
- export interface URIOptions {
13
- scheme?: string;
14
- reference?: string;
15
- tolerant?: boolean;
16
- absolutePath?: boolean;
17
- iri?: boolean;
18
- unicodeSupport?: boolean;
19
- domainHost?: boolean;
20
- }
21
- export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
22
- scheme: string;
23
- parse(components: ParentComponents, options: Options): Components;
24
- serialize(components: Components, options: Options): ParentComponents;
25
- unicodeSupport?: boolean;
26
- domainHost?: boolean;
27
- absolutePath?: boolean;
28
- }
29
- export interface URIRegExps {
30
- NOT_SCHEME: RegExp;
31
- NOT_USERINFO: RegExp;
32
- NOT_HOST: RegExp;
33
- NOT_PATH: RegExp;
34
- NOT_PATH_NOSCHEME: RegExp;
35
- NOT_QUERY: RegExp;
36
- NOT_FRAGMENT: RegExp;
37
- ESCAPE: RegExp;
38
- UNRESERVED: RegExp;
39
- OTHER_CHARS: RegExp;
40
- PCT_ENCODED: RegExp;
41
- IPV4ADDRESS: RegExp;
42
- IPV6ADDRESS: RegExp;
43
- }
44
- export declare const SCHEMES: {
45
- [scheme: string]: URISchemeHandler;
46
- };
47
- export declare function pctEncChar(chr: string): string;
48
- export declare function pctDecChars(str: string): string;
49
- export declare function parse(uriString: string, options?: URIOptions): URIComponents;
50
- export declare function removeDotSegments(input: string): string;
51
- export declare function serialize(components: URIComponents, options?: URIOptions): string;
52
- export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
53
- export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
54
- export declare function normalize(uri: string, options?: URIOptions): string;
55
- export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
56
- export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
57
- export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
58
- export declare function escapeComponent(str: string, options?: URIOptions): string;
59
- export declare function unescapeComponent(str: string, options?: URIOptions): string;
1
+ export interface URIComponents {
2
+ scheme?: string;
3
+ userinfo?: string;
4
+ host?: string;
5
+ port?: number | string;
6
+ path?: string;
7
+ query?: string;
8
+ fragment?: string;
9
+ reference?: string;
10
+ error?: string;
11
+ }
12
+ export interface URIOptions {
13
+ scheme?: string;
14
+ reference?: string;
15
+ tolerant?: boolean;
16
+ absolutePath?: boolean;
17
+ iri?: boolean;
18
+ unicodeSupport?: boolean;
19
+ domainHost?: boolean;
20
+ }
21
+ export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
22
+ scheme: string;
23
+ parse(components: ParentComponents, options: Options): Components;
24
+ serialize(components: Components, options: Options): ParentComponents;
25
+ unicodeSupport?: boolean;
26
+ domainHost?: boolean;
27
+ absolutePath?: boolean;
28
+ }
29
+ export interface URIRegExps {
30
+ NOT_SCHEME: RegExp;
31
+ NOT_USERINFO: RegExp;
32
+ NOT_HOST: RegExp;
33
+ NOT_PATH: RegExp;
34
+ NOT_PATH_NOSCHEME: RegExp;
35
+ NOT_QUERY: RegExp;
36
+ NOT_FRAGMENT: RegExp;
37
+ ESCAPE: RegExp;
38
+ UNRESERVED: RegExp;
39
+ OTHER_CHARS: RegExp;
40
+ PCT_ENCODED: RegExp;
41
+ IPV4ADDRESS: RegExp;
42
+ IPV6ADDRESS: RegExp;
43
+ }
44
+ export declare const SCHEMES: {
45
+ [scheme: string]: URISchemeHandler;
46
+ };
47
+ export declare function pctEncChar(chr: string): string;
48
+ export declare function pctDecChars(str: string): string;
49
+ export declare function parse(uriString: string, options?: URIOptions): URIComponents;
50
+ export declare function removeDotSegments(input: string): string;
51
+ export declare function serialize(components: URIComponents, options?: URIOptions): string;
52
+ export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
53
+ export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
54
+ export declare function normalize(uri: string, options?: URIOptions): string;
55
+ export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
56
+ export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
57
+ export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
58
+ export declare function escapeComponent(str: string, options?: URIOptions): string;
59
+ export declare function unescapeComponent(str: string, options?: URIOptions): string;