@hpcc-js/marshaller 2.23.105 → 2.23.106

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.
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  }(this, (function (exports, comms, common, util$1, chart, dgrid, form, graph, map, layout, phosphor, codemirror, other) { 'use strict';
6
6
 
7
7
  var PKG_NAME = "@hpcc-js/marshaller";
8
- var PKG_VERSION = "2.23.105";
9
- var BUILD_VERSION = "2.99.0";
8
+ var PKG_VERSION = "2.23.106";
9
+ var BUILD_VERSION = "2.100.0";
10
10
 
11
11
  /*! *****************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -2318,7 +2318,7 @@
2318
2318
  DSPicker.prototype._class += " DSPicker";
2319
2319
 
2320
2320
  var PKG_NAME$1 = "@hpcc-js/ddl-shim";
2321
- var PKG_VERSION$1 = "2.17.23";
2321
+ var PKG_VERSION$1 = "2.17.24";
2322
2322
 
2323
2323
  function isWorkunitDatasource(ref) {
2324
2324
  return ref.WUID !== undefined;
@@ -4788,21 +4788,18 @@
4788
4788
 
4789
4789
  unwrapExports(uri_all);
4790
4790
 
4791
- var isArray = Array.isArray;
4792
- var keyList = Object.keys;
4793
- var hasProp = Object.prototype.hasOwnProperty;
4791
+ // do not edit .js files directly - edit src/index.jst
4792
+
4793
+
4794
4794
 
4795
4795
  var fastDeepEqual = function equal(a, b) {
4796
4796
  if (a === b) return true;
4797
4797
 
4798
4798
  if (a && b && typeof a == 'object' && typeof b == 'object') {
4799
- var arrA = isArray(a)
4800
- , arrB = isArray(b)
4801
- , i
4802
- , length
4803
- , key;
4799
+ if (a.constructor !== b.constructor) return false;
4804
4800
 
4805
- if (arrA && arrB) {
4801
+ var length, i, keys;
4802
+ if (Array.isArray(a)) {
4806
4803
  length = a.length;
4807
4804
  if (length != b.length) return false;
4808
4805
  for (i = length; i-- !== 0;)
@@ -4810,35 +4807,29 @@
4810
4807
  return true;
4811
4808
  }
4812
4809
 
4813
- if (arrA != arrB) return false;
4814
4810
 
4815
- var dateA = a instanceof Date
4816
- , dateB = b instanceof Date;
4817
- if (dateA != dateB) return false;
4818
- if (dateA && dateB) return a.getTime() == b.getTime();
4819
4811
 
4820
- var regexpA = a instanceof RegExp
4821
- , regexpB = b instanceof RegExp;
4822
- if (regexpA != regexpB) return false;
4823
- if (regexpA && regexpB) return a.toString() == b.toString();
4812
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
4813
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
4814
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
4824
4815
 
4825
- var keys = keyList(a);
4816
+ keys = Object.keys(a);
4826
4817
  length = keys.length;
4827
-
4828
- if (length !== keyList(b).length)
4829
- return false;
4818
+ if (length !== Object.keys(b).length) return false;
4830
4819
 
4831
4820
  for (i = length; i-- !== 0;)
4832
- if (!hasProp.call(b, keys[i])) return false;
4821
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
4833
4822
 
4834
4823
  for (i = length; i-- !== 0;) {
4835
- key = keys[i];
4824
+ var key = keys[i];
4825
+
4836
4826
  if (!equal(a[key], b[key])) return false;
4837
4827
  }
4838
4828
 
4839
4829
  return true;
4840
4830
  }
4841
4831
 
4832
+ // true if both NaN, false otherwise
4842
4833
  return a!==a && b!==b;
4843
4834
  };
4844
4835
 
@@ -4873,8 +4864,6 @@
4873
4864
  ucs2length: ucs2length,
4874
4865
  varOccurences: varOccurences,
4875
4866
  varReplace: varReplace,
4876
- cleanUpCode: cleanUpCode,
4877
- finalCleanUpCode: finalCleanUpCode,
4878
4867
  schemaHasRules: schemaHasRules,
4879
4868
  schemaHasRulesExcept: schemaHasRulesExcept,
4880
4869
  schemaUnknownRules: schemaUnknownRules,
@@ -4896,7 +4885,7 @@
4896
4885
  }
4897
4886
 
4898
4887
 
4899
- function checkDataType(dataType, data, negate) {
4888
+ function checkDataType(dataType, data, strictNumbers, negate) {
4900
4889
  var EQUAL = negate ? ' !== ' : ' === '
4901
4890
  , AND = negate ? ' || ' : ' && '
4902
4891
  , OK = negate ? '!' : ''
@@ -4909,15 +4898,18 @@
4909
4898
  NOT + 'Array.isArray(' + data + '))';
4910
4899
  case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
4911
4900
  NOT + '(' + data + ' % 1)' +
4912
- AND + data + EQUAL + data + ')';
4901
+ AND + data + EQUAL + data +
4902
+ (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
4903
+ case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
4904
+ (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
4913
4905
  default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
4914
4906
  }
4915
4907
  }
4916
4908
 
4917
4909
 
4918
- function checkDataTypes(dataTypes, data) {
4910
+ function checkDataTypes(dataTypes, data, strictNumbers) {
4919
4911
  switch (dataTypes.length) {
4920
- case 1: return checkDataType(dataTypes[0], data, true);
4912
+ case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
4921
4913
  default:
4922
4914
  var code = '';
4923
4915
  var types = toHash(dataTypes);
@@ -4930,7 +4922,7 @@
4930
4922
  }
4931
4923
  if (types.number) delete types.integer;
4932
4924
  for (var t in types)
4933
- code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
4925
+ code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
4934
4926
 
4935
4927
  return code;
4936
4928
  }
@@ -4996,42 +4988,6 @@
4996
4988
  }
4997
4989
 
4998
4990
 
4999
- var EMPTY_ELSE = /else\s*{\s*}/g
5000
- , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
5001
- , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
5002
- function cleanUpCode(out) {
5003
- return out.replace(EMPTY_ELSE, '')
5004
- .replace(EMPTY_IF_NO_ELSE, '')
5005
- .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
5006
- }
5007
-
5008
-
5009
- var ERRORS_REGEXP = /[^v.]errors/g
5010
- , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
5011
- , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
5012
- , RETURN_VALID = 'return errors === 0;'
5013
- , RETURN_TRUE = 'validate.errors = null; return true;'
5014
- , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
5015
- , RETURN_DATA_ASYNC = 'return data;'
5016
- , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
5017
- , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
5018
-
5019
- function finalCleanUpCode(out, async) {
5020
- var matches = out.match(ERRORS_REGEXP);
5021
- if (matches && matches.length == 2) {
5022
- out = async
5023
- ? out.replace(REMOVE_ERRORS_ASYNC, '')
5024
- .replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
5025
- : out.replace(REMOVE_ERRORS, '')
5026
- .replace(RETURN_VALID, RETURN_TRUE);
5027
- }
5028
-
5029
- matches = out.match(ROOTDATA_REGEXP);
5030
- if (!matches || matches.length !== 3) return out;
5031
- return out.replace(REMOVE_ROOTDATA, '');
5032
- }
5033
-
5034
-
5035
4991
  function schemaHasRules(schema, rules) {
5036
4992
  if (typeof schema == 'boolean') return !schema;
5037
4993
  for (var key in schema) if (rules[key]) return true;
@@ -5110,7 +5066,7 @@
5110
5066
 
5111
5067
  function joinPaths (a, b) {
5112
5068
  if (a == '""') return b;
5113
- return (a + ' + ' + b).replace(/' \+ '/g, '');
5069
+ return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
5114
5070
  }
5115
5071
 
5116
5072
 
@@ -5674,7 +5630,7 @@
5674
5630
  it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
5675
5631
  it.baseId = it.baseId || it.rootId;
5676
5632
  delete it.isTop;
5677
- it.dataPathArr = [undefined];
5633
+ it.dataPathArr = [""];
5678
5634
  if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
5679
5635
  var $defaultMsg = 'default is ignored in the schema root';
5680
5636
  if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
@@ -5732,47 +5688,39 @@
5732
5688
  var $schemaPath = it.schemaPath + '.type',
5733
5689
  $errSchemaPath = it.errSchemaPath + '/type',
5734
5690
  $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
5735
- out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
5691
+ out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
5736
5692
  if ($coerceToTypes) {
5737
5693
  var $dataType = 'dataType' + $lvl,
5738
5694
  $coerced = 'coerced' + $lvl;
5739
- out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
5695
+ out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
5740
5696
  if (it.opts.coerceTypes == 'array') {
5741
- out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; ';
5697
+ 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) + '; } ';
5742
5698
  }
5743
- out += ' var ' + ($coerced) + ' = undefined; ';
5744
- var $bracesCoercion = '';
5699
+ out += ' if (' + ($coerced) + ' !== undefined) ; ';
5745
5700
  var arr1 = $coerceToTypes;
5746
5701
  if (arr1) {
5747
5702
  var $type, $i = -1,
5748
5703
  l1 = arr1.length - 1;
5749
5704
  while ($i < l1) {
5750
5705
  $type = arr1[$i += 1];
5751
- if ($i) {
5752
- out += ' if (' + ($coerced) + ' === undefined) { ';
5753
- $bracesCoercion += '}';
5754
- }
5755
- if (it.opts.coerceTypes == 'array' && $type != 'array') {
5756
- out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
5757
- }
5758
5706
  if ($type == 'string') {
5759
- out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
5707
+ out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
5760
5708
  } else if ($type == 'number' || $type == 'integer') {
5761
- out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
5709
+ out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
5762
5710
  if ($type == 'integer') {
5763
5711
  out += ' && !(' + ($data) + ' % 1)';
5764
5712
  }
5765
5713
  out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
5766
5714
  } else if ($type == 'boolean') {
5767
- out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
5715
+ out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
5768
5716
  } else if ($type == 'null') {
5769
- out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
5717
+ out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
5770
5718
  } else if (it.opts.coerceTypes == 'array' && $type == 'array') {
5771
- out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
5719
+ out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
5772
5720
  }
5773
5721
  }
5774
5722
  }
5775
- out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { ';
5723
+ out += ' else { ';
5776
5724
  var $$outStack = $$outStack || [];
5777
5725
  $$outStack.push(out);
5778
5726
  out = ''; /* istanbul ignore else */
@@ -5812,7 +5760,7 @@
5812
5760
  } else {
5813
5761
  out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
5814
5762
  }
5815
- out += ' } else { ';
5763
+ out += ' } if (' + ($coerced) + ' !== undefined) { ';
5816
5764
  var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
5817
5765
  $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
5818
5766
  out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
@@ -5885,7 +5833,7 @@
5885
5833
  $rulesGroup = arr2[i2 += 1];
5886
5834
  if ($shouldUseGroup($rulesGroup)) {
5887
5835
  if ($rulesGroup.type) {
5888
- out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
5836
+ out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
5889
5837
  }
5890
5838
  if (it.opts.useDefaults) {
5891
5839
  if ($rulesGroup.type == 'object' && it.schema.properties) {
@@ -6053,10 +6001,6 @@
6053
6001
  } else {
6054
6002
  out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
6055
6003
  }
6056
- out = it.util.cleanUpCode(out);
6057
- if ($top) {
6058
- out = it.util.finalCleanUpCode(out, $async);
6059
- }
6060
6004
 
6061
6005
  function $shouldUseGroup($rulesGroup) {
6062
6006
  var rules = $rulesGroup.rules;
@@ -6182,7 +6126,7 @@
6182
6126
  + vars(defaults, defaultCode) + vars(customRules, customRuleCode)
6183
6127
  + sourceCode;
6184
6128
 
6185
- if (opts.processCode) sourceCode = opts.processCode(sourceCode);
6129
+ if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
6186
6130
  // console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
6187
6131
  var validate$1;
6188
6132
  try {
@@ -6485,8 +6429,8 @@
6485
6429
 
6486
6430
  var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
6487
6431
  var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
6488
- var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
6489
- var HOSTNAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i;
6432
+ var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
6433
+ var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
6490
6434
  var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
6491
6435
  var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
6492
6436
  // uri-template: https://tools.ietf.org/html/rfc6570
@@ -6494,8 +6438,8 @@
6494
6438
  // For the source: https://gist.github.com/dperini/729294
6495
6439
  // For test cases: https://mathiasbynens.be/demo/url-regex
6496
6440
  // @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
6497
- // 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;
6498
- 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;
6441
+ // 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;
6442
+ 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;
6499
6443
  var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
6500
6444
  var JSON_POINTER$1 = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
6501
6445
  var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
@@ -6514,11 +6458,11 @@
6514
6458
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
6515
6459
  date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
6516
6460
  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
6517
- time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,
6518
- '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,
6461
+ time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
6462
+ '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,
6519
6463
  // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
6520
- uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,
6521
- 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
6464
+ uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
6465
+ 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
6522
6466
  'uri-template': URITEMPLATE,
6523
6467
  url: URL,
6524
6468
  // email (sources from jsen validator):
@@ -6551,7 +6495,7 @@
6551
6495
  'uri-template': URITEMPLATE,
6552
6496
  url: URL,
6553
6497
  email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
6554
- hostname: hostname,
6498
+ hostname: HOSTNAME,
6555
6499
  ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
6556
6500
  ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
6557
6501
  regex: regex,
@@ -6604,13 +6548,6 @@
6604
6548
  }
6605
6549
 
6606
6550
 
6607
- function hostname(str) {
6608
- // https://tools.ietf.org/html/rfc1034#section-3.5
6609
- // https://tools.ietf.org/html/rfc1123#section-2
6610
- return str.length <= 255 && HOSTNAME.test(str);
6611
- }
6612
-
6613
-
6614
6551
  var NOT_URI_FRAGMENT = /\/|:/;
6615
6552
  function uri(str) {
6616
6553
  // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
@@ -6771,7 +6708,7 @@
6771
6708
  l1 = arr1.length - 1;
6772
6709
  while ($i < l1) {
6773
6710
  $sch = arr1[$i += 1];
6774
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
6711
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
6775
6712
  $allSchemasEmpty = false;
6776
6713
  $it.schema = $sch;
6777
6714
  $it.schemaPath = $schemaPath + '[' + $i + ']';
@@ -6792,7 +6729,6 @@
6792
6729
  out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
6793
6730
  }
6794
6731
  }
6795
- out = it.util.cleanUpCode(out);
6796
6732
  return out;
6797
6733
  };
6798
6734
 
@@ -6812,7 +6748,7 @@
6812
6748
  $it.level++;
6813
6749
  var $nextValid = 'valid' + $it.level;
6814
6750
  var $noEmptySchema = $schema.every(function($sch) {
6815
- return it.util.schemaHasRules($sch, it.RULES.all);
6751
+ return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
6816
6752
  });
6817
6753
  if ($noEmptySchema) {
6818
6754
  var $currentBaseId = $it.baseId;
@@ -6861,7 +6797,6 @@
6861
6797
  if (it.opts.allErrors) {
6862
6798
  out += ' } ';
6863
6799
  }
6864
- out = it.util.cleanUpCode(out);
6865
6800
  } else {
6866
6801
  if ($breakOnError) {
6867
6802
  out += ' if (true) { ';
@@ -6955,7 +6890,7 @@
6955
6890
  $dataNxt = $it.dataLevel = it.dataLevel + 1,
6956
6891
  $nextData = 'data' + $dataNxt,
6957
6892
  $currentBaseId = it.baseId,
6958
- $nonEmptySchema = it.util.schemaHasRules($schema, it.RULES.all);
6893
+ $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
6959
6894
  out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
6960
6895
  if ($nonEmptySchema) {
6961
6896
  var $wasComposite = it.compositeRule;
@@ -7014,7 +6949,6 @@
7014
6949
  if (it.opts.allErrors) {
7015
6950
  out += ' } ';
7016
6951
  }
7017
- out = it.util.cleanUpCode(out);
7018
6952
  return out;
7019
6953
  };
7020
6954
 
@@ -7036,6 +6970,7 @@
7036
6970
  $propertyDeps = {},
7037
6971
  $ownProperties = it.opts.ownProperties;
7038
6972
  for ($property in $schema) {
6973
+ if ($property == '__proto__') continue;
7039
6974
  var $sch = $schema[$property];
7040
6975
  var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
7041
6976
  $deps[$property] = $sch;
@@ -7161,7 +7096,7 @@
7161
7096
  var $currentBaseId = $it.baseId;
7162
7097
  for (var $property in $schemaDeps) {
7163
7098
  var $sch = $schemaDeps[$property];
7164
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
7099
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
7165
7100
  out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
7166
7101
  if ($ownProperties) {
7167
7102
  out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
@@ -7182,7 +7117,6 @@
7182
7117
  if ($breakOnError) {
7183
7118
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
7184
7119
  }
7185
- out = it.util.cleanUpCode(out);
7186
7120
  return out;
7187
7121
  };
7188
7122
 
@@ -7414,8 +7348,8 @@
7414
7348
  var $nextValid = 'valid' + $it.level;
7415
7349
  var $thenSch = it.schema['then'],
7416
7350
  $elseSch = it.schema['else'],
7417
- $thenPresent = $thenSch !== undefined && it.util.schemaHasRules($thenSch, it.RULES.all),
7418
- $elsePresent = $elseSch !== undefined && it.util.schemaHasRules($elseSch, it.RULES.all),
7351
+ $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
7352
+ $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
7419
7353
  $currentBaseId = $it.baseId;
7420
7354
  if ($thenPresent || $elsePresent) {
7421
7355
  var $ifClause;
@@ -7493,7 +7427,6 @@
7493
7427
  if ($breakOnError) {
7494
7428
  out += ' else { ';
7495
7429
  }
7496
- out = it.util.cleanUpCode(out);
7497
7430
  } else {
7498
7431
  if ($breakOnError) {
7499
7432
  out += ' if (true) { ';
@@ -7569,7 +7502,7 @@
7569
7502
  l1 = arr1.length - 1;
7570
7503
  while ($i < l1) {
7571
7504
  $sch = arr1[$i += 1];
7572
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
7505
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
7573
7506
  out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
7574
7507
  var $passData = $data + '[' + $i + ']';
7575
7508
  $it.schema = $sch;
@@ -7592,7 +7525,7 @@
7592
7525
  }
7593
7526
  }
7594
7527
  }
7595
- if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) {
7528
+ if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
7596
7529
  $it.schema = $additionalItems;
7597
7530
  $it.schemaPath = it.schemaPath + '.additionalItems';
7598
7531
  $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
@@ -7616,7 +7549,7 @@
7616
7549
  $closingBraces += '}';
7617
7550
  }
7618
7551
  }
7619
- } else if (it.util.schemaHasRules($schema, it.RULES.all)) {
7552
+ } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
7620
7553
  $it.schema = $schema;
7621
7554
  $it.schemaPath = $schemaPath;
7622
7555
  $it.errSchemaPath = $errSchemaPath;
@@ -7639,7 +7572,6 @@
7639
7572
  if ($breakOnError) {
7640
7573
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
7641
7574
  }
7642
- out = it.util.cleanUpCode(out);
7643
7575
  return out;
7644
7576
  };
7645
7577
 
@@ -7668,6 +7600,12 @@
7668
7600
  $op = $isMax ? '<' : '>',
7669
7601
  $notOp = $isMax ? '>' : '<',
7670
7602
  $errorKeyword = undefined;
7603
+ if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
7604
+ throw new Error($keyword + ' must be number');
7605
+ }
7606
+ if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
7607
+ throw new Error($exclusiveKeyword + ' must be number or boolean');
7608
+ }
7671
7609
  if ($isDataExcl) {
7672
7610
  var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
7673
7611
  $exclusive = 'exclusive' + $lvl,
@@ -7818,6 +7756,9 @@
7818
7756
  } else {
7819
7757
  $schemaValue = $schema;
7820
7758
  }
7759
+ if (!($isData || typeof $schema == 'number')) {
7760
+ throw new Error($keyword + ' must be number');
7761
+ }
7821
7762
  var $op = $keyword == 'maxItems' ? '>' : '<';
7822
7763
  out += 'if ( ';
7823
7764
  if ($isData) {
@@ -7895,6 +7836,9 @@
7895
7836
  } else {
7896
7837
  $schemaValue = $schema;
7897
7838
  }
7839
+ if (!($isData || typeof $schema == 'number')) {
7840
+ throw new Error($keyword + ' must be number');
7841
+ }
7898
7842
  var $op = $keyword == 'maxLength' ? '>' : '<';
7899
7843
  out += 'if ( ';
7900
7844
  if ($isData) {
@@ -7977,6 +7921,9 @@
7977
7921
  } else {
7978
7922
  $schemaValue = $schema;
7979
7923
  }
7924
+ if (!($isData || typeof $schema == 'number')) {
7925
+ throw new Error($keyword + ' must be number');
7926
+ }
7980
7927
  var $op = $keyword == 'maxProperties' ? '>' : '<';
7981
7928
  out += 'if ( ';
7982
7929
  if ($isData) {
@@ -8053,6 +8000,9 @@
8053
8000
  } else {
8054
8001
  $schemaValue = $schema;
8055
8002
  }
8003
+ if (!($isData || typeof $schema == 'number')) {
8004
+ throw new Error($keyword + ' must be number');
8005
+ }
8056
8006
  out += 'var division' + ($lvl) + ';if (';
8057
8007
  if ($isData) {
8058
8008
  out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
@@ -8126,7 +8076,7 @@
8126
8076
  var $it = it.util.copy(it);
8127
8077
  $it.level++;
8128
8078
  var $nextValid = 'valid' + $it.level;
8129
- if (it.util.schemaHasRules($schema, it.RULES.all)) {
8079
+ if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
8130
8080
  $it.schema = $schema;
8131
8081
  $it.schemaPath = $schemaPath;
8132
8082
  $it.errSchemaPath = $errSchemaPath;
@@ -8224,7 +8174,7 @@
8224
8174
  l1 = arr1.length - 1;
8225
8175
  while ($i < l1) {
8226
8176
  $sch = arr1[$i += 1];
8227
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
8177
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
8228
8178
  $it.schema = $sch;
8229
8179
  $it.schemaPath = $schemaPath + '[' + $i + ']';
8230
8180
  $it.errSchemaPath = $errSchemaPath + '/' + $i;
@@ -8364,9 +8314,9 @@
8364
8314
  $dataNxt = $it.dataLevel = it.dataLevel + 1,
8365
8315
  $nextData = 'data' + $dataNxt,
8366
8316
  $dataProperties = 'dataProperties' + $lvl;
8367
- var $schemaKeys = Object.keys($schema || {}),
8317
+ var $schemaKeys = Object.keys($schema || {}).filter(notProto),
8368
8318
  $pProperties = it.schema.patternProperties || {},
8369
- $pPropertyKeys = Object.keys($pProperties),
8319
+ $pPropertyKeys = Object.keys($pProperties).filter(notProto),
8370
8320
  $aProperties = it.schema.additionalProperties,
8371
8321
  $someProperties = $schemaKeys.length || $pPropertyKeys.length,
8372
8322
  $noAdditional = $aProperties === false,
@@ -8376,7 +8326,13 @@
8376
8326
  $ownProperties = it.opts.ownProperties,
8377
8327
  $currentBaseId = it.baseId;
8378
8328
  var $required = it.schema.required;
8379
- if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
8329
+ if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
8330
+ var $requiredHash = it.util.toHash($required);
8331
+ }
8332
+
8333
+ function notProto(p) {
8334
+ return p !== '__proto__';
8335
+ }
8380
8336
  out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
8381
8337
  if ($ownProperties) {
8382
8338
  out += ' var ' + ($dataProperties) + ' = undefined;';
@@ -8529,7 +8485,7 @@
8529
8485
  while (i3 < l3) {
8530
8486
  $propertyKey = arr3[i3 += 1];
8531
8487
  var $sch = $schema[$propertyKey];
8532
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
8488
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
8533
8489
  var $prop = it.util.getProperty($propertyKey),
8534
8490
  $passData = $data + $prop,
8535
8491
  $hasDefault = $useDefaults && $sch.default !== undefined;
@@ -8632,7 +8588,7 @@
8632
8588
  while (i4 < l4) {
8633
8589
  $pProperty = arr4[i4 += 1];
8634
8590
  var $sch = $pProperties[$pProperty];
8635
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
8591
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
8636
8592
  $it.schema = $sch;
8637
8593
  $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
8638
8594
  $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
@@ -8671,7 +8627,6 @@
8671
8627
  if ($breakOnError) {
8672
8628
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
8673
8629
  }
8674
- out = it.util.cleanUpCode(out);
8675
8630
  return out;
8676
8631
  };
8677
8632
 
@@ -8690,7 +8645,7 @@
8690
8645
  $it.level++;
8691
8646
  var $nextValid = 'valid' + $it.level;
8692
8647
  out += 'var ' + ($errs) + ' = errors;';
8693
- if (it.util.schemaHasRules($schema, it.RULES.all)) {
8648
+ if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
8694
8649
  $it.schema = $schema;
8695
8650
  $it.schemaPath = $schemaPath;
8696
8651
  $it.errSchemaPath = $errSchemaPath;
@@ -8753,7 +8708,6 @@
8753
8708
  if ($breakOnError) {
8754
8709
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
8755
8710
  }
8756
- out = it.util.cleanUpCode(out);
8757
8711
  return out;
8758
8712
  };
8759
8713
 
@@ -8782,7 +8736,7 @@
8782
8736
  while (i1 < l1) {
8783
8737
  $property = arr1[i1 += 1];
8784
8738
  var $propertySch = it.schema.properties[$property];
8785
- if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) {
8739
+ if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
8786
8740
  $required[$required.length] = $property;
8787
8741
  }
8788
8742
  }
@@ -9053,7 +9007,7 @@
9053
9007
  } else {
9054
9008
  out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
9055
9009
  var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
9056
- out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
9010
+ out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
9057
9011
  if ($typeIsArray) {
9058
9012
  out += ' if (typeof item == \'string\') item = \'"\' + item; ';
9059
9013
  }
@@ -9243,7 +9197,7 @@
9243
9197
  keywords[key] = {
9244
9198
  anyOf: [
9245
9199
  schema,
9246
- { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
9200
+ { $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
9247
9201
  ]
9248
9202
  };
9249
9203
  }
@@ -9835,20 +9789,10 @@
9835
9789
 
9836
9790
  var require$$2 = getCjsExportFromNamespace(jsonSchemaDraft07$1);
9837
9791
 
9838
- var IDENTIFIER$1 = /^[a-z_$][a-z0-9_$-]*$/i;
9839
-
9840
- var metaSchema = require$$2;
9841
-
9842
- var keyword = {
9843
- add: addKeyword,
9844
- get: getKeyword,
9845
- remove: removeKeyword,
9846
- validate: validateKeyword
9847
- };
9848
-
9849
- var definitionSchema = {
9792
+ var definition_schema = {
9793
+ $id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
9850
9794
  definitions: {
9851
- simpleTypes: metaSchema.definitions.simpleTypes
9795
+ simpleTypes: require$$2.definitions.simpleTypes
9852
9796
  },
9853
9797
  type: 'object',
9854
9798
  dependencies: {
@@ -9858,7 +9802,7 @@
9858
9802
  valid: {not: {required: ['macro']}}
9859
9803
  },
9860
9804
  properties: {
9861
- type: metaSchema.properties.type,
9805
+ type: require$$2.properties.type,
9862
9806
  schema: {type: 'boolean'},
9863
9807
  statements: {type: 'boolean'},
9864
9808
  dependencies: {
@@ -9879,6 +9823,18 @@
9879
9823
  }
9880
9824
  };
9881
9825
 
9826
+ var IDENTIFIER$1 = /^[a-z_$][a-z0-9_$-]*$/i;
9827
+
9828
+
9829
+
9830
+ var keyword = {
9831
+ add: addKeyword,
9832
+ get: getKeyword,
9833
+ remove: removeKeyword,
9834
+ validate: validateKeyword
9835
+ };
9836
+
9837
+
9882
9838
  /**
9883
9839
  * Define custom keyword
9884
9840
  * @this Ajv
@@ -9913,7 +9869,7 @@
9913
9869
  metaSchema = {
9914
9870
  anyOf: [
9915
9871
  metaSchema,
9916
- { '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
9872
+ { '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
9917
9873
  ]
9918
9874
  };
9919
9875
  }
@@ -10002,7 +9958,7 @@
10002
9958
  function validateKeyword(definition, throwError) {
10003
9959
  validateKeyword.errors = null;
10004
9960
  var v = this._validateKeyword = this._validateKeyword
10005
- || this.compile(definitionSchema, true);
9961
+ || this.compile(definition_schema, true);
10006
9962
 
10007
9963
  if (v(definition)) return true;
10008
9964
  validateKeyword.errors = v.errors;
@@ -10013,7 +9969,7 @@
10013
9969
  }
10014
9970
 
10015
9971
  var $schema$1 = "http://json-schema.org/draft-07/schema#";
10016
- var $id$1 = "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#";
9972
+ var $id$1 = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
10017
9973
  var description = "Meta-schema for $data reference (JSON Schema extension proposal)";
10018
9974
  var type$1 = "object";
10019
9975
  var required$1 = [
@@ -10116,6 +10072,7 @@
10116
10072
  this._metaOpts = getMetaSchemaOptions(this);
10117
10073
 
10118
10074
  if (opts.formats) addInitialFormats(this);
10075
+ if (opts.keywords) addInitialKeywords(this);
10119
10076
  addDefaultMetaSchema(this);
10120
10077
  if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
10121
10078
  if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
@@ -10514,6 +10471,14 @@
10514
10471
  }
10515
10472
 
10516
10473
 
10474
+ function addInitialKeywords(self) {
10475
+ for (var name in self._opts.keywords) {
10476
+ var keyword = self._opts.keywords[name];
10477
+ self.addKeyword(name, keyword);
10478
+ }
10479
+ }
10480
+
10481
+
10517
10482
  function checkUnique(self, id) {
10518
10483
  if (self._schemas[id] || self._refs[id])
10519
10484
  throw new Error('schema with key or id "' + id + '" already exists');