@rjsf/validator-ajv8 5.10.0 → 5.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,41 +12,14 @@
12
12
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
13
13
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
14
14
 
15
- function _extends() {
16
- _extends = Object.assign ? Object.assign.bind() : function (target) {
17
- for (var i = 1; i < arguments.length; i++) {
18
- var source = arguments[i];
19
- for (var key in source) {
20
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21
- target[key] = source[key];
22
- }
23
- }
24
- }
25
- return target;
26
- };
27
- return _extends.apply(this, arguments);
28
- }
29
- function _objectWithoutPropertiesLoose(source, excluded) {
30
- if (source == null) return {};
31
- var target = {};
32
- var sourceKeys = Object.keys(source);
33
- var key, i;
34
- for (i = 0; i < sourceKeys.length; i++) {
35
- key = sourceKeys[i];
36
- if (excluded.indexOf(key) >= 0) continue;
37
- target[key] = source[key];
38
- }
39
- return target;
40
- }
41
-
42
- var AJV_CONFIG = {
15
+ const AJV_CONFIG = {
43
16
  allErrors: true,
44
17
  multipleOfPrecision: 8,
45
18
  strict: false,
46
19
  verbose: true
47
20
  };
48
- 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*\)))$/;
49
- var DATA_URL_FORMAT_REGEX = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
21
+ 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*\)))$/;
22
+ const DATA_URL_FORMAT_REGEX = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
50
23
  /** Creates an Ajv version 8 implementation object with standard support for the 'color` and `data-url` custom formats.
51
24
  * If `additionalMetaSchemas` are provided then the Ajv instance is modified to add each of the meta schemas in the
52
25
  * list. If `customFormats` are provided then those additional formats are added to the list of supported formats. If
@@ -62,14 +35,11 @@
62
35
  * @param [ajvFormatOptions] - The `ajv-format` options to use when adding formats to `ajv`; pass `false` to disable it
63
36
  * @param [AjvClass] - The `Ajv` class to use when creating the validator instance
64
37
  */
