-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.d.ts
35 lines (30 loc) · 1.17 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type { HookContext, Hook } from '@feathersjs/feathers';
import Joi from 'joi';
declare namespace FeathersValidateJoi {
export interface ValidateJoiOptions {
abortEarly?: boolean,
allowUnknown?: boolean,
cache?: boolean,
convert?: boolean,
debug?: boolean,
externals?: boolean,
noDefaults?: boolean,
nonEnumerables?: boolean,
presence?: Joi.PresenceMode,
skipFunctions?: boolean,
stripUnknown?: boolean,
getContext?: (context: HookContext) => void
setContext?: (context: HookContext, validatedValues: any) => void
[option: string]: any
}
export interface RawSchema {
[field: string]: Joi.AnySchema;
}
export interface Translation {
[key: string]: (context?: any) => string | undefined;
}
export function validateProvidedData (validationsObj: RawSchema, joiOptions?: ValidateJoiOptions): Hook
export function form (joiSchema: Joi.AnySchema, joiOptions?: ValidateJoiOptions, translations?: Translation, ifTest?: boolean): Hook
export function mongoose (joiSchema: Joi.AnySchema, joiOptions?: ValidateJoiOptions, translations?: Translation, ifTest?: boolean): Hook
}
export = FeathersValidateJoi;