@naturalcycles/backend-lib 9.7.0 → 9.9.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.
@@ -1,4 +1,4 @@
1
- import type { ZodSchema, ZodValidationError } from '@naturalcycles/js-lib/zod';
1
+ import type { ZodType, ZodValidationError } from '@naturalcycles/js-lib/zod';
2
2
  import type { BackendRequestHandler } from '../server.model.js';
3
3
  import type { ReqValidationOptions } from './validateRequest.js';
4
4
  /**
@@ -7,4 +7,4 @@ import type { ReqValidationOptions } from './validateRequest.js';
7
7
  * Able to redact sensitive data from the error message.
8
8
  * Throws http 400 on error.
9
9
  */
10
- export declare function zodReqValidate(prop: 'body' | 'params' | 'query', schema: ZodSchema, opt?: ReqValidationOptions<ZodValidationError<any>>): BackendRequestHandler;
10
+ export declare function zodReqValidate(prop: 'body' | 'params' | 'query', schema: ZodType, opt?: ReqValidationOptions<ZodValidationError>): BackendRequestHandler;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
3
  "type": "module",
4
- "version": "9.7.0",
4
+ "version": "9.9.0",
5
5
  "peerDependencies": {
6
6
  "@sentry/node": "^9"
7
7
  },
@@ -1,5 +1,5 @@
1
1
  import { _get, AppError } from '@naturalcycles/js-lib'
2
- import type { ZodSchema, ZodValidationError } from '@naturalcycles/js-lib/zod'
2
+ import type { ZodType, ZodValidationError } from '@naturalcycles/js-lib/zod'
3
3
  import { zSafeValidate } from '@naturalcycles/js-lib/zod'
4
4
  import type { BackendRequestHandler } from '../server.model.js'
5
5
  import type { ReqValidationOptions } from './validateRequest.js'
@@ -14,8 +14,8 @@ const REDACTED = 'REDACTED'
14
14
  */
15
15
  export function zodReqValidate(
16
16
  prop: 'body' | 'params' | 'query',
17
- schema: ZodSchema,
18
- opt: ReqValidationOptions<ZodValidationError<any>> = {},
17
+ schema: ZodType,
18
+ opt: ReqValidationOptions<ZodValidationError> = {},
19
19
  ): BackendRequestHandler {
20
20
  const reportPredicate =
21
21
  typeof opt.report === 'function' ? opt.report : () => opt.report as boolean | undefined