65
- function createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass) {
66
- if (ajvOptionsOverrides === void 0) {
67
- ajvOptionsOverrides = {};
68
- }
69
- if (AjvClass === void 0) {
70
- AjvClass = Ajv__default["default"];
71
- }
72
- var ajv = new AjvClass(_extends({}, AJV_CONFIG, ajvOptionsOverrides));
38
+ function createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides = {}, ajvFormatOptions, AjvClass = Ajv__default["default"]) {
39
+ const ajv = new AjvClass({
40
+ ...AJV_CONFIG,
41
+ ...ajvOptionsOverrides
42
+ });
73
43
  if (ajvFormatOptions) {
74
44
  addFormats__default["default"](ajv, ajvFormatOptions);
75
45
  } else if (ajvFormatOptions !== false) {
@@ -87,67 +57,66 @@
87
57
  }
88
58
  // add more custom formats to validate against
89
59
  if (isObject__default["default"](customFormats)) {
90
- Object.keys(customFormats).forEach(function (formatName) {
60
+ Object.keys(customFormats).forEach(formatName => {
91
61
  ajv.addFormat(formatName, customFormats[formatName]);
92
62
  });
93
63
  }
94
64
  return ajv;
95
65
  }
96
66
 
97
- var _excluded = ["instancePath", "keyword", "params", "schemaPath", "parentSchema"];
98
67
  /** Transforming the error output from ajv to format used by @rjsf/utils.
99
68
  * At some point, components should be updated to support ajv.
100
69
  *
101
70
  * @param errors - The list of AJV errors to convert to `RJSFValidationErrors`
102
71
  * @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
103
72
  */
104
- function transformRJSFValidationErrors(errors, uiSchema) {
105
- if (errors === void 0) {
106
- errors = [];
107
- }
108
- return errors.map(function (e) {
109
- var instancePath = e.instancePath,
110
- keyword = e.keyword,
111
- params = e.params,
112
- schemaPath = e.schemaPath,
113
- parentSchema = e.parentSchema,
114
- rest = _objectWithoutPropertiesLoose(e, _excluded);
115
- var _rest$message = rest.message,
116
- message = _rest$message === void 0 ? '' : _rest$message;
117
- var property = instancePath.replace(/\//g, '.');
118
- var stack = (property + " " + message).trim();
73
+ function transformRJSFValidationErrors(errors = [], uiSchema) {
74
+ return errors.map(e => {
75
+ const {
76
+ instancePath,
77
+ keyword,
78
+ params,
79
+ schemaPath,
80
+ parentSchema,
81
+ ...rest
82
+ } = e;
83
+ let {
84
+ message = ''
85
+ } = rest;
86
+ let property = instancePath.replace(/\//g, '.');
87
+ let stack = `${property} ${message}`.trim();
119
88
  if ('missingProperty' in params) {
120
- property = property ? property + "." + params.missingProperty : params.missingProperty;
121
- var currentProperty = params.missingProperty;
122
- var uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, "" + property.replace(/^\./, ''))).title;
89
+ property = property ? `${property}.${params.missingProperty}` : params.missingProperty;
90
+ const currentProperty = params.missingProperty;
91
+ const uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, `${property.replace(/^\./, '')}`)).title;
123
92
  if (uiSchemaTitle) {
124
93
  message = message.replace(currentProperty, uiSchemaTitle);
125
94
  } else {
126
- var parentSchemaTitle = get__default["default"](parentSchema, [utils.PROPERTIES_KEY, currentProperty, 'title']);
95
+ const parentSchemaTitle = get__default["default"](parentSchema, [utils.PROPERTIES_KEY, currentProperty, 'title']);
127
96
  if (parentSchemaTitle) {
128
97
  message = message.replace(currentProperty, parentSchemaTitle);
129
98
  }
130
99
  }
131
100
  stack = message;
132
101
  } else {
133
- var _uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, "" + property.replace(/^\./, ''))).title;
134
- if (_uiSchemaTitle) {
135
- stack = ("'" + _uiSchemaTitle + "' " + message).trim();
102
+ const uiSchemaTitle = utils.getUiOptions(get__default["default"](uiSchema, `${property.replace(/^\./, '')}`)).title;
103
+ if (uiSchemaTitle) {
104
+ stack = `'${uiSchemaTitle}' ${message}`.trim();
136
105
  } else {
137
- var _parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
138
- if (_parentSchemaTitle) {
139
- stack = ("'" + _parentSchemaTitle + "' " + message).trim();
106
+ const parentSchemaTitle = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title;
107
+ if (parentSchemaTitle) {
108
+ stack = `'${parentSchemaTitle}' ${message}`.trim();
140
109
  }
141
110
  }
142
111
  }
143
112
  // put data in expected format
144
113
  return {
145
114
  name: keyword,
146
- property: property,
147
- message: message,
148
- params: params,
149
- stack: stack,
150
- schemaPath: schemaPath
115
+ property,
116
+ message,
117
+ params,
118
+ stack,
119
+ schemaPath
151
120
  };
152
121
  });
153
122
  }
@@ -165,49 +134,52 @@
165
134
  * @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
166
135
  */
167
136
  function processRawValidationErrors(validator, rawErrors, formData, schema, customValidate, transformErrors, uiSchema) {
168
- var invalidSchemaError = rawErrors.validationError;
169
- var errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
137
+ const {
138
+ validationError: invalidSchemaError
139
+ } = rawErrors;
140
+ let errors = transformRJSFValidationErrors(rawErrors.errors, uiSchema);
170
141
  if (invalidSchemaError) {
171
- errors = [].concat(errors, [{
142
+ errors = [...errors, {
172
143
  stack: invalidSchemaError.message
173
- }]);
144
+ }];
174
145
  }
175
146
  if (typeof transformErrors === 'function') {
176
147
  errors = transformErrors(errors, uiSchema);
177
148
  }
178
- var errorSchema = utils.toErrorSchema(errors);
149
+ let errorSchema = utils.toErrorSchema(errors);
179
150
  if (invalidSchemaError) {
180
- errorSchema = _extends({}, errorSchema, {
151
+ errorSchema = {
152
+ ...errorSchema,
181
153
  $schema: {
182
154
  __errors: [invalidSchemaError.message]
183
155
  }
184
- });
156
+ };
185
157
  }
186
158
  if (typeof customValidate !== 'function') {
187
159
  return {
188
- errors: errors,
189
- errorSchema: errorSchema
160
+ errors,
161
+ errorSchema
190
162
  };
191
163
  }
192
164
  // Include form data with undefined values, which is required for custom validation.
193
- var newFormData = utils.getDefaultFormState(validator, schema, formData, schema, true);
194
- var errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema);
195
- var userErrorSchema = utils.unwrapErrorHandler(errorHandler);
165
+ const newFormData = utils.getDefaultFormState(validator, schema, formData, schema, true);
166
+ const errorHandler = customValidate(newFormData, utils.createErrorHandler(newFormData), uiSchema);
167
+ const userErrorSchema = utils.unwrapErrorHandler(errorHandler);
196
168
  return utils.validationDataMerge({
197
- errors: errors,
198
- errorSchema: errorSchema
169
+ errors,
170
+ errorSchema
199
171
  }, userErrorSchema);
200
172
  }
201
173
 
202
174
  /** `ValidatorType` implementation that uses the AJV 8 validation mechanism.
203
175
  */
204
- var AJV8Validator = /*#__PURE__*/function () {
176
+ class AJV8Validator {
205
177
  /** Constructs an `AJV8Validator` instance using the `options`
206
178
  *
207
179
  * @param options - The `CustomValidatorOptionsType` options that are used to create the AJV instance
208
180
  * @param [localizer] - If provided, is used to localize a list of Ajv `ErrorObject`s
209
181
  */
210
- function AJV8Validator(options, localizer) {
182
+ constructor(options, localizer) {
211
183
  /** The AJV instance to use for all validations
212
184
  *
213
185
  * @private
@@ -218,11 +190,13 @@
218
190
  * @private
219
191
  */
220
192
  this.localizer = void 0;
221
- var additionalMetaSchemas = options.additionalMetaSchemas,
222
- customFormats = options.customFormats,
223
- ajvOptionsOverrides = options.ajvOptionsOverrides,
224
- ajvFormatOptions = options.ajvFormatOptions,
225
- AjvClass = options.AjvClass;
193
+ const {
194
+ additionalMetaSchemas,
195
+ customFormats,
196
+ ajvOptionsOverrides,
197
+ ajvFormatOptions,
198
+ AjvClass
199
+ } = options;
226
200
  this.ajv = createAjvInstance(additionalMetaSchemas, customFormats, ajvOptionsOverrides, ajvFormatOptions, AjvClass);
227
201
  this.localizer = localizer;
228
202
  }
@@ -233,11 +207,7 @@
233
207
  * @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in
234
208
  * the next major release.
235
209
  */
236
- var _proto = AJV8Validator.prototype;
237
- _proto.toErrorList = function toErrorList(errorSchema, fieldPath) {
238
- if (fieldPath === void 0) {
239
- fieldPath = [];
240
- }
210
+ toErrorList(errorSchema, fieldPath = []) {
241
211
  return utils.toErrorList(errorSchema, fieldPath);
242
212
  }
243
213
  /** Runs the pure validation of the `schema` and `formData` without any of the RJSF functionality. Provided for use
@@ -245,10 +215,10 @@
245
215
  *
246
216
  * @param schema - The schema against which to validate the form data * @param schema
247
217
  * @param formData - The form data to validate
248
- */;
249
- _proto.rawValidation = function rawValidation(schema, formData) {
250
- var compilationError = undefined;
251
- var compiledValidator;
218
+ */
219
+ rawValidation(schema, formData) {
220
+ let compilationError = undefined;
221
+ let compiledValidator;
252
222
  if (schema[utils.ID_KEY]) {
253
223
  compiledValidator = this.ajv.getSchema(schema[utils.ID_KEY]);
254
224
  }
@@ -260,7 +230,7 @@
260
230
  } catch (err) {
261
231
  compilationError = err;
262
232
  }
263
- var errors;
233
+ let errors;
264
234
  if (compiledValidator) {
265
235
  if (typeof this.localizer === 'function') {
266
236
  this.localizer(compiledValidator.errors);
@@ -284,9 +254,9 @@
284
254
  * @param [customValidate] - An optional function that is used to perform custom validation
285
255
  * @param [transformErrors] - An optional function that is used to transform errors after AJV validation
286
256
  * @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
287
- */;
288
- _proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
289
- var rawErrors = this.rawValidation(schema, formData);
257
+ */
258
+ validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
259
+ const rawErrors = this.rawValidation(schema, formData);
290
260
  return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);
291
261
  }
292
262
  /** Validates data against a schema, returning true if the data is valid, or
@@ -296,12 +266,10 @@
296
266
  * @param schema - The schema against which to validate the form data
297
267
  * @param formData - The form data to validate
298
268
  * @param rootSchema - The root schema used to provide $ref resolutions
299
- */;
300
- _proto.isValid = function isValid(schema, formData, rootSchema) {
301
- var _rootSchema$ID_KEY;
302
- var rootSchemaId = (_rootSchema$ID_KEY = rootSchema[utils.ID_KEY]) != null ? _rootSchema$ID_KEY : utils.ROOT_SCHEMA_PREFIX;
269
+ */
270
+ isValid(schema, formData, rootSchema) {
271
+ const rootSchemaId = rootSchema[utils.ID_KEY] ?? utils.ROOT_SCHEMA_PREFIX;
303
272
  try {
304
- var _schemaWithIdRefPrefi;
305
273
  // add the rootSchema ROOT_SCHEMA_PREFIX as id.
306
274
  // then rewrite the schema ref's to point to the rootSchema
307
275
  // this accounts for the case where schema have references to models
@@ -309,9 +277,9 @@
309
277
  if (this.ajv.getSchema(rootSchemaId) === undefined) {
310
278
  this.ajv.addSchema(rootSchema, rootSchemaId);
311
279
  }
312
- var schemaWithIdRefPrefix = utils.withIdRefPrefix(schema);
313
- var schemaId = (_schemaWithIdRefPrefi = schemaWithIdRefPrefix[utils.ID_KEY]) != null ? _schemaWithIdRefPrefi : utils.hashForSchema(schemaWithIdRefPrefix);
314
- var compiledValidator;
280
+ const schemaWithIdRefPrefix = utils.withIdRefPrefix(schema);
281
+ const schemaId = schemaWithIdRefPrefix[utils.ID_KEY] ?? utils.hashForSchema(schemaWithIdRefPrefix);
282
+ let compiledValidator;
315
283
  compiledValidator = this.ajv.getSchema(schemaId);
316
284
  if (compiledValidator === undefined) {
317
285
  // Add schema by an explicit ID so it can be fetched later
@@ -319,7 +287,7 @@
319
287
  // https://ajv.js.org/guide/managing-schemas.html#pre-adding-all-schemas-vs-adding-on-demand
320
288
  compiledValidator = this.ajv.addSchema(schemaWithIdRefPrefix, schemaId).getSchema(schemaId) || this.ajv.compile(schemaWithIdRefPrefix);
321
289
  }
322
- var result = compiledValidator(formData);
290
+ const result = compiledValidator(formData);
323
291
  return result;
324
292
  } catch (e) {
325
293
  console.warn('Error encountered compiling schema:', e);
@@ -329,9 +297,8 @@
329
297
  // make sure we remove the rootSchema from the global ajv instance
330
298
  this.ajv.removeSchema(rootSchemaId);
331
299
  }
332
- };
333
- return AJV8Validator;
334
- }();
300
+ }
301
+ }
335
302
 
336
303
  /** Creates and returns a customized implementation of the `ValidatorType` with the given customization `options` if
337
304
  * provided. If a `localizer` is provided, it is used to translate the messages generated by the underlying AJV
@@ -341,17 +308,14 @@
341
308
  * @param [localizer] - If provided, is used to localize a list of Ajv `ErrorObject`s
342
309
  * @returns - The custom validator implementation resulting from the set of parameters provided
343
310
  */
344
- function customizeValidator(options, localizer) {
345
- if (options === void 0) {
346
- options = {};
347
- }
311
+ function customizeValidator(options = {}, localizer) {
348
312
  return new AJV8Validator(options, localizer);
349
313
  }
350
314
 
351
315
  /** `ValidatorType` implementation that uses an AJV 8 precompiled validator as created by the
352
316
  * `compileSchemaValidators()` function provided by the `@rjsf/validator-ajv8` library.
353
317
  */
354
- var AJV8PrecompiledValidator = /*#__PURE__*/function () {
318
+ class AJV8PrecompiledValidator {
355
319
  /** Constructs an `AJV8PrecompiledValidator` instance using the `validateFns` and `rootSchema`
356
320
  *
357
321
  * @param validateFns - The map of the validation functions that are generated by the `schemaCompile()` function
@@ -359,7 +323,7 @@
359
323
  * @param [localizer] - If provided, is used to localize a list of Ajv `ErrorObject`s
360
324
  * @throws - Error when the base schema of the precompiled validator does not have a matching validator function
361
325
  */
362
- function AJV8PrecompiledValidator(validateFns, rootSchema, localizer) {
326
+ constructor(validateFns, rootSchema, localizer) {
363
327
  /** The root schema object used to construct this validator
364
328
  *
365
329
  * @private
@@ -397,12 +361,11 @@
397
361
  * @param schema - The schema for which a precompiled validator function is desired
398
362
  * @returns - The precompiled validator function associated with this schema
399
363
  */
400
- var _proto = AJV8PrecompiledValidator.prototype;
401
- _proto.getValidator = function getValidator(schema) {
402
- var key = get__default["default"](schema, utils.ID_KEY) || utils.hashForSchema(schema);
403
- var validator = this.validateFns[key];
364
+ getValidator(schema) {
365
+ const key = get__default["default"](schema, utils.ID_KEY) || utils.hashForSchema(schema);
366
+ const validator = this.validateFns[key];
404
367
  if (!validator) {
405
- throw new Error("No precompiled validator function was found for the given schema for \"" + key + "\"");
368
+ throw new Error(`No precompiled validator function was found for the given schema for "${key}"`);
406
369
  }
407
370
  return validator;
408
371
  }
@@ -412,11 +375,8 @@
412
375
  * @param [fieldPath=[]] - The current field path, defaults to [] if not specified
413
376
  * @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in
414
377
  * the next major release.
415
- */;
416
- _proto.toErrorList = function toErrorList(errorSchema, fieldPath) {
417
- if (fieldPath === void 0) {
418
- fieldPath = [];
419
- }
378
+ */
379
+ toErrorList(errorSchema, fieldPath = []) {
420
380
  return utils.toErrorList(errorSchema, fieldPath);
421
381
  }
422
382
  /** Runs the pure validation of the `schema` and `formData` without any of the RJSF functionality. Provided for use
@@ -425,8 +385,8 @@
425
385
  * @param schema - The schema against which to validate the form data * @param schema
426
386
  * @param formData - The form data to validate
427
387
  * @throws - Error when the schema provided does not match the base schema of the precompiled validator
428
- */;
429
- _proto.rawValidation = function rawValidation(schema, formData) {
388
+ */
389
+ rawValidation(schema, formData) {
430
390
  if (!isEqual__default["default"](schema, this.resolvedRootSchema)) {
431
391
  throw new Error('The schema associated with the precompiled schema differs from the schema provided for validation');
432
392
  }
@@ -434,7 +394,7 @@
434
394
  if (typeof this.localizer === 'function') {
435
395
  this.localizer(this.mainValidator.errors);
436
396
  }
437
- var errors = this.mainValidator.errors || undefined;
397
+ const errors = this.mainValidator.errors || undefined;
438
398
  // Clear errors to prevent persistent errors, see #1104
439
399
  this.mainValidator.errors = null;
440
400
  return {
@@ -451,9 +411,9 @@
451
411
  * @param [customValidate] - An optional function that is used to perform custom validation
452
412
  * @param [transformErrors] - An optional function that is used to transform errors after AJV validation
453
413
  * @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
454
- */;
455
- _proto.validateFormData = function validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
456
- var rawErrors = this.rawValidation(schema, formData);
414
+ */
415
+ validateFormData(formData, schema, customValidate, transformErrors, uiSchema) {
416
+ const rawErrors = this.rawValidation(schema, formData);
457
417
  return processRawValidationErrors(this, rawErrors, formData, schema, customValidate, transformErrors, uiSchema);
458
418
  }
459
419
  /** Validates data against a schema, returning true if the data is valid, or false otherwise. If the schema is
@@ -465,19 +425,18 @@
465
425
  * @returns - true if the formData validates against the schema, false otherwise
466
426
  * @throws - Error when the schema provided does not match the base schema of the precompiled validator OR if there
467
427
  * isn't a precompiled validator function associated with the schema
468
- */;
469
- _proto.isValid = function isValid(schema, formData, rootSchema) {
428
+ */
429
+ isValid(schema, formData, rootSchema) {
470
430
  if (!isEqual__default["default"](rootSchema, this.rootSchema)) {
471
431
  throw new Error('The schema associated with the precompiled validator differs from the rootSchema provided for validation');
472
432
  }
473
433
  if (get__default["default"](schema, utils.ID_KEY) === utils.JUNK_OPTION_ID) {
474
434
  return false;
475
435
  }
476
- var validator = this.getValidator(schema);
436
+ const validator = this.getValidator(schema);
477
437
  return validator(formData);
478
- };
479
- return AJV8PrecompiledValidator;
480
- }();
438
+ }
439
+ }
481
440
 
482
441
  /** Creates and returns a `ValidatorType` interface that is implemented with a precompiled validator. If a `localizer`
483
442
  * is provided, it is used to translate the messages generated by the underlying AJV validation.