@rjsf/validator-ajv6
Advanced tools
Comparing version 5.5.2 to 5.6.0
@@ -5,3 +5,2 @@ 'use strict'; | ||
var toPath = require('lodash/toPath'); | ||
var utils = require('@rjsf/utils'); | ||
@@ -13,3 +12,2 @@ var Ajv = require('ajv'); | ||
var toPath__default = /*#__PURE__*/_interopDefaultLegacy(toPath); | ||
var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); | ||
@@ -74,3 +72,2 @@ var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject); | ||
var ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema'; | ||
/** `ValidatorType` implementation that uses the AJV 6 validation mechanism. | ||
@@ -96,41 +93,2 @@ * | ||
} | ||
/** Transforms a ajv validation errors list: | ||
* [ | ||
* {property: '.level1.level2[2].level3', message: 'err a'}, | ||
* {property: '.level1.level2[2].level3', message: 'err b'}, | ||
* {property: '.level1.level2[4].level3', message: 'err b'}, | ||
* ] | ||
* Into an error tree: | ||
* { | ||
* level1: { | ||
* level2: { | ||
* 2: {level3: {errors: ['err a', 'err b']}}, | ||
* 4: {level3: {errors: ['err b']}}, | ||
* } | ||
* } | ||
* }; | ||
* | ||
* @param errors - The list of RJSFValidationError objects | ||
* @private | ||
*/ | ||
var _proto = AJV6Validator.prototype; | ||
_proto.toErrorSchema = function toErrorSchema(errors) { | ||
var builder = new utils.ErrorSchemaBuilder(); | ||
if (errors.length) { | ||
errors.forEach(function (error) { | ||
var property = error.property, | ||
message = error.message; | ||
var path = toPath__default["default"](property); | ||
// If the property is at the root (.level1) then toPath creates | ||
// an empty array element at the first index. Remove it. | ||
if (path.length > 0 && path[0] === '') { | ||
path.splice(0, 1); | ||
} | ||
if (message) { | ||
builder.addErrors(message, path); | ||
} | ||
}); | ||
} | ||
return builder.ErrorSchema; | ||
} | ||
/** Converts an `errorSchema` into a list of `RJSFValidationErrors` | ||
@@ -140,78 +98,12 @@ * | ||
* @param [fieldPath=[]] - The current field path, defaults to [] if not specified | ||
*/; | ||
* @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in | ||
* the next major release. | ||
*/ | ||
var _proto = AJV6Validator.prototype; | ||
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) { | ||
var _this = this; | ||
if (fieldPath === void 0) { | ||
fieldPath = []; | ||
} | ||
if (!errorSchema) { | ||
return []; | ||
} | ||
var errorList = []; | ||
if (utils.ERRORS_KEY in errorSchema) { | ||
errorList = errorList.concat(errorSchema.__errors.map(function (message) { | ||
var property = "." + fieldPath.join('.'); | ||
return { | ||
property: property, | ||
message: message, | ||
stack: property + " " + message | ||
}; | ||
})); | ||
} | ||
return Object.keys(errorSchema).reduce(function (acc, key) { | ||
if (key !== utils.ERRORS_KEY) { | ||
acc = acc.concat(_this.toErrorList(errorSchema[key], [].concat(fieldPath, [key]))); | ||
} | ||
return acc; | ||
}, errorList); | ||
return utils.toErrorList(errorSchema, fieldPath); | ||
} | ||
/** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it | ||
* | ||
* @param formData - The form data around which the error handler is created | ||
* @private | ||
*/; | ||
_proto.createErrorHandler = function createErrorHandler(formData) { | ||
var _this2 = this; | ||
var handler = { | ||
// We store the list of errors for this node in a property named __errors | ||
// to avoid name collision with a possible sub schema field named | ||
// 'errors' (see `utils.toErrorSchema`). | ||
__errors: [], | ||
addError: function addError(message) { | ||
this.__errors.push(message); | ||
} | ||
}; | ||
if (utils.isObject(formData)) { | ||
var formObject = formData; | ||
return Object.keys(formObject).reduce(function (acc, key) { | ||
var _extends2; | ||
return _extends({}, acc, (_extends2 = {}, _extends2[key] = _this2.createErrorHandler(formObject[key]), _extends2)); | ||
}, handler); | ||
} | ||
if (Array.isArray(formData)) { | ||
return formData.reduce(function (acc, value, key) { | ||
var _extends3; | ||
return _extends({}, acc, (_extends3 = {}, _extends3[key] = _this2.createErrorHandler(value), _extends3)); | ||
}, handler); | ||
} | ||
return handler; | ||
} | ||
/** Unwraps the `errorHandler` structure into the associated `ErrorSchema`, stripping the `addError` functions from it | ||
* | ||
* @param errorHandler - The `FormValidation` error handling structure | ||
* @private | ||
*/; | ||
_proto.unwrapErrorHandler = function unwrapErrorHandler(errorHandler) { | ||
var _this3 = this; | ||
return Object.keys(errorHandler).reduce(function (acc, key) { | ||
var _extends5; | ||
if (key === 'addError') { | ||
return acc; | ||
} else if (key === utils.ERRORS_KEY) { | ||
var _extends4; | ||
return _extends({}, acc, (_extends4 = {}, _extends4[key] = errorHandler[key], _extends4)); | ||
} | ||
return _extends({}, acc, (_extends5 = {}, _extends5[key] = _this3.unwrapErrorHandler(errorHandler[key]), _extends5)); | ||
}, {}); | ||
} | ||
/** Transforming the error output from ajv to format used by @rjsf/utils. | ||
@@ -291,3 +183,3 @@ * At some point, components should be updated to support ajv. | ||
} | ||
var errorSchema = this.toErrorSchema(errors); | ||
var errorSchema = utils.toErrorSchema(errors); | ||
if (noProperMetaSchema) { | ||
@@ -308,5 +200,5 @@ errorSchema = _extends({}, errorSchema, { | ||
var newFormData = utils.getDefaultFormState(this, schema, formData, rootSchema, true); | ||
var errorHandler = customValidate(newFormData, this.createErrorHandler(newFormData), uiSchema); | ||
var userErrorSchema = this.unwrapErrorHandler(errorHandler); | ||
return utils.mergeValidationData(this, { | ||
var errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema); | ||
var userErrorSchema = utils.unwrapErrorHandler(errorHandler); | ||
return utils.validationDataMerge({ | ||
errors: errors, | ||
@@ -316,32 +208,2 @@ errorSchema: errorSchema | ||
} | ||
/** Takes a `node` object and transforms any contained `$ref` node variables with a prefix, recursively calling | ||
* `withIdRefPrefix` for any other elements. | ||
* | ||
* @param node - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @private | ||
*/; | ||
_proto.withIdRefPrefixObject = function withIdRefPrefixObject(node) { | ||
for (var key in node) { | ||
var realObj = node; | ||
var value = realObj[key]; | ||
if (key === utils.REF_KEY && typeof value === 'string' && value.startsWith('#')) { | ||
realObj[key] = ROOT_SCHEMA_PREFIX + value; | ||
} else { | ||
realObj[key] = this.withIdRefPrefix(value); | ||
} | ||
} | ||
return node; | ||
} | ||
/** Takes a `node` object list and transforms any contained `$ref` node variables with a prefix, recursively calling | ||
* `withIdRefPrefix` for any other elements. | ||
* | ||
* @param node - The list of object nodes to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @private | ||
*/; | ||
_proto.withIdRefPrefixArray = function withIdRefPrefixArray(node) { | ||
for (var i = 0; i < node.length; i++) { | ||
node[i] = this.withIdRefPrefix(node[i]); | ||
} | ||
return node; | ||
} | ||
/** Validates data against a schema, returning true if the data is valid, or | ||
@@ -361,3 +223,3 @@ * false otherwise. If the schema is invalid, then this function will return | ||
// that lives in the rootSchema but not in the schema in question. | ||
var result = this.ajv.addSchema(rootSchema, ROOT_SCHEMA_PREFIX).validate(this.withIdRefPrefix(schema), formData); | ||
var result = this.ajv.addSchema(rootSchema, utils.ROOT_SCHEMA_PREFIX).validate(utils.withIdRefPrefix(schema), formData); | ||
return result; | ||
@@ -368,19 +230,4 @@ } catch (e) { | ||
// make sure we remove the rootSchema from the global ajv instance | ||
this.ajv.removeSchema(ROOT_SCHEMA_PREFIX); | ||
this.ajv.removeSchema(utils.ROOT_SCHEMA_PREFIX); | ||
} | ||
} | ||
/** Recursively prefixes all $ref's in a schema with `ROOT_SCHEMA_PREFIX` | ||
* This is used in isValid to make references to the rootSchema | ||
* | ||
* @param schemaNode - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @protected | ||
*/; | ||
_proto.withIdRefPrefix = function withIdRefPrefix(schemaNode) { | ||
if (schemaNode.constructor === Object) { | ||
return this.withIdRefPrefixObject(_extends({}, schemaNode)); | ||
} | ||
if (Array.isArray(schemaNode)) { | ||
return this.withIdRefPrefixArray([].concat(schemaNode)); | ||
} | ||
return schemaNode; | ||
}; | ||
@@ -387,0 +234,0 @@ return AJV6Validator; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("lodash/toPath"),e=require("@rjsf/utils"),t=require("ajv"),a=require("lodash/isObject");function o(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var n=o(r),i=o(t),s=o(a);function c(){return c=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a])}return r},c.apply(this,arguments)}var u={errorDataPath:"property",allErrors:!0,multipleOfPrecision:8,schemaId:"auto",unknownFormats:"ignore"},d=/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,f=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/,h=function(){function r(r){this.ajv=void 0,this.ajv=function(r,e,t){void 0===t&&(t={});var a=new i.default(c({},u,t));return a.addFormat("data-url",f),a.addFormat("color",d),Array.isArray(r)&&a.addMetaSchema(r),s.default(e)&&Object.keys(e).forEach((function(r){a.addFormat(r,e[r])})),a}(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides)}var t=r.prototype;return t.toErrorSchema=function(r){var t=new e.ErrorSchemaBuilder;return r.length&&r.forEach((function(r){var e=r.message,a=n.default(r.property);a.length>0&&""===a[0]&&a.splice(0,1),e&&t.addErrors(e,a)})),t.ErrorSchema},t.toErrorList=function(r,t){var a=this;if(void 0===t&&(t=[]),!r)return[];var o=[];return e.ERRORS_KEY in r&&(o=o.concat(r.__errors.map((function(r){var e="."+t.join(".");return{property:e,message:r,stack:e+" "+r}})))),Object.keys(r).reduce((function(o,n){return n!==e.ERRORS_KEY&&(o=o.concat(a.toErrorList(r[n],[].concat(t,[n])))),o}),o)},t.createErrorHandler=function(r){var t=this,a={__errors:[],addError:function(r){this.__errors.push(r)}};if(e.isObject(r)){var o=r;return Object.keys(o).reduce((function(r,e){var a;return c({},r,((a={})[e]=t.createErrorHandler(o[e]),a))}),a)}return Array.isArray(r)?r.reduce((function(r,e,a){var o;return c({},r,((o={})[a]=t.createErrorHandler(e),o))}),a):a},t.unwrapErrorHandler=function(r){var t=this;return Object.keys(r).reduce((function(a,o){var n,i;return"addError"===o?a:c({},a,o===e.ERRORS_KEY?((i={})[o]=r[o],i):((n={})[o]=t.unwrapErrorHandler(r[o]),n))}),{})},t.transformRJSFValidationErrors=function(r){return void 0===r&&(r=[]),r.map((function(r){var e=r.message,t=r.schemaPath,a=""+r.dataPath;return{name:r.keyword,property:a,message:e,params:r.params,stack:(a+" "+e).trim(),schemaPath:t}}))},t.rawValidation=function(r,e){var t=void 0;try{this.ajv.validate(r,e)}catch(r){t=r}var a=this.ajv.errors||void 0;return this.ajv.errors=null,{errors:a,validationError:t}},t.validateFormData=function(r,t,a,o,n){var i=t,s=this.rawValidation(t,r),u=s.validationError,d=this.transformRJSFValidationErrors(s.errors),f=u&&u.message&&u.message.includes("no schema with key or ref ");f&&(d=[].concat(d,[{stack:u.message}])),"function"==typeof o&&(d=o(d,n));var h=this.toErrorSchema(d);if(f&&(h=c({},h,{$schema:{__errors:[u.message]}})),"function"!=typeof a)return{errors:d,errorSchema:h};var l=e.getDefaultFormState(this,t,r,i,!0),v=a(l,this.createErrorHandler(l),n),m=this.unwrapErrorHandler(v);return e.mergeValidationData(this,{errors:d,errorSchema:h},m)},t.withIdRefPrefixObject=function(r){for(var t in r){var a=r[t];r[t]=t===e.REF_KEY&&"string"==typeof a&&a.startsWith("#")?"__rjsf_rootSchema"+a:this.withIdRefPrefix(a)}return r},t.withIdRefPrefixArray=function(r){for(var e=0;e<r.length;e++)r[e]=this.withIdRefPrefix(r[e]);return r},t.isValid=function(r,e,t){try{return this.ajv.addSchema(t,"__rjsf_rootSchema").validate(this.withIdRefPrefix(r),e)}catch(r){return!1}finally{this.ajv.removeSchema("__rjsf_rootSchema")}},t.withIdRefPrefix=function(r){return r.constructor===Object?this.withIdRefPrefixObject(c({},r)):Array.isArray(r)?this.withIdRefPrefixArray([].concat(r)):r},r}();function l(r){return void 0===r&&(r={}),new h(r)}var v=l();exports.customizeValidator=l,exports.default=v; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@rjsf/utils"),a=require("ajv"),e=require("lodash/isObject");function t(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var o=t(a),i=t(e);function s(){return s=Object.assign?Object.assign.bind():function(r){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},s.apply(this,arguments)}var n={errorDataPath:"property",allErrors:!0,multipleOfPrecision:8,schemaId:"auto",unknownFormats:"ignore"},d=/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,u=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/,c=function(){function a(r){this.ajv=void 0,this.ajv=function(r,a,e){void 0===e&&(e={});var t=new o.default(s({},n,e));return t.addFormat("data-url",u),t.addFormat("color",d),Array.isArray(r)&&t.addMetaSchema(r),i.default(a)&&Object.keys(a).forEach((function(r){t.addFormat(r,a[r])})),t}(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides)}var e=a.prototype;return e.toErrorList=function(a,e){return void 0===e&&(e=[]),r.toErrorList(a,e)},e.transformRJSFValidationErrors=function(r){return void 0===r&&(r=[]),r.map((function(r){var a=r.message,e=r.schemaPath,t=""+r.dataPath;return{name:r.keyword,property:t,message:a,params:r.params,stack:(t+" "+a).trim(),schemaPath:e}}))},e.rawValidation=function(r,a){var e=void 0;try{this.ajv.validate(r,a)}catch(r){e=r}var t=this.ajv.errors||void 0;return this.ajv.errors=null,{errors:t,validationError:e}},e.validateFormData=function(a,e,t,o,i){var n=e,d=this.rawValidation(e,a),u=d.validationError,c=this.transformRJSFValidationErrors(d.errors),l=u&&u.message&&u.message.includes("no schema with key or ref ");l&&(c=[].concat(c,[{stack:u.message}])),"function"==typeof o&&(c=o(c,i));var v=r.toErrorSchema(c);if(l&&(v=s({},v,{$schema:{__errors:[u.message]}})),"function"!=typeof t)return{errors:c,errorSchema:v};var f=r.getDefaultFormState(this,e,a,n,!0),m=t(f,r.createErrorHandler(f),i),h=r.unwrapErrorHandler(m);return r.validationDataMerge({errors:c,errorSchema:v},h)},e.isValid=function(a,e,t){try{return this.ajv.addSchema(t,r.ROOT_SCHEMA_PREFIX).validate(r.withIdRefPrefix(a),e)}catch(r){return!1}finally{this.ajv.removeSchema(r.ROOT_SCHEMA_PREFIX)}},a}();function l(r){return void 0===r&&(r={}),new c(r)}var v=l();exports.customizeValidator=l,exports.default=v; | ||
//# sourceMappingURL=validator-ajv6.cjs.production.min.js.map |
@@ -1,3 +0,2 @@ | ||
import toPath from 'lodash-es/toPath'; | ||
import { ErrorSchemaBuilder, ERRORS_KEY, isObject as isObject$1, getDefaultFormState, mergeValidationData, REF_KEY } from '@rjsf/utils'; | ||
import { toErrorList, toErrorSchema, getDefaultFormState, createErrorHandler, unwrapErrorHandler, validationDataMerge, ROOT_SCHEMA_PREFIX, withIdRefPrefix } from '@rjsf/utils'; | ||
import Ajv from 'ajv'; | ||
@@ -62,3 +61,2 @@ import isObject from 'lodash-es/isObject'; | ||
var ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema'; | ||
/** `ValidatorType` implementation that uses the AJV 6 validation mechanism. | ||
@@ -84,41 +82,2 @@ * | ||
} | ||
/** Transforms a ajv validation errors list: | ||
* [ | ||
* {property: '.level1.level2[2].level3', message: 'err a'}, | ||
* {property: '.level1.level2[2].level3', message: 'err b'}, | ||
* {property: '.level1.level2[4].level3', message: 'err b'}, | ||
* ] | ||
* Into an error tree: | ||
* { | ||
* level1: { | ||
* level2: { | ||
* 2: {level3: {errors: ['err a', 'err b']}}, | ||
* 4: {level3: {errors: ['err b']}}, | ||
* } | ||
* } | ||
* }; | ||
* | ||
* @param errors - The list of RJSFValidationError objects | ||
* @private | ||
*/ | ||
var _proto = AJV6Validator.prototype; | ||
_proto.toErrorSchema = function toErrorSchema(errors) { | ||
var builder = new ErrorSchemaBuilder(); | ||
if (errors.length) { | ||
errors.forEach(function (error) { | ||
var property = error.property, | ||
message = error.message; | ||
var path = toPath(property); | ||
// If the property is at the root (.level1) then toPath creates | ||
// an empty array element at the first index. Remove it. | ||
if (path.length > 0 && path[0] === '') { | ||
path.splice(0, 1); | ||
} | ||
if (message) { | ||
builder.addErrors(message, path); | ||
} | ||
}); | ||
} | ||
return builder.ErrorSchema; | ||
} | ||
/** Converts an `errorSchema` into a list of `RJSFValidationErrors` | ||
@@ -128,78 +87,12 @@ * | ||
* @param [fieldPath=[]] - The current field path, defaults to [] if not specified | ||
*/; | ||
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) { | ||
var _this = this; | ||
* @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in | ||
* the next major release. | ||
*/ | ||
var _proto = AJV6Validator.prototype; | ||
_proto.toErrorList = function toErrorList$1(errorSchema, fieldPath) { | ||
if (fieldPath === void 0) { | ||
fieldPath = []; | ||
} | ||
if (!errorSchema) { | ||
return []; | ||
} | ||
var errorList = []; | ||
if (ERRORS_KEY in errorSchema) { | ||
errorList = errorList.concat(errorSchema.__errors.map(function (message) { | ||
var property = "." + fieldPath.join('.'); | ||
return { | ||
property: property, | ||
message: message, | ||
stack: property + " " + message | ||
}; | ||
})); | ||
} | ||
return Object.keys(errorSchema).reduce(function (acc, key) { | ||
if (key !== ERRORS_KEY) { | ||
acc = acc.concat(_this.toErrorList(errorSchema[key], [].concat(fieldPath, [key]))); | ||
} | ||
return acc; | ||
}, errorList); | ||
return toErrorList(errorSchema, fieldPath); | ||
} | ||
/** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it | ||
* | ||
* @param formData - The form data around which the error handler is created | ||
* @private | ||
*/; | ||
_proto.createErrorHandler = function createErrorHandler(formData) { | ||
var _this2 = this; | ||
var handler = { | ||
// We store the list of errors for this node in a property named __errors | ||
// to avoid name collision with a possible sub schema field named | ||
// 'errors' (see `utils.toErrorSchema`). | ||
__errors: [], | ||
addError: function addError(message) { | ||
this.__errors.push(message); | ||
} | ||
}; | ||
if (isObject$1(formData)) { | ||
var formObject = formData; | ||
return Object.keys(formObject).reduce(function (acc, key) { | ||
var _extends2; | ||
return _extends({}, acc, (_extends2 = {}, _extends2[key] = _this2.createErrorHandler(formObject[key]), _extends2)); | ||
}, handler); | ||
} | ||
if (Array.isArray(formData)) { | ||
return formData.reduce(function (acc, value, key) { | ||
var _extends3; | ||
return _extends({}, acc, (_extends3 = {}, _extends3[key] = _this2.createErrorHandler(value), _extends3)); | ||
}, handler); | ||
} | ||
return handler; | ||
} | ||
/** Unwraps the `errorHandler` structure into the associated `ErrorSchema`, stripping the `addError` functions from it | ||
* | ||
* @param errorHandler - The `FormValidation` error handling structure | ||
* @private | ||
*/; | ||
_proto.unwrapErrorHandler = function unwrapErrorHandler(errorHandler) { | ||
var _this3 = this; | ||
return Object.keys(errorHandler).reduce(function (acc, key) { | ||
var _extends5; | ||
if (key === 'addError') { | ||
return acc; | ||
} else if (key === ERRORS_KEY) { | ||
var _extends4; | ||
return _extends({}, acc, (_extends4 = {}, _extends4[key] = errorHandler[key], _extends4)); | ||
} | ||
return _extends({}, acc, (_extends5 = {}, _extends5[key] = _this3.unwrapErrorHandler(errorHandler[key]), _extends5)); | ||
}, {}); | ||
} | ||
/** Transforming the error output from ajv to format used by @rjsf/utils. | ||
@@ -279,3 +172,3 @@ * At some point, components should be updated to support ajv. | ||
} | ||
var errorSchema = this.toErrorSchema(errors); | ||
var errorSchema = toErrorSchema(errors); | ||
if (noProperMetaSchema) { | ||
@@ -296,5 +189,5 @@ errorSchema = _extends({}, errorSchema, { | ||
var newFormData = getDefaultFormState(this, schema, formData, rootSchema, true); | ||
var errorHandler = customValidate(newFormData, this.createErrorHandler(newFormData), uiSchema); | ||
var userErrorSchema = this.unwrapErrorHandler(errorHandler); | ||
return mergeValidationData(this, { | ||
var errorHandler = customValidate(newFormData, createErrorHandler(newFormData), uiSchema); | ||
var userErrorSchema = unwrapErrorHandler(errorHandler); | ||
return validationDataMerge({ | ||
errors: errors, | ||
@@ -304,32 +197,2 @@ errorSchema: errorSchema | ||
} | ||
/** Takes a `node` object and transforms any contained `$ref` node variables with a prefix, recursively calling | ||
* `withIdRefPrefix` for any other elements. | ||
* | ||
* @param node - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @private | ||
*/; | ||
_proto.withIdRefPrefixObject = function withIdRefPrefixObject(node) { | ||
for (var key in node) { | ||
var realObj = node; | ||
var value = realObj[key]; | ||
if (key === REF_KEY && typeof value === 'string' && value.startsWith('#')) { | ||
realObj[key] = ROOT_SCHEMA_PREFIX + value; | ||
} else { | ||
realObj[key] = this.withIdRefPrefix(value); | ||
} | ||
} | ||
return node; | ||
} | ||
/** Takes a `node` object list and transforms any contained `$ref` node variables with a prefix, recursively calling | ||
* `withIdRefPrefix` for any other elements. | ||
* | ||
* @param node - The list of object nodes to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @private | ||
*/; | ||
_proto.withIdRefPrefixArray = function withIdRefPrefixArray(node) { | ||
for (var i = 0; i < node.length; i++) { | ||
node[i] = this.withIdRefPrefix(node[i]); | ||
} | ||
return node; | ||
} | ||
/** Validates data against a schema, returning true if the data is valid, or | ||
@@ -349,3 +212,3 @@ * false otherwise. If the schema is invalid, then this function will return | ||
// that lives in the rootSchema but not in the schema in question. | ||
var result = this.ajv.addSchema(rootSchema, ROOT_SCHEMA_PREFIX).validate(this.withIdRefPrefix(schema), formData); | ||
var result = this.ajv.addSchema(rootSchema, ROOT_SCHEMA_PREFIX).validate(withIdRefPrefix(schema), formData); | ||
return result; | ||
@@ -358,17 +221,2 @@ } catch (e) { | ||
} | ||
} | ||
/** Recursively prefixes all $ref's in a schema with `ROOT_SCHEMA_PREFIX` | ||
* This is used in isValid to make references to the rootSchema | ||
* | ||
* @param schemaNode - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @protected | ||
*/; | ||
_proto.withIdRefPrefix = function withIdRefPrefix(schemaNode) { | ||
if (schemaNode.constructor === Object) { | ||
return this.withIdRefPrefixObject(_extends({}, schemaNode)); | ||
} | ||
if (Array.isArray(schemaNode)) { | ||
return this.withIdRefPrefixArray([].concat(schemaNode)); | ||
} | ||
return schemaNode; | ||
}; | ||
@@ -375,0 +223,0 @@ return AJV6Validator; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash-es/toPath'), require('@rjsf/utils'), require('ajv'), require('lodash-es/isObject')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'lodash-es/toPath', '@rjsf/utils', 'ajv', 'lodash-es/isObject'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/validator-ajv6"] = {}, global.toPath, global.utils, global.Ajv, global.isObject)); | ||
})(this, (function (exports, toPath, utils, Ajv, isObject) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/utils'), require('ajv'), require('lodash-es/isObject')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/utils', 'ajv', 'lodash-es/isObject'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/validator-ajv6"] = {}, global.utils, global.Ajv, global.isObject)); | ||
})(this, (function (exports, utils, Ajv, isObject) { 'use strict'; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var toPath__default = /*#__PURE__*/_interopDefaultLegacy(toPath); | ||
var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); | ||
@@ -69,3 +68,2 @@ var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject); | ||
var ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema'; | ||
/** `ValidatorType` implementation that uses the AJV 6 validation mechanism. | ||
@@ -91,41 +89,2 @@ * | ||
} | ||
/** Transforms a ajv validation errors list: | ||
* [ | ||
* {property: '.level1.level2[2].level3', message: 'err a'}, | ||
* {property: '.level1.level2[2].level3', message: 'err b'}, | ||
* {property: '.level1.level2[4].level3', message: 'err b'}, | ||
* ] | ||
* Into an error tree: | ||
* { | ||
* level1: { | ||
* level2: { | ||
* 2: {level3: {errors: ['err a', 'err b']}}, | ||
* 4: {level3: {errors: ['err b']}}, | ||
* } | ||
* } | ||
* }; | ||
* | ||
* @param errors - The list of RJSFValidationError objects | ||
* @private | ||
*/ | ||
var _proto = AJV6Validator.prototype; | ||
_proto.toErrorSchema = function toErrorSchema(errors) { | ||
var builder = new utils.ErrorSchemaBuilder(); | ||
if (errors.length) { | ||
errors.forEach(function (error) { | ||
var property = error.property, | ||
message = error.message; | ||
var path = toPath__default["default"](property); | ||
// If the property is at the root (.level1) then toPath creates | ||
// an empty array element at the first index. Remove it. | ||
if (path.length > 0 && path[0] === '') { | ||
path.splice(0, 1); | ||
} | ||
if (message) { | ||
builder.addErrors(message, path); | ||
} | ||
}); | ||
} | ||
return builder.ErrorSchema; | ||
} | ||
/** Converts an `errorSchema` into a list of `RJSFValidationErrors` | ||
@@ -135,78 +94,12 @@ * | ||
* @param [fieldPath=[]] - The current field path, defaults to [] if not specified | ||
*/; | ||
* @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in | ||
* the next major release. | ||
*/ | ||
var _proto = AJV6Validator.prototype; | ||
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) { | ||
var _this = this; | ||
if (fieldPath === void 0) { | ||
fieldPath = []; | ||
} | ||
if (!errorSchema) { | ||
return []; | ||
} | ||
var errorList = []; | ||
if (utils.ERRORS_KEY in errorSchema) { | ||
errorList = errorList.concat(errorSchema.__errors.map(function (message) { | ||
var property = "." + fieldPath.join('.'); | ||
return { | ||
property: property, | ||
message: message, | ||
stack: property + " " + message | ||
}; | ||
})); | ||
} | ||
return Object.keys(errorSchema).reduce(function (acc, key) { | ||
if (key !== utils.ERRORS_KEY) { | ||
acc = acc.concat(_this.toErrorList(errorSchema[key], [].concat(fieldPath, [key]))); | ||
} | ||
return acc; | ||
}, errorList); | ||
return utils.toErrorList(errorSchema, fieldPath); | ||
} | ||
/** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it | ||
* | ||
* @param formData - The form data around which the error handler is created | ||
* @private | ||
*/; | ||
_proto.createErrorHandler = function createErrorHandler(formData) { | ||
var _this2 = this; | ||
var handler = { | ||
// We store the list of errors for this node in a property named __errors | ||
// to avoid name collision with a possible sub schema field named | ||
// 'errors' (see `utils.toErrorSchema`). | ||
__errors: [], | ||
addError: function addError(message) { | ||
this.__errors.push(message); | ||
} | ||
}; | ||
if (utils.isObject(formData)) { | ||
var formObject = formData; | ||
return Object.keys(formObject).reduce(function (acc, key) { | ||
var _extends2; | ||
return _extends({}, acc, (_extends2 = {}, _extends2[key] = _this2.createErrorHandler(formObject[key]), _extends2)); | ||
}, handler); | ||
} | ||
if (Array.isArray(formData)) { | ||
return formData.reduce(function (acc, value, key) { | ||
var _extends3; | ||
return _extends({}, acc, (_extends3 = {}, _extends3[key] = _this2.createErrorHandler(value), _extends3)); | ||
}, handler); | ||
} | ||
return handler; | ||
} | ||
/** Unwraps the `errorHandler` structure into the associated `ErrorSchema`, stripping the `addError` functions from it | ||
* | ||
* @param errorHandler - The `FormValidation` error handling structure | ||
* @private | ||
*/; | ||
_proto.unwrapErrorHandler = function unwrapErrorHandler(errorHandler) { | ||
var _this3 = this; | ||
return Object.keys(errorHandler).reduce(function (acc, key) { | ||
var _extends5; | ||
if (key === 'addError') { | ||
return acc; | ||
} else if (key === utils.ERRORS_KEY) { | ||
var _extends4; | ||
return _extends({}, acc, (_extends4 = {}, _extends4[key] = errorHandler[key], _extends4)); | ||
} | ||
return _extends({}, acc, (_extends5 = {}, _extends5[key] = _this3.unwrapErrorHandler(errorHandler[key]), _extends5)); | ||
}, {}); | ||
} | ||
/** Transforming the error output from ajv to format used by @rjsf/utils. | ||
@@ -286,3 +179,3 @@ * At some point, components should be updated to support ajv. | ||
} | ||
var errorSchema = this.toErrorSchema(errors); | ||
var errorSchema = utils.toErrorSchema(errors); | ||
if (noProperMetaSchema) { | ||
@@ -303,5 +196,5 @@ errorSchema = _extends({}, errorSchema, { | ||
var newFormData = utils.getDefaultFormState(this, schema, formData, rootSchema, true); | ||
var errorHandler = customValidate(newFormData, this.createErrorHandler(newFormData), uiSchema); | ||
var userErrorSchema = this.unwrapErrorHandler(errorHandler); | ||
return utils.mergeValidationData(this, { | ||
var errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema); | ||
var userErrorSchema = utils.unwrapErrorHandler(errorHandler); | ||
return utils.validationDataMerge({ | ||
errors: errors, | ||
@@ -311,32 +204,2 @@ errorSchema: errorSchema | ||
} | ||
/** Takes a `node` object and transforms any contained `$ref` node variables with a prefix, recursively calling | ||
* `withIdRefPrefix` for any other elements. | ||
* | ||
* @param node - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @private | ||
*/; | ||
_proto.withIdRefPrefixObject = function withIdRefPrefixObject(node) { | ||
for (var key in node) { | ||
var realObj = node; | ||
var value = realObj[key]; | ||
if (key === utils.REF_KEY && typeof value === 'string' && value.startsWith('#')) { | ||
realObj[key] = ROOT_SCHEMA_PREFIX + value; | ||
} else { | ||
realObj[key] = this.withIdRefPrefix(value); | ||
} | ||
} | ||
return node; | ||
} | ||
/** Takes a `node` object list and transforms any contained `$ref` node variables with a prefix, recursively calling | ||
* `withIdRefPrefix` for any other elements. | ||
* | ||
* @param node - The list of object nodes to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @private | ||
*/; | ||
_proto.withIdRefPrefixArray = function withIdRefPrefixArray(node) { | ||
for (var i = 0; i < node.length; i++) { | ||
node[i] = this.withIdRefPrefix(node[i]); | ||
} | ||
return node; | ||
} | ||
/** Validates data against a schema, returning true if the data is valid, or | ||
@@ -356,3 +219,3 @@ * false otherwise. If the schema is invalid, then this function will return | ||
// that lives in the rootSchema but not in the schema in question. | ||
var result = this.ajv.addSchema(rootSchema, ROOT_SCHEMA_PREFIX).validate(this.withIdRefPrefix(schema), formData); | ||
var result = this.ajv.addSchema(rootSchema, utils.ROOT_SCHEMA_PREFIX).validate(utils.withIdRefPrefix(schema), formData); | ||
return result; | ||
@@ -363,19 +226,4 @@ } catch (e) { | ||
// make sure we remove the rootSchema from the global ajv instance | ||
this.ajv.removeSchema(ROOT_SCHEMA_PREFIX); | ||
this.ajv.removeSchema(utils.ROOT_SCHEMA_PREFIX); | ||
} | ||
} | ||
/** Recursively prefixes all $ref's in a schema with `ROOT_SCHEMA_PREFIX` | ||
* This is used in isValid to make references to the rootSchema | ||
* | ||
* @param schemaNode - The object node to which a ROOT_SCHEMA_PREFIX is added when a REF_KEY is part of it | ||
* @protected | ||
*/; | ||
_proto.withIdRefPrefix = function withIdRefPrefix(schemaNode) { | ||
if (schemaNode.constructor === Object) { | ||
return this.withIdRefPrefixObject(_extends({}, schemaNode)); | ||
} | ||
if (Array.isArray(schemaNode)) { | ||
return this.withIdRefPrefixArray([].concat(schemaNode)); | ||
} | ||
return schemaNode; | ||
}; | ||
@@ -382,0 +230,0 @@ return AJV6Validator; |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lodash-es/toPath"),require("@rjsf/utils"),require("ajv"),require("lodash-es/isObject")):"function"==typeof define&&define.amd?define(["exports","lodash-es/toPath","@rjsf/utils","ajv","lodash-es/isObject"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self)["@rjsf/validator-ajv6"]={},r.toPath,r.utils,r.Ajv,r.isObject)}(this,(function(r,e,t,a,o){"use strict";function i(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var n=i(e),s=i(a),c=i(o);function u(){return u=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a])}return r},u.apply(this,arguments)}var d={errorDataPath:"property",allErrors:!0,multipleOfPrecision:8,schemaId:"auto",unknownFormats:"ignore"},f=/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,h=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/,l="__rjsf_rootSchema",v=function(){function r(r){this.ajv=void 0,this.ajv=function(r,e,t){void 0===t&&(t={});var a=new s.default(u({},d,t));return a.addFormat("data-url",h),a.addFormat("color",f),Array.isArray(r)&&a.addMetaSchema(r),c.default(e)&&Object.keys(e).forEach((function(r){a.addFormat(r,e[r])})),a}(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides)}var e=r.prototype;return e.toErrorSchema=function(r){var e=new t.ErrorSchemaBuilder;return r.length&&r.forEach((function(r){var t=r.message,a=n.default(r.property);a.length>0&&""===a[0]&&a.splice(0,1),t&&e.addErrors(t,a)})),e.ErrorSchema},e.toErrorList=function(r,e){var a=this;if(void 0===e&&(e=[]),!r)return[];var o=[];return t.ERRORS_KEY in r&&(o=o.concat(r.__errors.map((function(r){var t="."+e.join(".");return{property:t,message:r,stack:t+" "+r}})))),Object.keys(r).reduce((function(o,i){return i!==t.ERRORS_KEY&&(o=o.concat(a.toErrorList(r[i],[].concat(e,[i])))),o}),o)},e.createErrorHandler=function(r){var e=this,a={__errors:[],addError:function(r){this.__errors.push(r)}};if(t.isObject(r)){var o=r;return Object.keys(o).reduce((function(r,t){var a;return u({},r,((a={})[t]=e.createErrorHandler(o[t]),a))}),a)}return Array.isArray(r)?r.reduce((function(r,t,a){var o;return u({},r,((o={})[a]=e.createErrorHandler(t),o))}),a):a},e.unwrapErrorHandler=function(r){var e=this;return Object.keys(r).reduce((function(a,o){var i,n;return"addError"===o?a:u({},a,o===t.ERRORS_KEY?((n={})[o]=r[o],n):((i={})[o]=e.unwrapErrorHandler(r[o]),i))}),{})},e.transformRJSFValidationErrors=function(r){return void 0===r&&(r=[]),r.map((function(r){var e=r.message,t=r.schemaPath,a=""+r.dataPath;return{name:r.keyword,property:a,message:e,params:r.params,stack:(a+" "+e).trim(),schemaPath:t}}))},e.rawValidation=function(r,e){var t=void 0;try{this.ajv.validate(r,e)}catch(r){t=r}var a=this.ajv.errors||void 0;return this.ajv.errors=null,{errors:a,validationError:t}},e.validateFormData=function(r,e,a,o,i){var n=e,s=this.rawValidation(e,r),c=s.validationError,d=this.transformRJSFValidationErrors(s.errors),f=c&&c.message&&c.message.includes("no schema with key or ref ");f&&(d=[].concat(d,[{stack:c.message}])),"function"==typeof o&&(d=o(d,i));var h=this.toErrorSchema(d);if(f&&(h=u({},h,{$schema:{__errors:[c.message]}})),"function"!=typeof a)return{errors:d,errorSchema:h};var l=t.getDefaultFormState(this,e,r,n,!0),v=a(l,this.createErrorHandler(l),i),m=this.unwrapErrorHandler(v);return t.mergeValidationData(this,{errors:d,errorSchema:h},m)},e.withIdRefPrefixObject=function(r){for(var e in r){var a=r[e];r[e]=e===t.REF_KEY&&"string"==typeof a&&a.startsWith("#")?l+a:this.withIdRefPrefix(a)}return r},e.withIdRefPrefixArray=function(r){for(var e=0;e<r.length;e++)r[e]=this.withIdRefPrefix(r[e]);return r},e.isValid=function(r,e,t){try{return this.ajv.addSchema(t,l).validate(this.withIdRefPrefix(r),e)}catch(r){return!1}finally{this.ajv.removeSchema(l)}},e.withIdRefPrefix=function(r){return r.constructor===Object?this.withIdRefPrefixObject(u({},r)):Array.isArray(r)?this.withIdRefPrefixArray([].concat(r)):r},r}();function m(r){return void 0===r&&(r={}),new v(r)}var p=m();r.customizeValidator=m,r.default=p,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(r,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("@rjsf/utils"),require("ajv"),require("lodash-es/isObject")):"function"==typeof define&&define.amd?define(["exports","@rjsf/utils","ajv","lodash-es/isObject"],a):a((r="undefined"!=typeof globalThis?globalThis:r||self)["@rjsf/validator-ajv6"]={},r.utils,r.Ajv,r.isObject)}(this,(function(r,a,e,t){"use strict";function o(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var i=o(e),s=o(t);function n(){return n=Object.assign?Object.assign.bind():function(r){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},n.apply(this,arguments)}var d={errorDataPath:"property",allErrors:!0,multipleOfPrecision:8,schemaId:"auto",unknownFormats:"ignore"},u=/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,c=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/,l=function(){function r(r){this.ajv=void 0,this.ajv=function(r,a,e){void 0===e&&(e={});var t=new i.default(n({},d,e));return t.addFormat("data-url",c),t.addFormat("color",u),Array.isArray(r)&&t.addMetaSchema(r),s.default(a)&&Object.keys(a).forEach((function(r){t.addFormat(r,a[r])})),t}(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides)}var e=r.prototype;return e.toErrorList=function(r,e){return void 0===e&&(e=[]),a.toErrorList(r,e)},e.transformRJSFValidationErrors=function(r){return void 0===r&&(r=[]),r.map((function(r){var a=r.message,e=r.schemaPath,t=""+r.dataPath;return{name:r.keyword,property:t,message:a,params:r.params,stack:(t+" "+a).trim(),schemaPath:e}}))},e.rawValidation=function(r,a){var e=void 0;try{this.ajv.validate(r,a)}catch(r){e=r}var t=this.ajv.errors||void 0;return this.ajv.errors=null,{errors:t,validationError:e}},e.validateFormData=function(r,e,t,o,i){var s=e,d=this.rawValidation(e,r),u=d.validationError,c=this.transformRJSFValidationErrors(d.errors),l=u&&u.message&&u.message.includes("no schema with key or ref ");l&&(c=[].concat(c,[{stack:u.message}])),"function"==typeof o&&(c=o(c,i));var f=a.toErrorSchema(c);if(l&&(f=n({},f,{$schema:{__errors:[u.message]}})),"function"!=typeof t)return{errors:c,errorSchema:f};var v=a.getDefaultFormState(this,e,r,s,!0),h=t(v,a.createErrorHandler(v),i),m=a.unwrapErrorHandler(h);return a.validationDataMerge({errors:c,errorSchema:f},m)},e.isValid=function(r,e,t){try{return this.ajv.addSchema(t,a.ROOT_SCHEMA_PREFIX).validate(a.withIdRefPrefix(r),e)}catch(r){return!1}finally{this.ajv.removeSchema(a.ROOT_SCHEMA_PREFIX)}},r}();function f(r){return void 0===r&&(r={}),new l(r)}var v=f();r.customizeValidator=f,r.default=v,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=validator-ajv6.umd.production.min.js.map |
{ | ||
"name": "@rjsf/validator-ajv6", | ||
"version": "5.5.2", | ||
"version": "5.6.0", | ||
"main": "dist/index.js", | ||
@@ -44,3 +44,3 @@ "module": "dist/validator-ajv6.esm.js", | ||
"@babel/preset-react": "^7.18.6", | ||
"@rjsf/utils": "^5.5.2", | ||
"@rjsf/utils": "^5.6.0", | ||
"@types/jest-expect-message": "^1.1.0", | ||
@@ -50,5 +50,5 @@ "@types/json-schema": "^7.0.9", | ||
"dts-cli": "^1.6.3", | ||
"eslint": "^8.37.0", | ||
"eslint": "^8.38.0", | ||
"jest-expect-message": "^1.1.3", | ||
"rimraf": "^4.4.1" | ||
"rimraf": "^5.0.0" | ||
}, | ||
@@ -76,3 +76,3 @@ "publishConfig": { | ||
"license": "Apache-2.0", | ||
"gitHead": "08efac27710f0cd11da87199cc98bf406efd8381" | ||
"gitHead": "1caa67c7dcafa76eecf938c7668b9ee799d34789" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137285
764