Socket
Socket
Sign inDemoInstall

@rjsf/validator-ajv8

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjsf/validator-ajv8 - npm Package Compare versions

Comparing version 5.10.0 to 5.11.1

dist/createAjvInstance-33d73c95.js

46

dist/compileSchemaValidators.cjs.development.js

@@ -5,6 +5,6 @@ 'use strict';

var createAjvInstance = require('./createAjvInstance-0cd8cfba.js');
var fs = require('fs');
var standaloneCode = require('ajv/dist/standalone');
var utils = require('@rjsf/utils');
var createAjvInstance = require('./createAjvInstance-33d73c95.js');
require('ajv');

@@ -30,28 +30,26 @@ require('ajv-formats');

*/
function compileSchemaValidators(schema, output, options) {
if (options === void 0) {
options = {};
}
function compileSchemaValidators(schema, output, options = {}) {
console.log('parsing the schema');
var schemaMaps = utils.schemaParser(schema);
var schemas = Object.values(schemaMaps);
var _options = options,
additionalMetaSchemas = _options.additionalMetaSchemas,
customFormats = _options.customFormats,
_options$ajvOptionsOv = _options.ajvOptionsOverrides,
ajvOptionsOverrides = _options$ajvOptionsOv === void 0 ? {} : _options$ajvOptionsOv,
ajvFormatOptions = _options.ajvFormatOptions,
AjvClass = _options.AjvClass;
const schemaMaps = utils.schemaParser(schema);
const schemas = Object.values(schemaMaps);
const {
additionalMetaSchemas,
customFormats,
ajvOptionsOverrides = {},
ajvFormatOptions,
AjvClass
} = options;
// Allow users to turn off the `lines: true` feature in their own overrides, but NOT the `source: true`
var compileOptions = createAjvInstance._extends({}, ajvOptionsOverrides, {
code: createAjvInstance._extends({
lines: true
}, ajvOptionsOverrides.code, {
const compileOptions = {
...ajvOptionsOverrides,
code: {
lines: true,
...ajvOptionsOverrides.code,
source: true
}),
schemas: schemas
});
var ajv = createAjvInstance.createAjvInstance(additionalMetaSchemas, customFormats, compileOptions, ajvFormatOptions, AjvClass);
var moduleCode = standaloneCode__default["default"](ajv);
console.log("writing " + output);
},
schemas
};
const ajv = createAjvInstance.createAjvInstance(additionalMetaSchemas, customFormats, compileOptions, ajvFormatOptions, AjvClass);
const moduleCode = standaloneCode__default["default"](ajv);
console.log(`writing ${output}`);
fs__default["default"].writeFileSync(output, moduleCode);

@@ -58,0 +56,0 @@ }

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createAjvInstance-0cd8cfba.js"),r=require("fs"),t=require("ajv/dist/standalone"),s=require("@rjsf/utils");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("ajv"),require("ajv-formats"),require("lodash/isObject");var i=a(r),o=a(t);exports.default=function(r,t,a){void 0===a&&(a={}),console.log("parsing the schema");var c=s.schemaParser(r),n=Object.values(c),u=a.additionalMetaSchemas,d=a.customFormats,l=a.ajvOptionsOverrides,v=void 0===l?{}:l,j=a.ajvFormatOptions,f=a.AjvClass,m=e._extends({},v,{code:e._extends({lines:!0},v.code,{source:!0}),schemas:n}),p=e.createAjvInstance(u,d,m,j,f),q=o.default(p);console.log("writing "+t),i.default.writeFileSync(t,q)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),r=require("ajv/dist/standalone"),t=require("@rjsf/utils"),s=require("./createAjvInstance-33d73c95.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("ajv"),require("ajv-formats"),require("lodash/isObject");var o=a(e),i=a(r);exports.default=function(e,r,a={}){console.log("parsing the schema");const c=t.schemaParser(e),n=Object.values(c),{additionalMetaSchemas:u,customFormats:l,ajvOptionsOverrides:d={},ajvFormatOptions:j,AjvClass:v}=a,f={...d,code:{lines:!0,...d.code,source:!0},schemas:n},m=s.createAjvInstance(u,l,f,j,v),p=i.default(m);console.log(`writing ${r}`),o.default.writeFileSync(r,p)};
//# sourceMappingURL=compileSchemaValidators.cjs.production.min.js.map

@@ -6,3 +6,3 @@ 'use strict';

var utils = require('@rjsf/utils');
var createAjvInstance = require('./createAjvInstance-0cd8cfba.js');
var createAjvInstance = require('./createAjvInstance-33d73c95.js');
var get = require('lodash/get');

@@ -19,3 +19,2 @@ var isEqual = require('lodash/isEqual');

var _excluded = ["instancePath", "keyword", "params", "schemaPath", "parentSchema"];
/** Transforming the error output from ajv to format used by @rjsf/utils.

@@ -27,25 +26,25 @@ * At some point, components should be updated to support ajv.

*/
function transformRJSFValidationErrors(errors, uiSchema) {
if (errors === void 0) {
errors = [];
}
return errors.map(function (e) {
var instancePath = e.instancePath,
keyword = e.keyword,
params = e.params,
schemaPath = e.schemaPath,
parentSchema = e.parentSchema,
rest = createAjvInstance._objectWithoutPropertiesLoose(e, _excluded);
var _rest$message = rest.message,
message = _rest$message === void 0 ? '' : _rest$message;
var property = instancePath.replace(/\//g, '.');
var stack = (property + " " + message).trim();
function transformRJSFValidationErrors(errors = [], uiSchema) {
return errors.map(e => {
const {
instancePath,
keyword,
params,
schemaPath,
parentSchema,
...rest
} = e;
let {
message = ''
} = rest;
let property = instancePath.replace(/\//g, '.');
let stack = `${property} ${message}`.trim();
if ('missingProperty' in params) {
property = property ? property + "." + params.missingProperty : params.missingProperty;
var currentProperty = params.missingProperty;
var uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, "" + property.replace(/^\./, ''))).title;
property = property ? `${property}.${params.missingProperty}` : params.missingProperty;
const currentProperty = params.missingProperty;
const uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, `${property.replace(/^\./, '')}`)).title;
if (uiSchemaTitle) {
message = message.replace(currentProperty, uiSchemaTitle);
} else {
var parentSchemaTitle = get__default["default"](parentSchema, [utils.PROPERTIES_KEY, currentProperty, 'title']);
const parentSchemaTitle = get__default["default"](parentSchema, [utils.PROPERTIES_KEY, currentProperty, 'title']);
if (parentSchemaTitle) {

@@ -57,9 +56,9 @@ message = message.replace(currentProperty, parentSchemaTitle);

} else {
var _uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, "" + property.replace(/^\./, ''))).title;
if (_uiSchemaTitle) {
stack = ("'" + _uiSchemaTitle + "' " + message).trim();
const uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, `${property.replace(/^\./, '')}`)).title;
if (uiSchemaTitle) {
stack = `'${uiSchemaTitle}' ${message}`.trim();
} else {
var _parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
if (_parentSchemaTitle) {
stack = ("'" + _parentSchemaTitle + "' " + message).trim();
const parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
if (parentSchemaTitle) {
stack = `'${parentSchemaTitle}' ${message}`.trim();
}

@@ -71,7 +70,7 @@ }

name: keyword,
property: property,
message: message,
params: params,
stack: stack,
schemaPath: schemaPath
property,
message,
params,
stack,
schemaPath
};

@@ -94,8 +93,10 @@ });

function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema) {
var invalidSchemaError = rawErrors.validationError;
var errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
const {
validationError: invalidSchemaError
} = rawErrors;
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
if (invalidSchemaError) {
errors = [].concat(errors, [{
errors = [...errors, {
stack: invalidSchemaError.message
}]);
}];
}

@@ -105,23 +106,24 @@ if (typeof transformErrors === 'function') {

}
var errorSchema = utils.toErrorSchema(errors);
let errorSchema = utils.toErrorSchema(errors);
if (invalidSchemaError) {
errorSchema = createAjvInstance._extends({}, errorSchema, {
errorSchema = {
...errorSchema,
$schema: {
__errors: [invalidSchemaError.message]
}
});
};
}
if (typeof customValidate !== 'function') {
return {
errors: errors,
errorSchema: errorSchema
errors,
errorSchema
};
}
// Include form data with undefined values, which is required for custom validation.
var newFormData = utils.getDefaultFormState(validator, schema, formData, schema, true);
var errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema);
var userErrorSchema = utils.unwrapErrorHandler(errorHandler);
const newFormData = utils.getDefaultFormState(validator, schema, formData, schema, true);
const errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema);
const userErrorSchema = utils.unwrapErrorHandler(errorHandler);
return utils.validationDataMerge({
errors: errors,
errorSchema: errorSchema
errors,
errorSchema
}, userErrorSchema);

@@ -132,3 +134,3 @@ }

