@rjsf/validator-ajv8
Advanced tools
Comparing version 5.7.3 to 5.8.0
@@ -286,2 +286,7 @@ 'use strict'; | ||
this.rootSchema = void 0; | ||
/** The root schema resolved top level refs | ||
* | ||
* @private | ||
*/ | ||
this.resolvedRootSchema = void 0; | ||
/** The `ValidatorFunctions` map used to construct this validator | ||
@@ -306,2 +311,3 @@ * | ||
this.mainValidator = this.getValidator(rootSchema); | ||
this.resolvedRootSchema = utils.retrieveSchema(this, rootSchema, rootSchema); | ||
} | ||
@@ -344,3 +350,3 @@ /** Returns the precompiled validator associated with the given `schema` from the map of precompiled validator | ||
_proto.rawValidation = function rawValidation(schema, formData) { | ||
if (!isEqual__default["default"](schema, this.rootSchema)) { | ||
if (!isEqual__default["default"](schema, this.resolvedRootSchema)) { | ||
throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation'); | ||
@@ -347,0 +353,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@rjsf/utils"),t=require("./createAjvInstance-0cd8cfba.js"),e=require("lodash/get"),a=require("lodash/isEqual");function i(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}require("ajv"),require("ajv-formats"),require("lodash/isObject");var o=i(e),s=i(a),n=["instancePath","keyword","params","schemaPath","parentSchema"];function c(e,a,i,s,c,l,h){var d=a.validationError,u=function(e,a){return void 0===e&&(e=[]),e.map((function(e){var i=e.instancePath,s=e.keyword,c=e.params,l=e.schemaPath,h=e.parentSchema,d=t._objectWithoutPropertiesLoose(e,n).message,u=void 0===d?"":d,v=i.replace(/\//g,"."),m=(v+" "+u).trim();if("missingProperty"in c){var f=c.missingProperty,p=r.getUiOptions(o.default(a,""+(v=v?v+"."+c.missingProperty:c.missingProperty).replace(/^\./,""))).title;if(p)u=u.replace(f,p);else{var E=o.default(h,[r.PROPERTIES_KEY,f,"title"]);E&&(u=u.replace(f,E))}m=u}else{var g=r.getUiOptions(o.default(a,""+v.replace(/^\./,""))).title;if(g)m=("'"+g+"' "+u).trim();else{var j=null==h?void 0:h.title;j&&(m=("'"+j+"' "+u).trim())}}return{name:s,property:v,message:u,params:c,stack:m,schemaPath:l}}))}(a.errors,h);d&&(u=[].concat(u,[{stack:d.message}])),"function"==typeof l&&(u=l(u,h));var v=r.toErrorSchema(u);if(d&&(v=t._extends({},v,{$schema:{__errors:[d.message]}})),"function"!=typeof c)return{errors:u,errorSchema:v};var m=r.getDefaultFormState(e,s,i,s,!0),f=c(m,r.createErrorHandler(m),h),p=r.unwrapErrorHandler(f);return r.validationDataMerge({errors:u,errorSchema:v},p)}var l=function(){function e(r,e){this.ajv=void 0,this.localizer=void 0,this.ajv=t.createAjvInstance(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides,r.ajvFormatOptions,r.AjvClass),this.localizer=e}var a=e.prototype;return a.toErrorList=function(t,e){return void 0===e&&(e=[]),r.toErrorList(t,e)},a.rawValidation=function(t,e){var a,i,o=void 0;t[r.ID_KEY]&&(a=this.ajv.getSchema(t[r.ID_KEY]));try{void 0===a&&(a=this.ajv.compile(t)),a(e)}catch(r){o=r}return a&&("function"==typeof this.localizer&&this.localizer(a.errors),i=a.errors||void 0,a.errors=null),{errors:i,validationError:o}},a.validateFormData=function(r,t,e,a,i){return c(this,this.rawValidation(t,r),r,t,e,a,i)},a.isValid=function(t,e,a){var i,o=null!=(i=a[r.ID_KEY])?i:r.ROOT_SCHEMA_PREFIX;try{void 0===this.ajv.getSchema(o)&&this.ajv.addSchema(a,o);var s,n=r.withIdRefPrefix(t);return n[r.ID_KEY]&&(s=this.ajv.getSchema(n[r.ID_KEY])),void 0===s&&(s=this.ajv.compile(n)),s(e)}catch(r){return console.warn("Error encountered compiling schema:",r),!1}finally{this.ajv.removeSchema(o)}},e}();function h(r,t){return void 0===r&&(r={}),new l(r,t)}var d=function(){function t(r,t,e){this.rootSchema=void 0,this.validateFns=void 0,this.mainValidator=void 0,this.localizer=void 0,this.rootSchema=t,this.validateFns=r,this.localizer=e,this.mainValidator=this.getValidator(t)}var e=t.prototype;return e.getValidator=function(t){var e=o.default(t,r.ID_KEY)||r.hashForSchema(t),a=this.validateFns[e];if(!a)throw new Error('No precompiled validator function was found for the given schema for "'+e+'"');return a},e.toErrorList=function(t,e){return void 0===e&&(e=[]),r.toErrorList(t,e)},e.rawValidation=function(r,t){if(!s.default(r,this.rootSchema))throw new Error("The schema associated with the precompiled schema differs from the schema provided for validation");this.mainValidator(t),"function"==typeof this.localizer&&this.localizer(this.mainValidator.errors);var e=this.mainValidator.errors||void 0;return this.mainValidator.errors=null,{errors:e}},e.validateFormData=function(r,t,e,a,i){return c(this,this.rawValidation(t,r),r,t,e,a,i)},e.isValid=function(t,e,a){if(!s.default(a,this.rootSchema))throw new Error("The schema associated with the precompiled validator differs from the rootSchema provided for validation");return o.default(t,r.ID_KEY)!==r.JUNK_OPTION_ID&&this.getValidator(t)(e)},t}(),u=h();exports.createPrecompiledValidator=function(r,t,e){return new d(r,t,e)},exports.customizeValidator=h,exports.default=u; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@rjsf/utils"),e=require("./createAjvInstance-0cd8cfba.js"),t=require("lodash/get"),a=require("lodash/isEqual");function i(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}require("ajv"),require("ajv-formats"),require("lodash/isObject");var o=i(t),s=i(a),n=["instancePath","keyword","params","schemaPath","parentSchema"];function c(t,a,i,s,c,l,h){var d=a.validationError,u=function(t,a){return void 0===t&&(t=[]),t.map((function(t){var i=t.instancePath,s=t.keyword,c=t.params,l=t.schemaPath,h=t.parentSchema,d=e._objectWithoutPropertiesLoose(t,n).message,u=void 0===d?"":d,v=i.replace(/\//g,"."),m=(v+" "+u).trim();if("missingProperty"in c){var f=c.missingProperty,p=r.getUiOptions(o.default(a,""+(v=v?v+"."+c.missingProperty:c.missingProperty).replace(/^\./,""))).title;if(p)u=u.replace(f,p);else{var E=o.default(h,[r.PROPERTIES_KEY,f,"title"]);E&&(u=u.replace(f,E))}m=u}else{var S=r.getUiOptions(o.default(a,""+v.replace(/^\./,""))).title;if(S)m=("'"+S+"' "+u).trim();else{var g=null==h?void 0:h.title;g&&(m=("'"+g+"' "+u).trim())}}return{name:s,property:v,message:u,params:c,stack:m,schemaPath:l}}))}(a.errors,h);d&&(u=[].concat(u,[{stack:d.message}])),"function"==typeof l&&(u=l(u,h));var v=r.toErrorSchema(u);if(d&&(v=e._extends({},v,{$schema:{__errors:[d.message]}})),"function"!=typeof c)return{errors:u,errorSchema:v};var m=r.getDefaultFormState(t,s,i,s,!0),f=c(m,r.createErrorHandler(m),h),p=r.unwrapErrorHandler(f);return r.validationDataMerge({errors:u,errorSchema:v},p)}var l=function(){function t(r,t){this.ajv=void 0,this.localizer=void 0,this.ajv=e.createAjvInstance(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides,r.ajvFormatOptions,r.AjvClass),this.localizer=t}var a=t.prototype;return a.toErrorList=function(e,t){return void 0===t&&(t=[]),r.toErrorList(e,t)},a.rawValidation=function(e,t){var a,i,o=void 0;e[r.ID_KEY]&&(a=this.ajv.getSchema(e[r.ID_KEY]));try{void 0===a&&(a=this.ajv.compile(e)),a(t)}catch(r){o=r}return a&&("function"==typeof this.localizer&&this.localizer(a.errors),i=a.errors||void 0,a.errors=null),{errors:i,validationError:o}},a.validateFormData=function(r,e,t,a,i){return c(this,this.rawValidation(e,r),r,e,t,a,i)},a.isValid=function(e,t,a){var i,o=null!=(i=a[r.ID_KEY])?i:r.ROOT_SCHEMA_PREFIX;try{void 0===this.ajv.getSchema(o)&&this.ajv.addSchema(a,o);var s,n=r.withIdRefPrefix(e);return n[r.ID_KEY]&&(s=this.ajv.getSchema(n[r.ID_KEY])),void 0===s&&(s=this.ajv.compile(n)),s(t)}catch(r){return console.warn("Error encountered compiling schema:",r),!1}finally{this.ajv.removeSchema(o)}},t}();function h(r,e){return void 0===r&&(r={}),new l(r,e)}var d=function(){function e(e,t,a){this.rootSchema=void 0,this.resolvedRootSchema=void 0,this.validateFns=void 0,this.mainValidator=void 0,this.localizer=void 0,this.rootSchema=t,this.validateFns=e,this.localizer=a,this.mainValidator=this.getValidator(t),this.resolvedRootSchema=r.retrieveSchema(this,t,t)}var t=e.prototype;return t.getValidator=function(e){var t=o.default(e,r.ID_KEY)||r.hashForSchema(e),a=this.validateFns[t];if(!a)throw new Error('No precompiled validator function was found for the given schema for "'+t+'"');return a},t.toErrorList=function(e,t){return void 0===t&&(t=[]),r.toErrorList(e,t)},t.rawValidation=function(r,e){if(!s.default(r,this.resolvedRootSchema))throw new Error("The schema associated with the precompiled schema differs from the schema provided for validation");this.mainValidator(e),"function"==typeof this.localizer&&this.localizer(this.mainValidator.errors);var t=this.mainValidator.errors||void 0;return this.mainValidator.errors=null,{errors:t}},t.validateFormData=function(r,e,t,a,i){return c(this,this.rawValidation(e,r),r,e,t,a,i)},t.isValid=function(e,t,a){if(!s.default(a,this.rootSchema))throw new Error("The schema associated with the precompiled validator differs from the rootSchema provided for validation");return o.default(e,r.ID_KEY)!==r.JUNK_OPTION_ID&&this.getValidator(e)(t)},e}(),u=h();exports.createPrecompiledValidator=function(r,e,t){return new d(r,e,t)},exports.customizeValidator=h,exports.default=u; | ||
//# sourceMappingURL=index.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { ADDITIONAL_PROPERTY_FLAG, RJSF_ADDITONAL_PROPERTIES_FLAG, toErrorSchema, getDefaultFormState, createErrorHandler, unwrapErrorHandler, validationDataMerge, getUiOptions, PROPERTIES_KEY, toErrorList, ID_KEY, withIdRefPrefix, ROOT_SCHEMA_PREFIX, hashForSchema, JUNK_OPTION_ID } from '@rjsf/utils'; | ||
import { ADDITIONAL_PROPERTY_FLAG, RJSF_ADDITONAL_PROPERTIES_FLAG, toErrorSchema, getDefaultFormState, createErrorHandler, unwrapErrorHandler, validationDataMerge, getUiOptions, PROPERTIES_KEY, toErrorList, ID_KEY, withIdRefPrefix, ROOT_SCHEMA_PREFIX, retrieveSchema, hashForSchema, JUNK_OPTION_ID } from '@rjsf/utils'; | ||
import Ajv from 'ajv'; | ||
@@ -358,2 +358,7 @@ import addFormats from 'ajv-formats'; | ||
this.rootSchema = void 0; | ||
/** The root schema resolved top level refs | ||
* | ||
* @private | ||
*/ | ||
this.resolvedRootSchema = void 0; | ||
/** The `ValidatorFunctions` map used to construct this validator | ||
@@ -378,2 +383,3 @@ * | ||
this.mainValidator = this.getValidator(rootSchema); | ||
this.resolvedRootSchema = retrieveSchema(this, rootSchema, rootSchema); | ||
} | ||
@@ -416,3 +422,3 @@ /** Returns the precompiled validator associated with the given `schema` from the map of precompiled validator | ||
_proto.rawValidation = function rawValidation(schema, formData) { | ||
if (!isEqual(schema, this.rootSchema)) { | ||
if (!isEqual(schema, this.resolvedRootSchema)) { | ||
throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation'); | ||
@@ -419,0 +425,0 @@ } |
@@ -365,2 +365,7 @@ (function (global, factory) { | ||
this.rootSchema = void 0; | ||
/** The root schema resolved top level refs | ||
* | ||
* @private | ||
*/ | ||
this.resolvedRootSchema = void 0; | ||
/** The `ValidatorFunctions` map used to construct this validator | ||
@@ -385,2 +390,3 @@ * | ||
this.mainValidator = this.getValidator(rootSchema); | ||
this.resolvedRootSchema = utils.retrieveSchema(this, rootSchema, rootSchema); | ||
} | ||
@@ -423,3 +429,3 @@ /** Returns the precompiled validator associated with the given `schema` from the map of precompiled validator | ||
_proto.rawValidation = function rawValidation(schema, formData) { | ||
if (!isEqual__default["default"](schema, this.rootSchema)) { | ||
if (!isEqual__default["default"](schema, this.resolvedRootSchema)) { | ||
throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation'); | ||
@@ -426,0 +432,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@rjsf/utils"),require("ajv"),require("ajv-formats"),require("lodash-es/isObject"),require("lodash-es/get"),require("lodash-es/isEqual")):"function"==typeof define&&define.amd?define(["exports","@rjsf/utils","ajv","ajv-formats","lodash-es/isObject","lodash-es/get","lodash-es/isEqual"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self)["@rjsf/validator-ajv8"]={},r.utils,r.Ajv,r.addFormats,r.isObject,r.get,r.isEqual)}(this,(function(r,e,t,a,i,o,s){"use strict";function n(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var l=n(t),d=n(a),c=n(i),u=n(o),h=n(s);function f(){return f=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},f.apply(this,arguments)}var v={allErrors:!0,multipleOfPrecision:8,strict:!1,verbose:!0},m=/^(#?([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*\)))$/,p=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/,g=["instancePath","keyword","params","schemaPath","parentSchema"];function y(r,t,a,i,o,s,n){var l=t.validationError,d=function(r,t){return void 0===r&&(r=[]),r.map((function(r){var a=r.instancePath,i=r.keyword,o=r.params,s=r.schemaPath,n=r.parentSchema,l=function(r,e){if(null==r)return{};var t,a,i={},o=Object.keys(r);for(a=0;a<o.length;a++)e.indexOf(t=o[a])>=0||(i[t]=r[t]);return i}(r,g).message,d=void 0===l?"":l,c=a.replace(/\//g,"."),h=(c+" "+d).trim();if("missingProperty"in o){var f=o.missingProperty,v=e.getUiOptions(u.default(t,""+(c=c?c+"."+o.missingProperty:o.missingProperty).replace(/^\./,""))).title;if(v)d=d.replace(f,v);else{var m=u.default(n,[e.PROPERTIES_KEY,f,"title"]);m&&(d=d.replace(f,m))}h=d}else{var p=e.getUiOptions(u.default(t,""+c.replace(/^\./,""))).title;if(p)h=("'"+p+"' "+d).trim();else{var y=null==n?void 0:n.title;y&&(h=("'"+y+"' "+d).trim())}}return{name:i,property:c,message:d,params:o,stack:h,schemaPath:s}}))}(t.errors,n);l&&(d=[].concat(d,[{stack:l.message}])),"function"==typeof s&&(d=s(d,n));var c=e.toErrorSchema(d);if(l&&(c=f({},c,{$schema:{__errors:[l.message]}})),"function"!=typeof o)return{errors:d,errorSchema:c};var h=e.getDefaultFormState(r,i,a,i,!0),v=o(h,e.createErrorHandler(h),n),m=e.unwrapErrorHandler(v);return e.validationDataMerge({errors:d,errorSchema:c},m)}var E=function(){function r(r,t){this.ajv=void 0,this.localizer=void 0,this.ajv=function(r,t,a,i,o){void 0===a&&(a={}),void 0===o&&(o=l.default);var s=new o(f({},v,a));return i?d.default(s,i):!1!==i&&d.default(s),s.addFormat("data-url",p),s.addFormat("color",m),s.addKeyword(e.ADDITIONAL_PROPERTY_FLAG),s.addKeyword(e.RJSF_ADDITONAL_PROPERTIES_FLAG),Array.isArray(r)&&s.addMetaSchema(r),c.default(t)&&Object.keys(t).forEach((function(r){s.addFormat(r,t[r])})),s}(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides,r.ajvFormatOptions,r.AjvClass),this.localizer=t}var t=r.prototype;return t.toErrorList=function(r,t){return void 0===t&&(t=[]),e.toErrorList(r,t)},t.rawValidation=function(r,t){var a,i,o=void 0;r[e.ID_KEY]&&(a=this.ajv.getSchema(r[e.ID_KEY]));try{void 0===a&&(a=this.ajv.compile(r)),a(t)}catch(r){o=r}return a&&("function"==typeof this.localizer&&this.localizer(a.errors),i=a.errors||void 0,a.errors=null),{errors:i,validationError:o}},t.validateFormData=function(r,e,t,a,i){return y(this,this.rawValidation(e,r),r,e,t,a,i)},t.isValid=function(r,t,a){var i,o=null!=(i=a[e.ID_KEY])?i:e.ROOT_SCHEMA_PREFIX;try{void 0===this.ajv.getSchema(o)&&this.ajv.addSchema(a,o);var s,n=e.withIdRefPrefix(r);return n[e.ID_KEY]&&(s=this.ajv.getSchema(n[e.ID_KEY])),void 0===s&&(s=this.ajv.compile(n)),s(t)}catch(r){return console.warn("Error encountered compiling schema:",r),!1}finally{this.ajv.removeSchema(o)}},r}();function j(r,e){return void 0===r&&(r={}),new E(r,e)}var b=function(){function r(r,e,t){this.rootSchema=void 0,this.validateFns=void 0,this.mainValidator=void 0,this.localizer=void 0,this.rootSchema=e,this.validateFns=r,this.localizer=t,this.mainValidator=this.getValidator(e)}var t=r.prototype;return t.getValidator=function(r){var t=u.default(r,e.ID_KEY)||e.hashForSchema(r),a=this.validateFns[t];if(!a)throw new Error('No precompiled validator function was found for the given schema for "'+t+'"');return a},t.toErrorList=function(r,t){return void 0===t&&(t=[]),e.toErrorList(r,t)},t.rawValidation=function(r,e){if(!h.default(r,this.rootSchema))throw new Error("The schema associated with the precompiled schema differs from the schema provided for validation");this.mainValidator(e),"function"==typeof this.localizer&&this.localizer(this.mainValidator.errors);var t=this.mainValidator.errors||void 0;return this.mainValidator.errors=null,{errors:t}},t.validateFormData=function(r,e,t,a,i){return y(this,this.rawValidation(e,r),r,e,t,a,i)},t.isValid=function(r,t,a){if(!h.default(a,this.rootSchema))throw new Error("The schema associated with the precompiled validator differs from the rootSchema provided for validation");return u.default(r,e.ID_KEY)!==e.JUNK_OPTION_ID&&this.getValidator(r)(t)},r}(),w=j();r.createPrecompiledValidator=function(r,e,t){return new b(r,e,t)},r.customizeValidator=j,r.default=w,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@rjsf/utils"),require("ajv"),require("ajv-formats"),require("lodash-es/isObject"),require("lodash-es/get"),require("lodash-es/isEqual")):"function"==typeof define&&define.amd?define(["exports","@rjsf/utils","ajv","ajv-formats","lodash-es/isObject","lodash-es/get","lodash-es/isEqual"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self)["@rjsf/validator-ajv8"]={},r.utils,r.Ajv,r.addFormats,r.isObject,r.get,r.isEqual)}(this,(function(r,e,t,a,i,o,s){"use strict";function n(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var l=n(t),d=n(a),c=n(i),h=n(o),u=n(s);function f(){return f=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},f.apply(this,arguments)}var v={allErrors:!0,multipleOfPrecision:8,strict:!1,verbose:!0},m=/^(#?([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*\)))$/,p=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/,g=["instancePath","keyword","params","schemaPath","parentSchema"];function y(r,t,a,i,o,s,n){var l=t.validationError,d=function(r,t){return void 0===r&&(r=[]),r.map((function(r){var a=r.instancePath,i=r.keyword,o=r.params,s=r.schemaPath,n=r.parentSchema,l=function(r,e){if(null==r)return{};var t,a,i={},o=Object.keys(r);for(a=0;a<o.length;a++)e.indexOf(t=o[a])>=0||(i[t]=r[t]);return i}(r,g).message,d=void 0===l?"":l,c=a.replace(/\//g,"."),u=(c+" "+d).trim();if("missingProperty"in o){var f=o.missingProperty,v=e.getUiOptions(h.default(t,""+(c=c?c+"."+o.missingProperty:o.missingProperty).replace(/^\./,""))).title;if(v)d=d.replace(f,v);else{var m=h.default(n,[e.PROPERTIES_KEY,f,"title"]);m&&(d=d.replace(f,m))}u=d}else{var p=e.getUiOptions(h.default(t,""+c.replace(/^\./,""))).title;if(p)u=("'"+p+"' "+d).trim();else{var y=null==n?void 0:n.title;y&&(u=("'"+y+"' "+d).trim())}}return{name:i,property:c,message:d,params:o,stack:u,schemaPath:s}}))}(t.errors,n);l&&(d=[].concat(d,[{stack:l.message}])),"function"==typeof s&&(d=s(d,n));var c=e.toErrorSchema(d);if(l&&(c=f({},c,{$schema:{__errors:[l.message]}})),"function"!=typeof o)return{errors:d,errorSchema:c};var u=e.getDefaultFormState(r,i,a,i,!0),v=o(u,e.createErrorHandler(u),n),m=e.unwrapErrorHandler(v);return e.validationDataMerge({errors:d,errorSchema:c},m)}var E=function(){function r(r,t){this.ajv=void 0,this.localizer=void 0,this.ajv=function(r,t,a,i,o){void 0===a&&(a={}),void 0===o&&(o=l.default);var s=new o(f({},v,a));return i?d.default(s,i):!1!==i&&d.default(s),s.addFormat("data-url",p),s.addFormat("color",m),s.addKeyword(e.ADDITIONAL_PROPERTY_FLAG),s.addKeyword(e.RJSF_ADDITONAL_PROPERTIES_FLAG),Array.isArray(r)&&s.addMetaSchema(r),c.default(t)&&Object.keys(t).forEach((function(r){s.addFormat(r,t[r])})),s}(r.additionalMetaSchemas,r.customFormats,r.ajvOptionsOverrides,r.ajvFormatOptions,r.AjvClass),this.localizer=t}var t=r.prototype;return t.toErrorList=function(r,t){return void 0===t&&(t=[]),e.toErrorList(r,t)},t.rawValidation=function(r,t){var a,i,o=void 0;r[e.ID_KEY]&&(a=this.ajv.getSchema(r[e.ID_KEY]));try{void 0===a&&(a=this.ajv.compile(r)),a(t)}catch(r){o=r}return a&&("function"==typeof this.localizer&&this.localizer(a.errors),i=a.errors||void 0,a.errors=null),{errors:i,validationError:o}},t.validateFormData=function(r,e,t,a,i){return y(this,this.rawValidation(e,r),r,e,t,a,i)},t.isValid=function(r,t,a){var i,o=null!=(i=a[e.ID_KEY])?i:e.ROOT_SCHEMA_PREFIX;try{void 0===this.ajv.getSchema(o)&&this.ajv.addSchema(a,o);var s,n=e.withIdRefPrefix(r);return n[e.ID_KEY]&&(s=this.ajv.getSchema(n[e.ID_KEY])),void 0===s&&(s=this.ajv.compile(n)),s(t)}catch(r){return console.warn("Error encountered compiling schema:",r),!1}finally{this.ajv.removeSchema(o)}},r}();function j(r,e){return void 0===r&&(r={}),new E(r,e)}var b=function(){function r(r,t,a){this.rootSchema=void 0,this.resolvedRootSchema=void 0,this.validateFns=void 0,this.mainValidator=void 0,this.localizer=void 0,this.rootSchema=t,this.validateFns=r,this.localizer=a,this.mainValidator=this.getValidator(t),this.resolvedRootSchema=e.retrieveSchema(this,t,t)}var t=r.prototype;return t.getValidator=function(r){var t=h.default(r,e.ID_KEY)||e.hashForSchema(r),a=this.validateFns[t];if(!a)throw new Error('No precompiled validator function was found for the given schema for "'+t+'"');return a},t.toErrorList=function(r,t){return void 0===t&&(t=[]),e.toErrorList(r,t)},t.rawValidation=function(r,e){if(!u.default(r,this.resolvedRootSchema))throw new Error("The schema associated with the precompiled schema differs from the schema provided for validation");this.mainValidator(e),"function"==typeof this.localizer&&this.localizer(this.mainValidator.errors);var t=this.mainValidator.errors||void 0;return this.mainValidator.errors=null,{errors:t}},t.validateFormData=function(r,e,t,a,i){return y(this,this.rawValidation(e,r),r,e,t,a,i)},t.isValid=function(r,t,a){if(!u.default(a,this.rootSchema))throw new Error("The schema associated with the precompiled validator differs from the rootSchema provided for validation");return h.default(r,e.ID_KEY)!==e.JUNK_OPTION_ID&&this.getValidator(r)(t)},r}(),w=j();r.createPrecompiledValidator=function(r,e,t){return new b(r,e,t)},r.customizeValidator=j,r.default=w,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=validator-ajv8.umd.production.min.js.map |
{ | ||
"name": "@rjsf/validator-ajv8", | ||
"version": "5.7.3", | ||
"version": "5.8.0", | ||
"main": "dist/index.js", | ||
@@ -42,14 +42,15 @@ "module": "dist/validator-ajv8.esm.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.21.8", | ||
"@babel/core": "^7.22.1", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
"@babel/plugin-proposal-optional-chaining": "^7.21.0", | ||
"@babel/plugin-transform-modules-commonjs": "^7.21.5", | ||
"@babel/plugin-transform-react-jsx": "^7.21.5", | ||
"@babel/preset-env": "^7.21.5", | ||
"@babel/preset-react": "^7.18.6", | ||
"@rjsf/utils": "^5.7.3", | ||
"@babel/plugin-transform-react-jsx": "^7.22.3", | ||
"@babel/preset-env": "^7.22.4", | ||
"@babel/preset-react": "^7.22.3", | ||
"@rjsf/utils": "^5.8.0", | ||
"@types/jest-expect-message": "^1.1.0", | ||
"@types/json-schema": "^7.0.11", | ||
"@types/lodash": "^4.14.194", | ||
"@types/json-schema": "^7.0.12", | ||
"@types/lodash": "^4.14.195", | ||
"dts-cli": "^1.6.3", | ||
"eslint": "^8.41.0", | ||
"eslint": "^8.42.0", | ||
"jest-expect-message": "^1.1.3", | ||
@@ -79,3 +80,3 @@ "rimraf": "^5.0.1" | ||
"license": "Apache-2.0", | ||
"gitHead": "9d1a4389e5d759681f878717629337c92173f95d" | ||
"gitHead": "a5d6f031b2cf8ff065ddb34e27cd2ef6f2beda7e" | ||
} |
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
288036
1563
15