@naturalcycles/nodejs-lib 15.94.0 → 15.95.0

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.
@@ -145,7 +145,7 @@ export declare class JSchema<OUT, Opt> {
145
145
  validate(input: unknown, opt?: AjvValidationOptions): OUT;
146
146
  isValid(input: unknown, opt?: AjvValidationOptions): boolean;
147
147
  getValidationResult(input: unknown, opt?: AjvValidationOptions): ValidationFunctionResult<OUT, AjvValidationError>;
148
- getValidationFunction(): ValidationFunction<OUT, AjvValidationError>;
148
+ getValidationFunction(opt?: AjvValidationOptions): ValidationFunction<OUT, AjvValidationError>;
149
149
  /**
150
150
  * Specify a function to be called after the normal validation is finished.
151
151
  *
@@ -310,12 +310,13 @@ export class JSchema {
310
310
  const inputName = this._cfg?.inputName || (builtSchema.$id ? _substringBefore(builtSchema.$id, '.') : undefined);
311
311
  return executeValidation(fn, builtSchema, input, opt, inputName);
312
312
  }
313
- getValidationFunction() {
314
- return (input, opt) => {
313
+ getValidationFunction(opt = {}) {
314
+ return (input, opt2) => {
315
315
  return this.getValidationResult(input, {
316
- mutateInput: opt?.mutateInput,
317
- inputName: opt?.inputName,
318
- inputId: opt?.inputId,
316
+ ajv: opt.ajv,
317
+ mutateInput: opt2?.mutateInput ?? opt.mutateInput,
318
+ inputName: opt2?.inputName ?? opt.inputName,
319
+ inputId: opt2?.inputId ?? opt.inputId,
319
320
  });
320
321
  };
321
322
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "15.94.0",
4
+ "version": "15.95.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@types/js-yaml": "^4",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@typescript/native-preview": "7.0.0-dev.20260201.1",
22
- "@naturalcycles/dev-lib": "20.36.0"
22
+ "@naturalcycles/dev-lib": "18.4.2"
23
23
  },
24
24
  "exports": {
25
25
  ".": "./dist/index.js",
@@ -447,12 +447,15 @@ export class JSchema<OUT, Opt> {
447
447
  return executeValidation<OUT>(fn, builtSchema, input, opt, inputName)
448
448
  }
449
449
 
450
- getValidationFunction(): ValidationFunction<OUT, AjvValidationError> {
451
- return (input, opt) => {
450
+ getValidationFunction(
451
+ opt: AjvValidationOptions = {},
452
+ ): ValidationFunction<OUT, AjvValidationError> {
453
+ return (input, opt2) => {
452
454
  return this.getValidationResult(input, {
453
- mutateInput: opt?.mutateInput,
454
- inputName: opt?.inputName,
455
- inputId: opt?.inputId,
455
+ ajv: opt.ajv,
456
+ mutateInput: opt2?.mutateInput ?? opt.mutateInput,
457
+ inputName: opt2?.inputName ?? opt.inputName,
458
+ inputId: opt2?.inputId ?? opt.inputId,
456
459
  })
457
460
  }
458
461
  }