@galeh/chuka 1.1.5 → 1.1.6
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.
- package/package.json +1 -1
- package/decorators.d.ts +0 -8
- package/middlewares.d.ts +0 -20
- package/validators.d.ts +0 -60
package/package.json
CHANGED
package/decorators.d.ts
DELETED
package/middlewares.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { json } from 'express';
|
|
2
|
-
import { query } from 'express';
|
|
3
|
-
import { raw } from 'express';
|
|
4
|
-
import { static } from 'express';
|
|
5
|
-
import { text } from 'express';
|
|
6
|
-
import { urlencoded } from 'express';
|
|
7
|
-
|
|
8
|
-
export { json }
|
|
9
|
-
|
|
10
|
-
export { query }
|
|
11
|
-
|
|
12
|
-
export { raw }
|
|
13
|
-
|
|
14
|
-
export { static }
|
|
15
|
-
|
|
16
|
-
export { text }
|
|
17
|
-
|
|
18
|
-
export { urlencoded }
|
|
19
|
-
|
|
20
|
-
export { }
|
package/validators.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { NextFunction } from 'express';
|
|
2
|
-
import { Request as Request_2 } from 'express';
|
|
3
|
-
import { Response as Response_2 } from 'express';
|
|
4
|
-
|
|
5
|
-
export declare function and<T>(...validationFunctions: Array<Validator<T>>): Validator<T>;
|
|
6
|
-
|
|
7
|
-
declare class AtomicValidator<T> extends Validator<T> {
|
|
8
|
-
private implementation;
|
|
9
|
-
queryField?: keyof T | undefined;
|
|
10
|
-
constructor(implementation: (subject: T | T[keyof T]) => ValidatorReturn, queryField?: keyof T | undefined);
|
|
11
|
-
validate(subject: T, selectedField: keyof T): ValidatorReturn;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export declare function bodyValidator<T>(validationLogic: ValidationLogic<T>): Middleware<{
|
|
15
|
-
body: T;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
export declare function custom<T>(validator: (obj: T) => ValidatorReturn): Validator<T>;
|
|
19
|
-
|
|
20
|
-
export declare function isDefined<T>(field?: keyof T): AtomicValidator<T>;
|
|
21
|
-
|
|
22
|
-
export declare function isNull<T>(field?: keyof T): AtomicValidator<T>;
|
|
23
|
-
|
|
24
|
-
export declare function isNumber<T>(field?: keyof T): AtomicValidator<T>;
|
|
25
|
-
|
|
26
|
-
export declare function isString<T>(field?: keyof T): AtomicValidator<T>;
|
|
27
|
-
|
|
28
|
-
export declare function isUndefined<T>(field?: keyof T): AtomicValidator<T>;
|
|
29
|
-
|
|
30
|
-
declare type MergePartial<A, B> = {
|
|
31
|
-
[k in keyof A & keyof B]: (A & B)[k] extends never ? B[k] : 0 extends 1 & (A & B)[k] ? B[k] : (A & B)[k];
|
|
32
|
-
} & Omit<A, keyof B> & Partial<Omit<B, keyof A>>;
|
|
33
|
-
|
|
34
|
-
declare interface Middleware<T> {
|
|
35
|
-
(req: MergePartial<Request_2, T>, res: Response_2, next: NextFunction): void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export declare function not<T>(validationFunction: Validator<T>): Validator<T>;
|
|
39
|
-
|
|
40
|
-
export declare function notNull<T>(field?: keyof T): AtomicValidator<T>;
|
|
41
|
-
|
|
42
|
-
export declare function or<T>(...validationFunctions: Array<Validator<T>>): Validator<T>;
|
|
43
|
-
|
|
44
|
-
declare type RequestField<F extends PropertyKey, T> = Record<F, T>;
|
|
45
|
-
|
|
46
|
-
declare type UnArray<T> = T extends Array<infer A> ? A : T;
|
|
47
|
-
|
|
48
|
-
export declare type ValidationLogic<T> = {
|
|
49
|
-
[k in keyof T as T[k] extends Function ? never : k]?: ValidationLogic<UnArray<T[k]>> | Validator<T>;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
declare abstract class Validator<T> {
|
|
53
|
-
abstract validate(subject: T, selectedField: keyof T): ValidatorReturn;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export declare function validator<T, F extends PropertyKey>(validationLogic: ValidationLogic<T>, requestField: F): Middleware<RequestField<F, T>>;
|
|
57
|
-
|
|
58
|
-
declare type ValidatorReturn = boolean | Promise<boolean>;
|
|
59
|
-
|
|
60
|
-
export { }
|