*/
var AJV8Validator = /*#__PURE__*/function () {
class AJV8Validator {
/** Constructs an `AJV8Validator` instance using the `options`

@@ -139,3 +141,3 @@ *

*/
function AJV8Validator(options, localizer) {
constructor(options, localizer) {
/** The AJV instance to use for all validations

@@ -151,7 +153,9 @@ *

this.localizer = void 0;
var additionalMetaSchemas = options.additionalMetaSchemas,
customFormats = options.customFormats,
ajvOptionsOverrides = options.ajvOptionsOverrides,
ajvFormatOptions = options.ajvFormatOptions,
AjvClass = options.AjvClass;
const {
additionalMetaSchemas,
customFormats,
ajvOptionsOverrides,
ajvFormatOptions,
AjvClass
} = options;
this.ajv = createAjvInstance.createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass);

@@ -167,7 +171,3 @@ this.localizer = localizer;

*/
var _proto = AJV8Validator.prototype;
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) {
if (fieldPath === void 0) {
fieldPath = [];
}
toErrorList(errorSchema, fieldPath = []) {
return utils.toErrorList(errorSchema, fieldPath);

@@ -180,6 +180,6 @@ }

* @param formData - The form data to validate
*/;
_proto.rawValidation = function rawValidation(schema, formData) {
var compilationError = undefined;
var compiledValidator;
*/
rawValidation(schema, formData) {
let compilationError = undefined;
let compiledValidator;
if (schema[utils.ID_KEY]) {

@@ -196,3 +196,3 @@ compiledValidator = this.ajv.getSchema(schema[utils.ID_KEY]);

}
var errors;
let errors;
if (compiledValidator) {

@@ -221,5 +221,5 @@ if (typeof this.localizer === 'function') {

* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
*/;
_proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
var rawErrors = this.rawValidation(schema, formData);
*/
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
const rawErrors = this.rawValidation(schema, formData);
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);

@@ -234,8 +234,6 @@ }

* @param rootSchema - The root schema used to provide $ref resolutions
*/;
_proto.isValid = function isValid(schema, formData, rootSchema) {
var _rootSchema$ID_KEY;
var rootSchemaId = (_rootSchema$ID_KEY = rootSchema[utils.ID_KEY]) != null ? _rootSchema$ID_KEY : utils.ROOT_SCHEMA_PREFIX;
*/
isValid(schema, formData, rootSchema) {
const rootSchemaId = rootSchema[utils.ID_KEY] ?? utils.ROOT_SCHEMA_PREFIX;
try {
var _schemaWithIdRefPrefi;
// add the rootSchema ROOT_SCHEMA_PREFIX as id.

@@ -248,5 +246,5 @@ // then rewrite the schema ref's to point to the rootSchema

}
var schemaWithIdRefPrefix = utils.withIdRefPrefix(schema);
var schemaId = (_schemaWithIdRefPrefi = schemaWithIdRefPrefix[utils.ID_KEY]) != null ? _schemaWithIdRefPrefi : utils.hashForSchema(schemaWithIdRefPrefix);
var compiledValidator;
const schemaWithIdRefPrefix = utils.withIdRefPrefix(schema);
const schemaId = schemaWithIdRefPrefix[utils.ID_KEY] ?? utils.hashForSchema(schemaWithIdRefPrefix);
let compiledValidator;
compiledValidator = this.ajv.getSchema(schemaId);

@@ -259,3 +257,3 @@ if (compiledValidator === undefined) {

}
var result = compiledValidator(formData);
const result = compiledValidator(formData);
return result;

@@ -270,5 +268,4 @@ } catch (e) {

}
};
return AJV8Validator;
}();
}
}

@@ -283,6 +280,3 @@ /** Creates and returns a customized implementation of the `ValidatorType` with the given customization `options` if

*/
function customizeValidator(options, localizer) {
if (options === void 0) {
options = {};
}
function customizeValidator(options = {}, localizer) {
return new AJV8Validator(options, localizer);

@@ -294,3 +288,3 @@ }

*/
var AJV8PrecompiledValidator = /*#__PURE__*/function () {
class AJV8PrecompiledValidator {
/** Constructs an `AJV8PrecompiledValidator` instance using the `validateFns` and `rootSchema`

@@ -303,3 +297,3 @@ *

*/
function AJV8PrecompiledValidator(validateFns, rootSchema, localizer) {
constructor(validateFns, rootSchema, localizer) {
/** The root schema object used to construct this validator

@@ -342,8 +336,7 @@ *

*/
var _proto = AJV8PrecompiledValidator.prototype;
_proto.getValidator = function getValidator(schema) {
var key = get__default["default"](schema, utils.ID_KEY) || utils.hashForSchema(schema);
var validator = this.validateFns[key];
getValidator(schema) {
const key = get__default["default"](schema, utils.ID_KEY) || utils.hashForSchema(schema);
const validator = this.validateFns[key];
if (!validator) {
throw new Error("No precompiled validator function was found for the given schema for \"" + key + "\"");
throw new Error(`No precompiled validator function was found for the given schema for "${key}"`);
}

@@ -358,7 +351,4 @@ return validator;

* the next major release.
*/;
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) {
if (fieldPath === void 0) {
fieldPath = [];
}
*/
toErrorList(errorSchema, fieldPath = []) {
return utils.toErrorList(errorSchema, fieldPath);

@@ -372,4 +362,4 @@ }

* @throws - Error when the schema provided does not match the base schema of the precompiled validator
*/;
_proto.rawValidation = function rawValidation(schema, formData) {
*/
rawValidation(schema, formData) {
if (!isEqual__default["default"](schema, this.resolvedRootSchema)) {

@@ -382,3 +372,3 @@ throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation');

}
var errors = this.mainValidator.errors || undefined;
const errors = this.mainValidator.errors || undefined;
// Clear errors to prevent persistent errors, see #1104

@@ -400,5 +390,5 @@ this.mainValidator.errors = null;

* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
*/;
_proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
var rawErrors = this.rawValidation(schema, formData);
*/
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
const rawErrors = this.rawValidation(schema, formData);
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);

@@ -415,4 +405,4 @@ }

* isn't a precompiled validator function associated with the schema
*/;
_proto.isValid = function isValid(schema, formData, rootSchema) {
*/
isValid(schema, formData, rootSchema) {
if (!isEqual__default["default"](rootSchema, this.rootSchema)) {

@@ -424,7 +414,6 @@ throw new Error('The schema associated with the precompiled validator differs from the rootSchema provided for validation');

}
var validator = this.getValidator(schema);
const validator = this.getValidator(schema);
return validator(formData);
};
return AJV8PrecompiledValidator;
}();
}
}

@@ -431,0 +420,0 @@ /** Creates and returns a `ValidatorType` interface that is implemented with a precompiled validator. If a `localizer`

@@ -1,2 +0,2 @@

"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,v=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,v=void 0===d?"":d,u=i.replace(/\//g,"."),m=(u+" "+v).trim();if("missingProperty"in c){var f=c.missingProperty,p=r.getUiOptions(o.default(a,""+(u=u?u+"."+c.missingProperty:c.missingProperty).replace(/^\./,""))).title;if(p)v=v.replace(f,p);else{var S=o.default(h,[r.PROPERTIES_KEY,f,"title"]);S&&(v=v.replace(f,S))}m=v}else{var E=r.getUiOptions(o.default(a,""+u.replace(/^\./,""))).title;if(E)m=("'"+E+"' "+v).trim();else{var g=null==h?void 0:h.title;g&&(m=("'"+g+"' "+v).trim())}}return{name:s,property:u,message:v,params:c,stack:m,schemaPath:l}}))}(a.errors,h);d&&(v=[].concat(v,[{stack:d.message}])),"function"==typeof l&&(v=l(v,h));var u=r.toErrorSchema(v);if(d&&(u=e._extends({},u,{$schema:{__errors:[d.message]}})),"function"!=typeof c)return{errors:v,errorSchema:u};var m=r.getDefaultFormState(t,s,i,s,!0),f=c(m,r.createErrorHandler(m),h),p=r.unwrapErrorHandler(f);return r.validationDataMerge({errors:v,errorSchema:u},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{var s;void 0===this.ajv.getSchema(o)&&this.ajv.addSchema(a,o);var n,c=r.withIdRefPrefix(e),l=null!=(s=c[r.ID_KEY])?s:r.hashForSchema(c);return void 0===(n=this.ajv.getSchema(l))&&(n=this.ajv.addSchema(c,l).getSchema(l)||this.ajv.compile(c)),n(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}(),v=h();exports.createPrecompiledValidator=function(r,e,t){return new d(r,e,t)},exports.customizeValidator=h,exports.default=v;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("@rjsf/utils"),e=require("./createAjvInstance-33d73c95.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);function n(e,t,a,i,s,n,l){const{validationError:c}=t;let h=function(e=[],t){return e.map((e=>{const{instancePath:a,keyword:i,params:s,schemaPath:n,parentSchema:l,...c}=e;let{message:h=""}=c,d=a.replace(/\//g,"."),m=`${d} ${h}`.trim();if("missingProperty"in s){d=d?`${d}.${s.missingProperty}`:s.missingProperty;const e=s.missingProperty,a=r.getUiOptions(o.default(t,`${d.replace(/^\./,"")}`)).title;if(a)h=h.replace(e,a);else{const t=o.default(l,[r.PROPERTIES_KEY,e,"title"]);t&&(h=h.replace(e,t))}m=h}else{const e=r.getUiOptions(o.default(t,`${d.replace(/^\./,"")}`)).title;if(e)m=`'${e}' ${h}`.trim();else{const r=null==l?void 0:l.title;r&&(m=`'${r}' ${h}`.trim())}}return{name:i,property:d,message:h,params:s,stack:m,schemaPath:n}}))}(t.errors,l);c&&(h=[...h,{stack:c.message}]),"function"==typeof n&&(h=n(h,l));let d=r.toErrorSchema(h);if(c&&(d={...d,$schema:{__errors:[c.message]}}),"function"!=typeof s)return{errors:h,errorSchema:d};const m=r.getDefaultFormState(e,i,a,i,!0),u=s(m,r.createErrorHandler(m),l),v=r.unwrapErrorHandler(u);return r.validationDataMerge({errors:h,errorSchema:d},v)}class l{constructor(r,t){this.ajv=void 0,this.localizer=void 0;const{additionalMetaSchemas:a,customFormats:i,ajvOptionsOverrides:o,ajvFormatOptions:s,AjvClass:n}=r;this.ajv=e.createAjvInstance(a,i,o,s,n),this.localizer=t}toErrorList(e,t=[]){return r.toErrorList(e,t)}rawValidation(e,t){let a,i,o;e[r.ID_KEY]&&(i=this.ajv.getSchema(e[r.ID_KEY]));try{void 0===i&&(i=this.ajv.compile(e)),i(t)}catch(r){a=r}return i&&("function"==typeof this.localizer&&this.localizer(i.errors),o=i.errors||void 0,i.errors=null),{errors:o,validationError:a}}validateFormData(r,e,t,a,i){return n(this,this.rawValidation(e,r),r,e,t,a,i)}isValid(e,t,a){const i=a[r.ID_KEY]??r.ROOT_SCHEMA_PREFIX;try{void 0===this.ajv.getSchema(i)&&this.ajv.addSchema(a,i);const o=r.withIdRefPrefix(e),s=o[r.ID_KEY]??r.hashForSchema(o);let n;return n=this.ajv.getSchema(s),void 0===n&&(n=this.ajv.addSchema(o,s).getSchema(s)||this.ajv.compile(o)),n(t)}catch(r){return console.warn("Error encountered compiling schema:",r),!1}finally{this.ajv.removeSchema(i)}}}function c(r={},e){return new l(r,e)}class h{constructor(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)}getValidator(e){const 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}toErrorList(e,t=[]){return r.toErrorList(e,t)}rawValidation(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);const t=this.mainValidator.errors||void 0;return this.mainValidator.errors=null,{errors:t}}validateFormData(r,e,t,a,i){return n(this,this.rawValidation(e,r),r,e,t,a,i)}isValid(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)}}var d=c();exports.createPrecompiledValidator=function(r,e,t){return new h(r,e,t)},exports.customizeValidator=c,exports.default=d;
//# sourceMappingURL=index.cjs.production.min.js.map

@@ -8,30 +8,3 @@ import { ADDITIONAL_PROPERTY_FLAG, RJSF_ADDITONAL_PROPERTIES_FLAG, toErrorSchema, getDefaultFormState, createErrorHandler, unwrapErrorHandler, validationDataMerge, getUiOptions, PROPERTIES_KEY, toErrorList, ID_KEY, withIdRefPrefix, hashForSchema, ROOT_SCHEMA_PREFIX, retrieveSchema, JUNK_OPTION_ID } from '@rjsf/utils';

function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var AJV_CONFIG = {
const AJV_CONFIG = {
allErrors: true,

@@ -42,4 +15,4 @@ multipleOfPrecision: 8,

};
var COLOR_FORMAT_REGEX = /^(#?([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*\)))$/;
var DATA_URL_FORMAT_REGEX = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
const COLOR_FORMAT_REGEX = /^(#?([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*\)))$/;
const DATA_URL_FORMAT_REGEX = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
/** Creates an Ajv version 8 implementation object with standard support for the 'color` and `data-url` custom formats.

@@ -60,10 +33,7 @@ * If `additionalMetaSchemas` are provided then the Ajv instance is modified to add each of the meta schemas in the

*/
function createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass) {
if (ajvOptionsOverrides === void 0) {
ajvOptionsOverrides = {};
}
if (AjvClass === void 0) {
AjvClass = Ajv;
}
var ajv = new AjvClass(_extends({}, AJV_CONFIG, ajvOptionsOverrides));
function createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides = {}, ajvFormatOptions, AjvClass = Ajv) {
const ajv = new AjvClass({
...AJV_CONFIG,
...ajvOptionsOverrides
});
if (ajvFormatOptions) {

@@ -86,3 +56,3 @@ addFormats(ajv, ajvFormatOptions);

if (isObject(customFormats)) {
Object.keys(customFormats).forEach(function (formatName) {
Object.keys(customFormats).forEach(formatName => {
ajv.addFormat(formatName, customFormats[formatName]);

@@ -94,3 +64,2 @@ });

var _excluded = ["instancePath", "keyword", "params", "schemaPath", "parentSchema"];
/** Transforming the error output from ajv to format used by @rjsf/utils.

@@ -102,25 +71,25 @@ * At some point, components should be updated to support ajv.

*/
function transformRJSFValidationErrors(errors, uiSchema) {
if (errors === void 0) {
errors = [];
}
return errors.map(function (e) {
var instancePath = e.instancePath,
keyword = e.keyword,
params = e.params,
schemaPath = e.schemaPath,
parentSchema = e.parentSchema,
rest = _objectWithoutPropertiesLoose(e, _excluded);
var _rest$message = rest.message,
message = _rest$message === void 0 ? '' : _rest$message;
var property = instancePath.replace(/\//g, '.');
var stack = (property + " " + message).trim();
function transformRJSFValidationErrors(errors = [], uiSchema) {
return errors.map(e => {
const {
instancePath,
keyword,
params,
schemaPath,
parentSchema,
...rest
} = e;
let {
message = ''
} = rest;
let property = instancePath.replace(/\//g, '.');
let stack = `${property} ${message}`.trim();
if ('missingProperty' in params) {
property = property ? property + "." + params.missingProperty : params.missingProperty;
var currentProperty = params.missingProperty;
var uiSchemaTitle = getUiOptions(get(uiSchema, "" + property.replace(/^\./, ''))).title;
property = property ? `${property}.${params.missingProperty}` : params.missingProperty;
const currentProperty = params.missingProperty;
const uiSchemaTitle = getUiOptions(get(uiSchema, `${property.replace(/^\./, '')}`)).title;
if (uiSchemaTitle) {
message = message.replace(currentProperty, uiSchemaTitle);
} else {
var parentSchemaTitle = get(parentSchema, [PROPERTIES_KEY, currentProperty, 'title']);
const parentSchemaTitle = get(parentSchema, [PROPERTIES_KEY, currentProperty, 'title']);
if (parentSchemaTitle) {

@@ -132,9 +101,9 @@ message = message.replace(currentProperty, parentSchemaTitle);

} else {
var _uiSchemaTitle = getUiOptions(get(uiSchema, "" + property.replace(/^\./, ''))).title;
if (_uiSchemaTitle) {
stack = ("'" + _uiSchemaTitle + "' " + message).trim();
const uiSchemaTitle = getUiOptions(get(uiSchema, `${property.replace(/^\./, '')}`)).title;
if (uiSchemaTitle) {
stack = `'${uiSchemaTitle}' ${message}`.trim();
} else {
var _parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
if (_parentSchemaTitle) {
stack = ("'" + _parentSchemaTitle + "' " + message).trim();
const parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
if (parentSchemaTitle) {
stack = `'${parentSchemaTitle}' ${message}`.trim();
}

@@ -146,7 +115,7 @@ }

name: keyword,
property: property,
message: message,
params: params,
stack: stack,
schemaPath: schemaPath
property,
message,
params,
stack,
schemaPath
};

@@ -169,8 +138,10 @@ });

function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema) {
var invalidSchemaError = rawErrors.validationError;
var errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
const {
validationError: invalidSchemaError
} = rawErrors;
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
if (invalidSchemaError) {
errors = [].concat(errors, [{
errors = [...errors, {
stack: invalidSchemaError.message
}]);
}];
}

@@ -180,23 +151,24 @@ if (typeof transformErrors === 'function') {

}
var errorSchema = toErrorSchema(errors);
let errorSchema = toErrorSchema(errors);
if (invalidSchemaError) {
errorSchema = _extends({}, errorSchema, {
errorSchema = {
...errorSchema,
$schema: {
__errors: [invalidSchemaError.message]
}
});
};
}
if (typeof customValidate !== 'function') {
return {
errors: errors,
errorSchema: errorSchema
errors,
errorSchema
};
}
// Include form data with undefined values, which is required for custom validation.
var newFormData = getDefaultFormState(validator, schema, formData, schema, true);
var errorHandler = customValidate(newFormData, createErrorHandler(newFormData), uiSchema);
var userErrorSchema = unwrapErrorHandler(errorHandler);
const newFormData = getDefaultFormState(validator, schema, formData, schema, true);
const errorHandler = customValidate(newFormData, createErrorHandler(newFormData), uiSchema);
const userErrorSchema = unwrapErrorHandler(errorHandler);
return validationDataMerge({
errors: errors,
errorSchema: errorSchema
errors,
errorSchema
}, userErrorSchema);

@@ -207,3 +179,3 @@ }

*/
var AJV8Validator = /*#__PURE__*/function () {
class AJV8Validator {
/** Constructs an `AJV8Validator` instance using the `options`

@@ -214,3 +186,3 @@ *

*/
function AJV8Validator(options, localizer) {
constructor(options, localizer) {
/** The AJV instance to use for all validations

@@ -226,7 +198,9 @@ *

this.localizer = void 0;
var additionalMetaSchemas = options.additionalMetaSchemas,
customFormats = options.customFormats,
ajvOptionsOverrides = options.ajvOptionsOverrides,
ajvFormatOptions = options.ajvFormatOptions,
AjvClass = options.AjvClass;
const {
additionalMetaSchemas,
customFormats,
ajvOptionsOverrides,
ajvFormatOptions,
AjvClass
} = options;
this.ajv = createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass);

@@ -242,7 +216,3 @@ this.localizer = localizer;

*/
var _proto = AJV8Validator.prototype;
_proto.toErrorList = function toErrorList$1(errorSchema, fieldPath) {
if (fieldPath === void 0) {
fieldPath = [];
}
toErrorList(errorSchema, fieldPath = []) {
return toErrorList(errorSchema, fieldPath);

@@ -255,6 +225,6 @@ }

* @param formData - The form data to validate
*/;
_proto.rawValidation = function rawValidation(schema, formData) {
var compilationError = undefined;
var compiledValidator;
*/
rawValidation(schema, formData) {
let compilationError = undefined;
let compiledValidator;
if (schema[ID_KEY]) {

@@ -271,3 +241,3 @@ compiledValidator = this.ajv.getSchema(schema[ID_KEY]);

}
var errors;
let errors;
if (compiledValidator) {

@@ -296,5 +266,5 @@ if (typeof this.localizer === 'function') {

* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
*/;
_proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
var rawErrors = this.rawValidation(schema, formData);
*/
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
const rawErrors = this.rawValidation(schema, formData);
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);

@@ -309,8 +279,6 @@ }

* @param rootSchema - The root schema used to provide $ref resolutions
*/;
_proto.isValid = function isValid(schema, formData, rootSchema) {
var _rootSchema$ID_KEY;
var rootSchemaId = (_rootSchema$ID_KEY = rootSchema[ID_KEY]) != null ? _rootSchema$ID_KEY : ROOT_SCHEMA_PREFIX;
*/
isValid(schema, formData, rootSchema) {
const rootSchemaId = rootSchema[ID_KEY] ?? ROOT_SCHEMA_PREFIX;
try {
var _schemaWithIdRefPrefi;
// add the rootSchema ROOT_SCHEMA_PREFIX as id.

@@ -323,5 +291,5 @@ // then rewrite the schema ref's to point to the rootSchema

}
var schemaWithIdRefPrefix = withIdRefPrefix(schema);
var schemaId = (_schemaWithIdRefPrefi = schemaWithIdRefPrefix[ID_KEY]) != null ? _schemaWithIdRefPrefi : hashForSchema(schemaWithIdRefPrefix);
var compiledValidator;
const schemaWithIdRefPrefix = withIdRefPrefix(schema);
const schemaId = schemaWithIdRefPrefix[ID_KEY] ?? hashForSchema(schemaWithIdRefPrefix);
let compiledValidator;
compiledValidator = this.ajv.getSchema(schemaId);

@@ -334,3 +302,3 @@ if (compiledValidator === undefined) {

}
var result = compiledValidator(formData);
const result = compiledValidator(formData);
return result;

@@ -345,5 +313,4 @@ } catch (e) {

}
};
return AJV8Validator;
}();
}
}

@@ -358,6 +325,3 @@ /** Creates and returns a customized implementation of the `ValidatorType` with the given customization `options` if

*/
function customizeValidator(options, localizer) {
if (options === void 0) {
options = {};
}
function customizeValidator(options = {}, localizer) {
return new AJV8Validator(options, localizer);

@@ -369,3 +333,3 @@ }

*/
var AJV8PrecompiledValidator = /*#__PURE__*/function () {
class AJV8PrecompiledValidator {
/** Constructs an `AJV8PrecompiledValidator` instance using the `validateFns` and `rootSchema`

@@ -378,3 +342,3 @@ *

*/
function AJV8PrecompiledValidator(validateFns, rootSchema, localizer) {
constructor(validateFns, rootSchema, localizer) {
/** The root schema object used to construct this validator

@@ -417,8 +381,7 @@ *

*/
var _proto = AJV8PrecompiledValidator.prototype;
_proto.getValidator = function getValidator(schema) {
var key = get(schema, ID_KEY) || hashForSchema(schema);
var validator = this.validateFns[key];
getValidator(schema) {
const key = get(schema, ID_KEY) || hashForSchema(schema);
const validator = this.validateFns[key];
if (!validator) {
throw new Error("No precompiled validator function was found for the given schema for \"" + key + "\"");
throw new Error(`No precompiled validator function was found for the given schema for "${key}"`);
}

@@ -433,7 +396,4 @@ return validator;

* the next major release.
*/;
_proto.toErrorList = function toErrorList$1(errorSchema, fieldPath) {
if (fieldPath === void 0) {
fieldPath = [];
}
*/
toErrorList(errorSchema, fieldPath = []) {
return toErrorList(errorSchema, fieldPath);

@@ -447,4 +407,4 @@ }

* @throws - Error when the schema provided does not match the base schema of the precompiled validator
*/;
_proto.rawValidation = function rawValidation(schema, formData) {
*/
rawValidation(schema, formData) {
if (!isEqual(schema, this.resolvedRootSchema)) {

@@ -457,3 +417,3 @@ throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation');

}
var errors = this.mainValidator.errors || undefined;
const errors = this.mainValidator.errors || undefined;
// Clear errors to prevent persistent errors, see #1104

@@ -475,5 +435,5 @@ this.mainValidator.errors = null;

* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
*/;
_proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
var rawErrors = this.rawValidation(schema, formData);
*/
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
const rawErrors = this.rawValidation(schema, formData);
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);

@@ -490,4 +450,4 @@ }

* isn't a precompiled validator function associated with the schema
*/;
_proto.isValid = function isValid(schema, formData, rootSchema) {
*/
isValid(schema, formData, rootSchema) {
if (!isEqual(rootSchema, this.rootSchema)) {

@@ -499,7 +459,6 @@ throw new Error('The schema associated with the precompiled validator differs from the rootSchema provided for validation');

}
var validator = this.getValidator(schema);
const validator = this.getValidator(schema);
return validator(formData);
};
return AJV8PrecompiledValidator;
}();
}
}

@@ -506,0 +465,0 @@ /** Creates and returns a `ValidatorType` interface that is implemented with a precompiled validator. If a `localizer`

@@ -15,30 +15,3 @@ (function (global, factory) {

function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var AJV_CONFIG = {
const AJV_CONFIG = {
allErrors: true,

@@ -49,4 +22,4 @@ multipleOfPrecision: 8,

};
var COLOR_FORMAT_REGEX = /^(#?([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*\)))$/;
var DATA_URL_FORMAT_REGEX = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
const COLOR_FORMAT_REGEX = /^(#?([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*\)))$/;
const DATA_URL_FORMAT_REGEX = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
/** Creates an Ajv version 8 implementation object with standard support for the 'color` and `data-url` custom formats.

@@ -67,10 +40,7 @@ * If `additionalMetaSchemas` are provided then the Ajv instance is modified to add each of the meta schemas in the

*/
function createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass) {
if (ajvOptionsOverrides === void 0) {
ajvOptionsOverrides = {};
}
if (AjvClass === void 0) {
AjvClass = Ajv__default["default"];
}
var ajv = new AjvClass(_extends({}, AJV_CONFIG, ajvOptionsOverrides));
function createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides = {}, ajvFormatOptions, AjvClass = Ajv__default["default"]) {
const ajv = new AjvClass({
...AJV_CONFIG,
...ajvOptionsOverrides
});
if (ajvFormatOptions) {

@@ -93,3 +63,3 @@ addFormats__default["default"](ajv, ajvFormatOptions);

if (isObject__default["default"](customFormats)) {
Object.keys(customFormats).forEach(function (formatName) {
Object.keys(customFormats).forEach(formatName => {
ajv.addFormat(formatName, customFormats[formatName]);

@@ -101,3 +71,2 @@ });

var _excluded = ["instancePath", "keyword", "params", "schemaPath", "parentSchema"];
/** Transforming the error output from ajv to format used by @rjsf/utils.

@@ -109,25 +78,25 @@ * At some point, components should be updated to support ajv.

*/
function transformRJSFValidationErrors(errors, uiSchema) {
if (errors === void 0) {
errors = [];
}
return errors.map(function (e) {
var instancePath = e.instancePath,
keyword = e.keyword,
params = e.params,
schemaPath = e.schemaPath,
parentSchema = e.parentSchema,
rest = _objectWithoutPropertiesLoose(e, _excluded);
var _rest$message = rest.message,
message = _rest$message === void 0 ? '' : _rest$message;
var property = instancePath.replace(/\//g, '.');
var stack = (property + " " + message).trim();
function transformRJSFValidationErrors(errors = [], uiSchema) {
return errors.map(e => {
const {
instancePath,
keyword,
params,
schemaPath,
parentSchema,
...rest
} = e;
let {
message = ''
} = rest;
let property = instancePath.replace(/\//g, '.');
let stack = `${property} ${message}`.trim();
if ('missingProperty' in params) {
property = property ? property + "." + params.missingProperty : params.missingProperty;
var currentProperty = params.missingProperty;
var uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, "" + property.replace(/^\./, ''))).title;
property = property ? `${property}.${params.missingProperty}` : params.missingProperty;
const currentProperty = params.missingProperty;
const uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, `${property.replace(/^\./, '')}`)).title;
if (uiSchemaTitle) {
message = message.replace(currentProperty, uiSchemaTitle);
} else {
var parentSchemaTitle = get__default["default"](parentSchema, [utils.PROPERTIES_KEY, currentProperty, 'title']);
const parentSchemaTitle = get__default["default"](parentSchema, [utils.PROPERTIES_KEY, currentProperty, 'title']);
if (parentSchemaTitle) {

@@ -139,9 +108,9 @@ message = message.replace(currentProperty, parentSchemaTitle);

} else {
var _uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, "" + property.replace(/^\./, ''))).title;
if (_uiSchemaTitle) {
stack = ("'" + _uiSchemaTitle + "' " + message).trim();
const uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, `${property.replace(/^\./, '')}`)).title;
if (uiSchemaTitle) {
stack = `'${uiSchemaTitle}' ${message}`.trim();
} else {
var _parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
if (_parentSchemaTitle) {
stack = ("'" + _parentSchemaTitle + "' " + message).trim();
const parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
if (parentSchemaTitle) {
stack = `'${parentSchemaTitle}' ${message}`.trim();
}

@@ -153,7 +122,7 @@ }

name: keyword,
property: property,
message: message,
params: params,
stack: stack,
schemaPath: schemaPath
property,
message,
params,
stack,
schemaPath
};

@@ -176,8 +145,10 @@ });

function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema) {
var invalidSchemaError = rawErrors.validationError;
var errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
const {
validationError: invalidSchemaError
} = rawErrors;
let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
if (invalidSchemaError) {
errors = [].concat(errors, [{
errors = [...errors, {
stack: invalidSchemaError.message
}]);
}];
}

@@ -187,23 +158,24 @@ if (typeof transformErrors === 'function') {

}
var errorSchema = utils.toErrorSchema(errors);
let errorSchema = utils.toErrorSchema(errors);
if (invalidSchemaError) {
errorSchema = _extends({}, errorSchema, {
errorSchema = {
...errorSchema,
$schema: {
__errors: [invalidSchemaError.message]
}
});
};
}
if (typeof customValidate !== 'function') {
return {
errors: errors,
errorSchema: errorSchema
errors,
errorSchema
};
}
// Include form data with undefined values, which is required for custom validation.
var newFormData = utils.getDefaultFormState(validator, schema, formData, schema, true);
var errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema);
var userErrorSchema = utils.unwrapErrorHandler(errorHandler);
const newFormData = utils.getDefaultFormState(validator, schema, formData, schema, true);
const errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema);
const userErrorSchema = utils.unwrapErrorHandler(errorHandler);
return utils.validationDataMerge({
errors: errors,
errorSchema: errorSchema
errors,
errorSchema
}, userErrorSchema);

@@ -214,3 +186,3 @@ }

*/
var AJV8Validator = /*#__PURE__*/function () {
class AJV8Validator {
/** Constructs an `AJV8Validator` instance using the `options`

@@ -221,3 +193,3 @@ *

*/
function AJV8Validator(options, localizer) {
constructor(options, localizer) {
/** The AJV instance to use for all validations

@@ -233,7 +205,9 @@ *

this.localizer = void 0;
var additionalMetaSchemas = options.additionalMetaSchemas,
customFormats = options.customFormats,
ajvOptionsOverrides = options.ajvOptionsOverrides,
ajvFormatOptions = options.ajvFormatOptions,
AjvClass = options.AjvClass;
const {
additionalMetaSchemas,
customFormats,
ajvOptionsOverrides,
ajvFormatOptions,
AjvClass
} = options;
this.ajv = createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass);

@@ -249,7 +223,3 @@ this.localizer = localizer;

*/
var _proto = AJV8Validator.prototype;
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) {
if (fieldPath === void 0) {
fieldPath = [];
}
toErrorList(errorSchema, fieldPath = []) {
return utils.toErrorList(errorSchema, fieldPath);

@@ -262,6 +232,6 @@ }

* @param formData - The form data to validate
*/;
_proto.rawValidation = function rawValidation(schema, formData) {
var compilationError = undefined;
var compiledValidator;
*/
rawValidation(schema, formData) {
let compilationError = undefined;
let compiledValidator;
if (schema[utils.ID_KEY]) {

@@ -278,3 +248,3 @@ compiledValidator = this.ajv.getSchema(schema[utils.ID_KEY]);

}
var errors;
let errors;
if (compiledValidator) {

@@ -303,5 +273,5 @@ if (typeof this.localizer === 'function') {

* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
*/;
_proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
var rawErrors = this.rawValidation(schema, formData);
*/
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
const rawErrors = this.rawValidation(schema, formData);
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);

@@ -316,8 +286,6 @@ }

* @param rootSchema - The root schema used to provide $ref resolutions
*/;
_proto.isValid = function isValid(schema, formData, rootSchema) {
var _rootSchema$ID_KEY;
var rootSchemaId = (_rootSchema$ID_KEY = rootSchema[utils.ID_KEY]) != null ? _rootSchema$ID_KEY : utils.ROOT_SCHEMA_PREFIX;
*/
isValid(schema, formData, rootSchema) {
const rootSchemaId = rootSchema[utils.ID_KEY] ?? utils.ROOT_SCHEMA_PREFIX;
try {
var _schemaWithIdRefPrefi;
// add the rootSchema ROOT_SCHEMA_PREFIX as id.

@@ -330,5 +298,5 @@ // then rewrite the schema ref's to point to the rootSchema

}
var schemaWithIdRefPrefix = utils.withIdRefPrefix(schema);
var schemaId = (_schemaWithIdRefPrefi = schemaWithIdRefPrefix[utils.ID_KEY]) != null ? _schemaWithIdRefPrefi : utils.hashForSchema(schemaWithIdRefPrefix);
var compiledValidator;
const schemaWithIdRefPrefix = utils.withIdRefPrefix(schema);
const schemaId = schemaWithIdRefPrefix[utils.ID_KEY] ?? utils.hashForSchema(schemaWithIdRefPrefix);
let compiledValidator;
compiledValidator = this.ajv.getSchema(schemaId);

@@ -341,3 +309,3 @@ if (compiledValidator === undefined) {

}
var result = compiledValidator(formData);
const result = compiledValidator(formData);
return result;

@@ -352,5 +320,4 @@ } catch (e) {

}
};
return AJV8Validator;
}();
}
}

@@ -365,6 +332,3 @@ /** Creates and returns a customized implementation of the `ValidatorType` with the given customization `options` if

*/
function customizeValidator(options, localizer) {
if (options === void 0) {
options = {};
}
function customizeValidator(options = {}, localizer) {
return new AJV8Validator(options, localizer);

@@ -376,3 +340,3 @@ }

*/
var AJV8PrecompiledValidator = /*#__PURE__*/function () {
class AJV8PrecompiledValidator {
/** Constructs an `AJV8PrecompiledValidator` instance using the `validateFns` and `rootSchema`

@@ -385,3 +349,3 @@ *

*/
function AJV8PrecompiledValidator(validateFns, rootSchema, localizer) {
constructor(validateFns, rootSchema, localizer) {
/** The root schema object used to construct this validator

@@ -424,8 +388,7 @@ *

*/
var _proto = AJV8PrecompiledValidator.prototype;
_proto.getValidator = function getValidator(schema) {
var key = get__default["default"](schema, utils.ID_KEY) || utils.hashForSchema(schema);
var validator = this.validateFns[key];
getValidator(schema) {
const key = get__default["default"](schema, utils.ID_KEY) || utils.hashForSchema(schema);
const validator = this.validateFns[key];
if (!validator) {
throw new Error("No precompiled validator function was found for the given schema for \"" + key + "\"");
throw new Error(`No precompiled validator function was found for the given schema for "${key}"`);
}

@@ -440,7 +403,4 @@ return validator;

* the next major release.
*/;
_proto.toErrorList = function toErrorList(errorSchema, fieldPath) {
if (fieldPath === void 0) {
fieldPath = [];
}
*/
toErrorList(errorSchema, fieldPath = []) {
return utils.toErrorList(errorSchema, fieldPath);

@@ -454,4 +414,4 @@ }

* @throws - Error when the schema provided does not match the base schema of the precompiled validator
*/;
_proto.rawValidation = function rawValidation(schema, formData) {
*/
rawValidation(schema, formData) {
if (!isEqual__default["default"](schema, this.resolvedRootSchema)) {

@@ -464,3 +424,3 @@ throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation');

}
var errors = this.mainValidator.errors || undefined;
const errors = this.mainValidator.errors || undefined;
// Clear errors to prevent persistent errors, see #1104

@@ -482,5 +442,5 @@ this.mainValidator.errors = null;

* @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
*/;
_proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
var rawErrors = this.rawValidation(schema, formData);
*/
validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
const rawErrors = this.rawValidation(schema, formData);
return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);

@@ -497,4 +457,4 @@ }

* isn't a precompiled validator function associated with the schema
*/;
_proto.isValid = function isValid(schema, formData, rootSchema) {
*/
isValid(schema, formData, rootSchema) {
if (!isEqual__default["default"](rootSchema, this.rootSchema)) {

@@ -506,7 +466,6 @@ throw new Error('The schema associated with the precompiled validator differs from the rootSchema provided for validation');

}
var validator = this.getValidator(schema);
const validator = this.getValidator(schema);
return validator(formData);
};
return AJV8PrecompiledValidator;
}();
}
}

@@ -513,0 +472,0 @@ /** Creates and returns a `ValidatorType` interface that is implemented with a precompiled validator. If a `localizer`

@@ -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),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 j=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{var s;void 0===this.ajv.getSchema(o)&&this.ajv.addSchema(a,o);var n,l=e.withIdRefPrefix(r),d=null!=(s=l[e.ID_KEY])?s:e.hashForSchema(l);return void 0===(n=this.ajv.getSchema(d))&&(n=this.ajv.addSchema(l,d).getSchema(d)||this.ajv.compile(l)),n(t)}catch(r){return console.warn("Error encountered compiling schema:",r),!1}finally{this.ajv.removeSchema(o)}},r}();function E(r,e){return void 0===r&&(r={}),new j(r,e)}var S=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}(),b=E();r.createPrecompiledValidator=function(r,e,t){return new S(r,e,t)},r.customizeValidator=E,r.default=b,Object.defineProperty(r,"__esModule",{value:!0})}));
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(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"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["@rjsf/validator-ajv8"]={},e.utils,e.Ajv,e.addFormats,e.isObject,e.get,e.isEqual)}(this,(function(e,r,t,a,i,o,s){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(t),d=l(a),c=l(i),h=l(o),m=l(s);const u={allErrors:!0,multipleOfPrecision:8,strict:!1,verbose:!0},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*\)))$/,v=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;function p(e,t,a,i,o,s,l){const{validationError:n}=t;let d=function(e=[],t){return e.map((e=>{const{instancePath:a,keyword:i,params:o,schemaPath:s,parentSchema:l,...n}=e;let{message:d=""}=n,c=a.replace(/\//g,"."),m=`${c} ${d}`.trim();if("missingProperty"in o){c=c?`${c}.${o.missingProperty}`:o.missingProperty;const e=o.missingProperty,a=r.getUiOptions(h.default(t,`${c.replace(/^\./,"")}`)).title;if(a)d=d.replace(e,a);else{const t=h.default(l,[r.PROPERTIES_KEY,e,"title"]);t&&(d=d.replace(e,t))}m=d}else{const e=r.getUiOptions(h.default(t,`${c.replace(/^\./,"")}`)).title;if(e)m=`'${e}' ${d}`.trim();else{const e=null==l?void 0:l.title;e&&(m=`'${e}' ${d}`.trim())}}return{name:i,property:c,message:d,params:o,stack:m,schemaPath:s}}))}(t.errors,l);n&&(d=[...d,{stack:n.message}]),"function"==typeof s&&(d=s(d,l));let c=r.toErrorSchema(d);if(n&&(c={...c,$schema:{__errors:[n.message]}}),"function"!=typeof o)return{errors:d,errorSchema:c};const m=r.getDefaultFormState(e,i,a,i,!0),u=o(m,r.createErrorHandler(m),l),f=r.unwrapErrorHandler(u);return r.validationDataMerge({errors:d,errorSchema:c},f)}class g{constructor(e,t){this.ajv=void 0,this.localizer=void 0;const{additionalMetaSchemas:a,customFormats:i,ajvOptionsOverrides:o,ajvFormatOptions:s,AjvClass:l}=e;this.ajv=function(e,t,a={},i,o=n.default){const s=new o({...u,...a});return i?d.default(s,i):!1!==i&&d.default(s),s.addFormat("data-url",v),s.addFormat("color",f),s.addKeyword(r.ADDITIONAL_PROPERTY_FLAG),s.addKeyword(r.RJSF_ADDITONAL_PROPERTIES_FLAG),Array.isArray(e)&&s.addMetaSchema(e),c.default(t)&&Object.keys(t).forEach((e=>{s.addFormat(e,t[e])})),s}(a,i,o,s,l),this.localizer=t}toErrorList(e,t=[]){return r.toErrorList(e,t)}rawValidation(e,t){let a,i,o;e[r.ID_KEY]&&(i=this.ajv.getSchema(e[r.ID_KEY]));try{void 0===i&&(i=this.ajv.compile(e)),i(t)}catch(e){a=e}return i&&("function"==typeof this.localizer&&this.localizer(i.errors),o=i.errors||void 0,i.errors=null),{errors:o,validationError:a}}validateFormData(e,r,t,a,i){return p(this,this.rawValidation(r,e),e,r,t,a,i)}isValid(e,t,a){const i=a[r.ID_KEY]??r.ROOT_SCHEMA_PREFIX;try{void 0===this.ajv.getSchema(i)&&this.ajv.addSchema(a,i);const o=r.withIdRefPrefix(e),s=o[r.ID_KEY]??r.hashForSchema(o);let l;return l=this.ajv.getSchema(s),void 0===l&&(l=this.ajv.addSchema(o,s).getSchema(s)||this.ajv.compile(o)),l(t)}catch(e){return console.warn("Error encountered compiling schema:",e),!1}finally{this.ajv.removeSchema(i)}}}function E(e={},r){return new g(e,r)}class j{constructor(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)}getValidator(e){const t=h.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}toErrorList(e,t=[]){return r.toErrorList(e,t)}rawValidation(e,r){if(!m.default(e,this.resolvedRootSchema))throw new Error("The schema associated with the precompiled schema differs from the schema provided for validation");this.mainValidator(r),"function"==typeof this.localizer&&this.localizer(this.mainValidator.errors);const t=this.mainValidator.errors||void 0;return this.mainValidator.errors=null,{errors:t}}validateFormData(e,r,t,a,i){return p(this,this.rawValidation(r,e),e,r,t,a,i)}isValid(e,t,a){if(!m.default(a,this.rootSchema))throw new Error("The schema associated with the precompiled validator differs from the rootSchema provided for validation");return h.default(e,r.ID_KEY)!==r.JUNK_OPTION_ID&&this.getValidator(e)(t)}}var S=E();e.createPrecompiledValidator=function(e,r,t){return new j(e,r,t)},e.customizeValidator=E,e.default=S,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=validator-ajv8.umd.production.min.js.map
{
"name": "@rjsf/validator-ajv8",
"version": "5.10.0",
"version": "5.11.1",
"main": "dist/index.js",

@@ -23,4 +23,3 @@ "module": "dist/validator-ajv8.esm.js",

"compileSchemas": "node test/harness/compileTestSchema.js",
"test": "npm run compileSchemas && dts test",
"bump-packages": "npm update --save --lockfile-version 2"
"test": "npm run compileSchemas && jest"
},

@@ -46,12 +45,14 @@ "lint-staged": {

"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/plugin-transform-react-jsx": "^7.22.5",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@rjsf/utils": "^5.10.0",
"@babel/preset-typescript": "^7.22.5",
"@rjsf/utils": "^5.11.1",
"@types/jest-expect-message": "^1.1.0",
"@types/json-schema": "^7.0.12",
"@types/lodash": "^4.14.195",
"babel-jest": "^29.6.1",
"dts-cli": "^1.6.3",
"eslint": "^8.44.0",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"jest-expect-message": "^1.1.3",

@@ -81,3 +82,3 @@ "rimraf": "^5.0.1"

"license": "Apache-2.0",
"gitHead": "d05138f4dc678e0f6f85e13780dd3e17074791c8"
"gitHead": "0a7771f489753b9743d15aa9ae69dbf0ce821541"
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc