@nhtio/validation 0.1.0-master-952eca46 → 0.1.0-master-b4207fd6

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,95 +0,0 @@
1
- import type { AnySchema } from '../schemas';
2
- import type { ExtensionFactory, Reference } from 'joi';
3
- export declare const messages: {
4
- 'bigint.base': string;
5
- 'bigint.greater': string;
6
- 'bigint.less': string;
7
- 'bigint.max': string;
8
- 'bigint.min': string;
9
- 'bigint.multiple': string;
10
- 'bigint.negative': string;
11
- 'bigint.positive': string;
12
- };
13
- /**
14
- * A Joi extension that adds support for BigInt validation with comprehensive
15
- * comparison operations and type coercion.
16
- *
17
- * @example
18
- * ```typescript
19
- * import { validator } from '@nhtio/validation'
20
- *
21
- * const schema = validator.bigint()
22
- * .min(0n)
23
- * .max(1000n)
24
- * .required()
25
- *
26
- * // Validates and converts to BigInt
27
- * const result = schema.validate("123") // Returns { value: 123n }
28
- * ```
29
- *
30
- * @example
31
- * ```typescript
32
- * // Works with all standard Joi methods
33
- * const optionalSchema = validator.bigint()
34
- * .positive()
35
- * .optional()
36
- * .allow(null)
37
- * .default(0n)
38
- * ```
39
- *
40
- * @public
41
- */
42
- export declare const bigint: ExtensionFactory;
43
- /**
44
- * Schema type for BigInt validation with comprehensive comparison operations.
45
- *
46
- * This interface extends the base Joi AnySchema to provide BigInt-specific
47
- * validation methods including range checks, sign validation, and multiple checks.
48
- *
49
- * @example
50
- * ```typescript
51
- * import { validator } from '@nhtio/validation'
52
- *
53
- * const schema: BigIntSchema = validator.bigint()
54
- * .min(0n)
55
- * .max(1000n)
56
- * .positive()
57
- * ```
58
- *
59
- * @public
60
- */
61
- export interface BigIntSchema<TSchema = bigint> extends AnySchema<TSchema> {
62
- /**
63
- * Validates that the BigInt is greater than the specified threshold
64
- * @param limit - The threshold value to compare against
65
- */
66
- greater(limit: bigint | Reference): this;
67
- /**
68
- * Validates that the BigInt is less than the specified threshold
69
- * @param limit - The threshold value to compare against
70
- */
71
- less(limit: bigint | Reference): this;
72
- /**
73
- * Validates that the BigInt is less than or equal to the specified maximum
74
- * @param limit - The maximum allowed value
75
- */
76
- max(limit: bigint | Reference): this;
77
- /**
78
- * Validates that the BigInt is greater than or equal to the specified minimum
79
- * @param limit - The minimum allowed value
80
- */
81
- min(limit: bigint | Reference): this;
82
- /**
83
- * Validates that the BigInt is a multiple of the specified factor
84
- * @param limit - The factor that the value must be a multiple of
85
- */
86
- multiple(limit: bigint | Reference): this;
87
- /**
88
- * Validates that the BigInt is negative (less than zero)
89
- */
90
- negative(): this;
91
- /**
92
- * Validates that the BigInt is positive (greater than zero)
93
- */
94
- positive(): this;
95
- }