@warlock.js/seal 5.31.0 → 5.32.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.
- package/CHANGELOG.md +8 -0
- package/cjs/index.cjs +20 -16
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-VTtA-k1a.cjs → object-BoVGJ68E.cjs} +30 -13
- package/cjs/object-BoVGJ68E.cjs.map +1 -0
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-chT0TXQS.cjs → required-methods-BJlnLnwa.cjs} +237 -228
- package/cjs/required-methods-BJlnLnwa.cjs.map +1 -0
- package/cjs/{string-edcPIpcU.cjs → string-CM8x0u2w.cjs} +44 -42
- package/cjs/string-CM8x0u2w.cjs.map +1 -0
- package/cjs/string.cjs +2 -2
- package/esm/config.d.mts +7 -8
- package/esm/config.d.mts.map +1 -1
- package/esm/factory/index.d.mts +2 -1
- package/esm/factory/index.mjs +1 -1
- package/esm/factory/validate.d.mts +3 -6
- package/esm/factory/validate.d.mts.map +1 -1
- package/esm/factory/validators.d.mts +9 -6
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/helpers/date-helpers.d.mts +1 -2
- package/esm/helpers/date-helpers.d.mts.map +1 -1
- package/esm/helpers/file.utils.d.mts +2 -4
- package/esm/helpers/file.utils.d.mts.map +1 -1
- package/esm/helpers/get-field-value.d.mts +2 -3
- package/esm/helpers/get-field-value.d.mts.map +1 -1
- package/esm/helpers/get-field-value.mjs +2 -1
- package/esm/helpers/get-field-value.mjs.map +1 -1
- package/esm/helpers/index.d.mts +6 -0
- package/esm/helpers/index.mjs +1 -1
- package/esm/helpers/path-helpers.d.mts +1 -2
- package/esm/helpers/path-helpers.d.mts.map +1 -1
- package/esm/helpers/validation-helpers.d.mts +4 -10
- package/esm/helpers/validation-helpers.d.mts.map +1 -1
- package/esm/index.d.mts +7 -0
- package/esm/mutators/array-mutators.d.mts +6 -7
- package/esm/mutators/array-mutators.d.mts.map +1 -1
- package/esm/mutators/boolean-mutators.d.mts +3 -4
- package/esm/mutators/boolean-mutators.d.mts.map +1 -1
- package/esm/mutators/date-mutators.d.mts +18 -19
- package/esm/mutators/date-mutators.d.mts.map +1 -1
- package/esm/mutators/index.d.mts +8 -0
- package/esm/mutators/index.mjs +1 -1
- package/esm/mutators/number-mutators.d.mts +10 -11
- package/esm/mutators/number-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.d.mts +4 -5
- package/esm/mutators/object-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.mjs +5 -4
- package/esm/mutators/object-mutators.mjs.map +1 -1
- package/esm/mutators/scalar-mutators.d.mts +2 -3
- package/esm/mutators/scalar-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.d.mts +37 -38
- package/esm/mutators/string-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.mjs +3 -1
- package/esm/mutators/string-mutators.mjs.map +1 -1
- package/esm/object.d.mts +3 -3
- package/esm/object.d.mts.map +1 -1
- package/esm/plugins/plugin-system.d.mts +11 -9
- package/esm/plugins/plugin-system.d.mts.map +1 -1
- package/esm/rules/array/array-rules.d.mts +3 -4
- package/esm/rules/array/array-rules.d.mts.map +1 -1
- package/esm/rules/array/index.d.mts +2 -0
- package/esm/rules/array/index.mjs +1 -1
- package/esm/rules/color/color-rules.d.mts +8 -9
- package/esm/rules/color/color-rules.d.mts.map +1 -1
- package/esm/rules/color/index.d.mts +2 -0
- package/esm/rules/color/index.mjs +1 -1
- package/esm/rules/common/enum.d.mts +5 -6
- package/esm/rules/common/enum.d.mts.map +1 -1
- package/esm/rules/common/equals-field-rules.d.mts +3 -4
- package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
- package/esm/rules/common/index.d.mts +7 -0
- package/esm/rules/common/index.mjs +1 -1
- package/esm/rules/common/instanceof.d.mts +2 -3
- package/esm/rules/common/instanceof.d.mts.map +1 -1
- package/esm/rules/common/literal.d.mts +2 -3
- package/esm/rules/common/literal.d.mts.map +1 -1
- package/esm/rules/common/type-rules.d.mts +10 -11
- package/esm/rules/common/type-rules.d.mts.map +1 -1
- package/esm/rules/common/unknown-key.d.mts +2 -3
- package/esm/rules/common/unknown-key.d.mts.map +1 -1
- package/esm/rules/conditional/forbidden-if-rules.d.mts +7 -8
- package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/index.d.mts +11 -0
- package/esm/rules/conditional/index.mjs +1 -1
- package/esm/rules/conditional/present-if-rules.d.mts +6 -7
- package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-with-rules.d.mts +4 -5
- package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-without-rules.d.mts +4 -5
- package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-if-rules.d.mts +10 -11
- package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-when-rule.d.mts +2 -3
- package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
- package/esm/rules/conditional/required-with-rules.d.mts +4 -5
- package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-without-rules.d.mts +4 -5
- package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
- package/esm/rules/core/equal.d.mts +2 -3
- package/esm/rules/core/equal.d.mts.map +1 -1
- package/esm/rules/core/forbidden.d.mts +2 -3
- package/esm/rules/core/forbidden.d.mts.map +1 -1
- package/esm/rules/core/index.d.mts +6 -0
- package/esm/rules/core/index.mjs +1 -1
- package/esm/rules/core/required.d.mts +3 -4
- package/esm/rules/core/required.d.mts.map +1 -1
- package/esm/rules/core/union.d.mts +2 -3
- package/esm/rules/core/union.d.mts.map +1 -1
- package/esm/rules/core/when.d.mts +2 -3
- package/esm/rules/core/when.d.mts.map +1 -1
- package/esm/rules/date/date-comparison-rules.d.mts +6 -7
- package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-day-rules.d.mts +5 -6
- package/esm/rules/date/date-day-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.d.mts +4 -5
- package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.mjs +6 -3
- package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
- package/esm/rules/date/date-period-rules.d.mts +16 -16
- package/esm/rules/date/date-period-rules.d.mts.map +1 -1
- package/esm/rules/date/date-period-rules.mjs +24 -12
- package/esm/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/rules/date/date-relative-rules.d.mts +4 -5
- package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
- package/esm/rules/date/date-relative-rules.mjs +3 -3
- package/esm/rules/date/date-relative-rules.mjs.map +1 -1
- package/esm/rules/date/date-special-rules.d.mts +4 -5
- package/esm/rules/date/date-special-rules.d.mts.map +1 -1
- package/esm/rules/date/date.d.mts +16 -17
- package/esm/rules/date/date.d.mts.map +1 -1
- package/esm/rules/date/date.mjs +4 -2
- package/esm/rules/date/date.mjs.map +1 -1
- package/esm/rules/date/index.d.mts +8 -0
- package/esm/rules/date/index.mjs +1 -1
- package/esm/rules/file/dimensions.d.mts +5 -6
- package/esm/rules/file/dimensions.d.mts.map +1 -1
- package/esm/rules/file/file-size.d.mts +3 -4
- package/esm/rules/file/file-size.d.mts.map +1 -1
- package/esm/rules/file/index.d.mts +3 -0
- package/esm/rules/file/index.mjs +1 -1
- package/esm/rules/index.d.mts +56 -0
- package/esm/rules/index.mjs +1 -1
- package/esm/rules/length/index.d.mts +2 -0
- package/esm/rules/length/index.mjs +1 -1
- package/esm/rules/length/length-rules.d.mts +8 -9
- package/esm/rules/length/length-rules.d.mts.map +1 -1
- package/esm/rules/number/index.d.mts +2 -0
- package/esm/rules/number/index.mjs +1 -1
- package/esm/rules/number/number-rules.d.mts +11 -12
- package/esm/rules/number/number-rules.d.mts.map +1 -1
- package/esm/rules/number/number-rules.mjs +12 -6
- package/esm/rules/number/number-rules.mjs.map +1 -1
- package/esm/rules/scalar/index.mjs +1 -1
- package/esm/rules/string/alpha.d.mts +4 -5
- package/esm/rules/string/alpha.d.mts.map +1 -1
- package/esm/rules/string/credit-card.d.mts +2 -3
- package/esm/rules/string/credit-card.d.mts.map +1 -1
- package/esm/rules/string/email.d.mts +2 -3
- package/esm/rules/string/email.d.mts.map +1 -1
- package/esm/rules/string/id-formats.d.mts +6 -7
- package/esm/rules/string/id-formats.d.mts.map +1 -1
- package/esm/rules/string/index.d.mts +12 -0
- package/esm/rules/string/index.mjs +1 -1
- package/esm/rules/string/ip.d.mts +7 -8
- package/esm/rules/string/ip.d.mts.map +1 -1
- package/esm/rules/string/matches.d.mts +2 -3
- package/esm/rules/string/matches.d.mts.map +1 -1
- package/esm/rules/string/pattern.d.mts +2 -3
- package/esm/rules/string/pattern.d.mts.map +1 -1
- package/esm/rules/string/string-comparison.d.mts +5 -6
- package/esm/rules/string/string-comparison.d.mts.map +1 -1
- package/esm/rules/string/strong-password-rule.d.mts +2 -3
- package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
- package/esm/rules/string/url.d.mts +2 -3
- package/esm/rules/string/url.d.mts.map +1 -1
- package/esm/rules/string/without-whitespace.d.mts +2 -3
- package/esm/rules/string/without-whitespace.d.mts.map +1 -1
- package/esm/standard-schema/index.d.mts +4 -0
- package/esm/standard-schema/json-schema.d.mts +5 -7
- package/esm/standard-schema/json-schema.d.mts.map +1 -1
- package/esm/standard-schema/map-result.d.mts +2 -3
- package/esm/standard-schema/map-result.d.mts.map +1 -1
- package/esm/standard-schema/types.d.mts +4 -5
- package/esm/standard-schema/types.d.mts.map +1 -1
- package/esm/string.d.mts +2 -3
- package/esm/string.d.mts.map +1 -1
- package/esm/types/conditional-types.d.mts +8 -6
- package/esm/types/conditional-types.d.mts.map +1 -1
- package/esm/types/context-types.d.mts +24 -15
- package/esm/types/context-types.d.mts.map +1 -1
- package/esm/types/data-transformer-types.d.mts +3 -5
- package/esm/types/data-transformer-types.d.mts.map +1 -1
- package/esm/types/date-types.d.mts +2 -3
- package/esm/types/date-types.d.mts.map +1 -1
- package/esm/types/file.types.d.mts +1 -2
- package/esm/types/file.types.d.mts.map +1 -1
- package/esm/types/index.d.mts +11 -0
- package/esm/types/inference-types.d.mts +14 -13
- package/esm/types/inference-types.d.mts.map +1 -1
- package/esm/types/mutator-types.d.mts +9 -7
- package/esm/types/mutator-types.d.mts.map +1 -1
- package/esm/types/result-types.d.mts +12 -7
- package/esm/types/result-types.d.mts.map +1 -1
- package/esm/types/rule-types.d.mts +25 -16
- package/esm/types/rule-types.d.mts.map +1 -1
- package/esm/types/schema-types.d.mts +1 -3
- package/esm/types/schema-types.d.mts.map +1 -1
- package/esm/validators/any-validator.d.mts +1 -3
- package/esm/validators/any-validator.d.mts.map +1 -1
- package/esm/validators/array-validator.d.mts +2 -3
- package/esm/validators/array-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.d.mts +2 -3
- package/esm/validators/base-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.mjs +2 -1
- package/esm/validators/base-validator.mjs.map +1 -1
- package/esm/validators/boolean-validator.d.mts +1 -3
- package/esm/validators/boolean-validator.d.mts.map +1 -1
- package/esm/validators/computed-validator.d.mts +3 -4
- package/esm/validators/computed-validator.d.mts.map +1 -1
- package/esm/validators/date-validator.d.mts +2 -3
- package/esm/validators/date-validator.d.mts.map +1 -1
- package/esm/validators/discriminated-union-validator.d.mts +3 -3
- package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
- package/esm/validators/float-validator.d.mts +1 -3
- package/esm/validators/float-validator.d.mts.map +1 -1
- package/esm/validators/index.d.mts +2 -1
- package/esm/validators/index.mjs +1 -1
- package/esm/validators/instanceof-validator.d.mts +1 -3
- package/esm/validators/instanceof-validator.d.mts.map +1 -1
- package/esm/validators/int-validator.d.mts +1 -3
- package/esm/validators/int-validator.d.mts.map +1 -1
- package/esm/validators/lazy-validator.d.mts +2 -3
- package/esm/validators/lazy-validator.d.mts.map +1 -1
- package/esm/validators/literal-validator.d.mts +1 -3
- package/esm/validators/literal-validator.d.mts.map +1 -1
- package/esm/validators/managed-validator.d.mts +3 -4
- package/esm/validators/managed-validator.d.mts.map +1 -1
- package/esm/validators/methods/equality-conditional-methods.d.mts +3 -4
- package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
- package/esm/validators/methods/forbidden-methods.d.mts +2 -3
- package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
- package/esm/validators/methods/present-methods.d.mts +2 -3
- package/esm/validators/methods/present-methods.d.mts.map +1 -1
- package/esm/validators/methods/required-methods.d.mts +3 -4
- package/esm/validators/methods/required-methods.d.mts.map +1 -1
- package/esm/validators/number-validator.d.mts +1 -3
- package/esm/validators/number-validator.d.mts.map +1 -1
- package/esm/validators/number-validator.mjs +12 -8
- package/esm/validators/number-validator.mjs.map +1 -1
- package/esm/validators/numeric-validator.d.mts +1 -3
- package/esm/validators/numeric-validator.d.mts.map +1 -1
- package/esm/validators/object-validator.d.mts +2 -3
- package/esm/validators/object-validator.d.mts.map +1 -1
- package/esm/validators/primitive-validator.d.mts +1 -3
- package/esm/validators/primitive-validator.d.mts.map +1 -1
- package/esm/validators/record-validator.d.mts +2 -3
- package/esm/validators/record-validator.d.mts.map +1 -1
- package/esm/validators/scalar-validator.d.mts +1 -3
- package/esm/validators/scalar-validator.d.mts.map +1 -1
- package/esm/validators/string-validator.d.mts +1 -3
- package/esm/validators/string-validator.d.mts.map +1 -1
- package/esm/validators/tuple-validator.d.mts +2 -3
- package/esm/validators/tuple-validator.d.mts.map +1 -1
- package/esm/validators/union-validator.d.mts +1 -3
- package/esm/validators/union-validator.d.mts.map +1 -1
- package/package.json +1 -1
- package/cjs/object-VTtA-k1a.cjs.map +0 -1
- package/cjs/required-methods-chT0TXQS.cjs.map +0 -1
- package/cjs/string-edcPIpcU.cjs.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
2
|
import { WeekDay } from "../../types/date-types.mjs";
|
|
3
|
-
|
|
3
|
+
import "../../types/index.mjs";
|
|
4
4
|
//#region ../../packages/seal/src/rules/date/date.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Date rule - validates date format
|
|
7
7
|
*/
|
|
8
|
-
declare const dateRule: SchemaRule;
|
|
8
|
+
export declare const dateRule: SchemaRule;
|
|
9
9
|
/**
|
|
10
10
|
* Min date rule - date must be >= given date or field
|
|
11
11
|
* Smart detection: date value or field name
|
|
12
12
|
*/
|
|
13
|
-
declare const minDateRule: SchemaRule<{
|
|
13
|
+
export declare const minDateRule: SchemaRule<{
|
|
14
14
|
dateOrField: Date | string | number;
|
|
15
15
|
scope?: "global" | "sibling";
|
|
16
16
|
}>;
|
|
@@ -18,80 +18,79 @@ declare const minDateRule: SchemaRule<{
|
|
|
18
18
|
* Max date rule - date must be <= given date or field
|
|
19
19
|
* Smart detection: date value or field name
|
|
20
20
|
*/
|
|
21
|
-
declare const maxDateRule: SchemaRule<{
|
|
21
|
+
export declare const maxDateRule: SchemaRule<{
|
|
22
22
|
dateOrField: Date | string | number;
|
|
23
23
|
scope?: "global" | "sibling";
|
|
24
24
|
}>;
|
|
25
25
|
/**
|
|
26
26
|
* From today rule - date must be today or in the future
|
|
27
27
|
*/
|
|
28
|
-
declare const fromTodayRule: SchemaRule;
|
|
28
|
+
export declare const fromTodayRule: SchemaRule;
|
|
29
29
|
/**
|
|
30
30
|
* Before today rule - date must be before today
|
|
31
31
|
*/
|
|
32
|
-
declare const beforeTodayRule: SchemaRule;
|
|
32
|
+
export declare const beforeTodayRule: SchemaRule;
|
|
33
33
|
/**
|
|
34
34
|
* From hour rule - time must be from specific hour onwards
|
|
35
35
|
*/
|
|
36
|
-
declare const fromHourRule: SchemaRule<{
|
|
36
|
+
export declare const fromHourRule: SchemaRule<{
|
|
37
37
|
hour: number;
|
|
38
38
|
}>;
|
|
39
39
|
/**
|
|
40
40
|
* Before hour rule - time must be before specific hour
|
|
41
41
|
*/
|
|
42
|
-
declare const beforeHourRule: SchemaRule<{
|
|
42
|
+
export declare const beforeHourRule: SchemaRule<{
|
|
43
43
|
hour: number;
|
|
44
44
|
}>;
|
|
45
45
|
/**
|
|
46
46
|
* Between hours rule - time must be between start and end hours
|
|
47
47
|
*/
|
|
48
|
-
declare const betweenHoursRule: SchemaRule<{
|
|
48
|
+
export declare const betweenHoursRule: SchemaRule<{
|
|
49
49
|
startHour: number;
|
|
50
50
|
endHour: number;
|
|
51
51
|
}>;
|
|
52
52
|
/**
|
|
53
53
|
* From minute rule - time must be from specific minute onwards
|
|
54
54
|
*/
|
|
55
|
-
declare const fromMinuteRule: SchemaRule<{
|
|
55
|
+
export declare const fromMinuteRule: SchemaRule<{
|
|
56
56
|
minute: number;
|
|
57
57
|
}>;
|
|
58
58
|
/**
|
|
59
59
|
* Before minute rule - time must be before specific minute
|
|
60
60
|
*/
|
|
61
|
-
declare const beforeMinuteRule: SchemaRule<{
|
|
61
|
+
export declare const beforeMinuteRule: SchemaRule<{
|
|
62
62
|
minute: number;
|
|
63
63
|
}>;
|
|
64
64
|
/**
|
|
65
65
|
* Between minutes rule - time must be between start and end minutes
|
|
66
66
|
*/
|
|
67
|
-
declare const betweenMinutesRule: SchemaRule<{
|
|
67
|
+
export declare const betweenMinutesRule: SchemaRule<{
|
|
68
68
|
startMinute: number;
|
|
69
69
|
endMinute: number;
|
|
70
70
|
}>;
|
|
71
71
|
/**
|
|
72
72
|
* Age rule - calculate age from date
|
|
73
73
|
*/
|
|
74
|
-
declare const ageRule: SchemaRule<{
|
|
74
|
+
export declare const ageRule: SchemaRule<{
|
|
75
75
|
years: number;
|
|
76
76
|
}>;
|
|
77
77
|
/**
|
|
78
78
|
* Min age rule - minimum age requirement
|
|
79
79
|
*/
|
|
80
|
-
declare const minAgeRule: SchemaRule<{
|
|
80
|
+
export declare const minAgeRule: SchemaRule<{
|
|
81
81
|
years: number;
|
|
82
82
|
}>;
|
|
83
83
|
/**
|
|
84
84
|
* Max age rule - maximum age requirement
|
|
85
85
|
*/
|
|
86
|
-
declare const maxAgeRule: SchemaRule<{
|
|
86
|
+
export declare const maxAgeRule: SchemaRule<{
|
|
87
87
|
years: number;
|
|
88
88
|
}>;
|
|
89
89
|
/**
|
|
90
90
|
* Week day rule - date must be specific weekday
|
|
91
91
|
*/
|
|
92
|
-
declare const weekDayRule: SchemaRule<{
|
|
92
|
+
export declare const weekDayRule: SchemaRule<{
|
|
93
93
|
day: WeekDay;
|
|
94
94
|
}>;
|
|
95
95
|
//#endregion
|
|
96
|
-
export { ageRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenHoursRule, betweenMinutesRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, maxAgeRule, maxDateRule, minAgeRule, minDateRule, weekDayRule };
|
|
97
96
|
//# sourceMappingURL=date.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/date/date.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/date/date.ts"],"mappings":";;;;;;;qBAUa,UAAU;;;;;qBAgBV,aAAa;EACxB,aAAa;EACb;;;;;;qBAqCW,aAAa;EACxB,aAAa;EACb;;;;;qBAmCW,eAAe;;;;qBAmBf,iBAAiB;;;;qBAmBjB,cAAc;EAAa;;;;;qBAmB3B,gBAAgB;EAAa;;;;;qBAmB7B,kBAAkB;EAC7B;EACA;;;;;qBAsBW,gBAAgB;EAAa;;;;;qBAoB7B,kBAAkB;EAAa;;;;;qBAoB/B,oBAAoB;EAC/B;EACA;;;;;qBAuBW,SAAS;EAAa;;;;;qBA0BtB,YAAY;EAAa;;;;;qBA0BzB,YAAY;EAAa;;;;;qBA0BzB,aAAa;EAAa,KAAK"}
|
package/esm/rules/date/date.mjs
CHANGED
|
@@ -29,7 +29,8 @@ const minDateRule = {
|
|
|
29
29
|
let compareDate;
|
|
30
30
|
if (isDateValue(dateOrField)) compareDate = new Date(dateOrField);
|
|
31
31
|
else {
|
|
32
|
-
const
|
|
32
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
33
|
+
const fieldValue = get(source, dateOrField);
|
|
33
34
|
if (fieldValue === void 0) return VALID_RULE;
|
|
34
35
|
compareDate = new Date(fieldValue);
|
|
35
36
|
}
|
|
@@ -49,7 +50,8 @@ const maxDateRule = {
|
|
|
49
50
|
let compareDate;
|
|
50
51
|
if (isDateValue(dateOrField)) compareDate = new Date(dateOrField);
|
|
51
52
|
else {
|
|
52
|
-
const
|
|
53
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
54
|
+
const fieldValue = get(source, dateOrField);
|
|
53
55
|
if (fieldValue === void 0) return VALID_RULE;
|
|
54
56
|
compareDate = new Date(fieldValue);
|
|
55
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/date/date.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isDateValue } from \"../../helpers/date-helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport type { WeekDay } from \"../../types/date-types\";\nimport { WEEK_DAYS } from \"../../types/date-types\";\n\n/**\n * Date rule - validates date format\n */\nexport const dateRule: SchemaRule = {\n name: \"date\",\n defaultErrorMessage: \"The :input must be a valid date\",\n async validate(value: any, context) {\n if (value instanceof Date && !isNaN(value.getTime())) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Min date rule - date must be >= given date or field\n * Smart detection: date value or field name\n */\nexport const minDateRule: SchemaRule<{\n dateOrField: Date | string | number;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"minDate\",\n description: \"The field must be at least the given date or field\",\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\n async validate(value: Date, context) {\n const { dateOrField, scope = \"global\" } = this.context.options;\n let compareDate: Date;\n\n if (isDateValue(dateOrField)) {\n // Value comparison\n compareDate = new Date(dateOrField);\n } else {\n // Field comparison\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, dateOrField as string);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n compareDate = new Date(fieldValue);\n }\n\n const inputDate = new Date(value);\n\n if (inputDate >= compareDate) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max date rule - date must be <= given date or field\n * Smart detection: date value or field name\n */\nexport const maxDateRule: SchemaRule<{\n dateOrField: Date | string | number;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"maxDate\",\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\n async validate(value: Date, context) {\n const { dateOrField, scope = \"global\" } = this.context.options;\n let compareDate: Date;\n\n if (isDateValue(dateOrField)) {\n // Value comparison\n compareDate = new Date(dateOrField);\n } else {\n // Field comparison\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, dateOrField as string);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n compareDate = new Date(fieldValue);\n }\n\n const inputDate = new Date(value);\n\n if (inputDate <= compareDate) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * From today rule - date must be today or in the future\n */\nexport const fromTodayRule: SchemaRule = {\n name: \"fromToday\",\n defaultErrorMessage: \"The :input must be today or in the future\",\n async validate(value: Date, context) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n const inputDate = new Date(value);\n inputDate.setHours(0, 0, 0, 0);\n\n if (inputDate >= today) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Before today rule - date must be before today\n */\nexport const beforeTodayRule: SchemaRule = {\n name: \"beforeToday\",\n defaultErrorMessage: \"The :input must be before today\",\n async validate(value: Date, context) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n const inputDate = new Date(value);\n inputDate.setHours(0, 0, 0, 0);\n\n if (inputDate < today) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * From hour rule - time must be from specific hour onwards\n */\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\n name: \"fromHour\",\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const hour = inputDate.getHours();\n\n if (hour >= this.context.options.hour) {\n return VALID_RULE;\n }\n\n this.context.translationParams.hour = this.context.options.hour;\n return invalidRule(this, context);\n },\n};\n\n/**\n * Before hour rule - time must be before specific hour\n */\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\n name: \"beforeHour\",\n defaultErrorMessage: \"The :input must be before :hour:00\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const hour = inputDate.getHours();\n\n if (hour < this.context.options.hour) {\n return VALID_RULE;\n }\n\n this.context.translationParams.hour = this.context.options.hour;\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between hours rule - time must be between start and end hours\n */\nexport const betweenHoursRule: SchemaRule<{\n startHour: number;\n endHour: number;\n}> = {\n name: \"betweenHours\",\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const hour = inputDate.getHours();\n const { startHour, endHour } = this.context.options;\n\n if (hour >= startHour && hour <= endHour) {\n return VALID_RULE;\n }\n\n this.context.translationParams.startHour = startHour;\n this.context.translationParams.endHour = endHour;\n return invalidRule(this, context);\n },\n};\n\n/**\n * From minute rule - time must be from specific minute onwards\n */\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\n name: \"fromMinute\",\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const minute = inputDate.getMinutes();\n\n if (minute >= this.context.options.minute) {\n return VALID_RULE;\n }\n\n this.context.translationParams.minute = this.context.options.minute;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Before minute rule - time must be before specific minute\n */\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\n name: \"beforeMinute\",\n defaultErrorMessage: \"The :input must be before minute :minute\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const minute = inputDate.getMinutes();\n\n if (minute < this.context.options.minute) {\n return VALID_RULE;\n }\n\n this.context.translationParams.minute = this.context.options.minute;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between minutes rule - time must be between start and end minutes\n */\nexport const betweenMinutesRule: SchemaRule<{\n startMinute: number;\n endMinute: number;\n}> = {\n name: \"betweenMinutes\",\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const minute = inputDate.getMinutes();\n const { startMinute, endMinute } = this.context.options;\n\n if (minute >= startMinute && minute <= endMinute) {\n return VALID_RULE;\n }\n\n this.context.translationParams.startMinute = startMinute;\n this.context.translationParams.endMinute = endMinute;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Age rule - calculate age from date\n */\nexport const ageRule: SchemaRule<{ years: number }> = {\n name: \"age\",\n defaultErrorMessage: \"The :input must be exactly :years years old\",\n async validate(value: Date, context) {\n const birthDate = new Date(value);\n const today = new Date();\n let age = today.getFullYear() - birthDate.getFullYear();\n const monthDiff = today.getMonth() - birthDate.getMonth();\n\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n\n if (age === this.context.options.years) {\n return VALID_RULE;\n }\n\n this.context.translationParams.years = this.context.options.years;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Min age rule - minimum age requirement\n */\nexport const minAgeRule: SchemaRule<{ years: number }> = {\n name: \"minAge\",\n defaultErrorMessage: \"The :input must be at least :years years old\",\n async validate(value: Date, context) {\n const birthDate = new Date(value);\n const today = new Date();\n let age = today.getFullYear() - birthDate.getFullYear();\n const monthDiff = today.getMonth() - birthDate.getMonth();\n\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n\n if (age >= this.context.options.years) {\n return VALID_RULE;\n }\n\n this.context.translationParams.years = this.context.options.years;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max age rule - maximum age requirement\n */\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\n name: \"maxAge\",\n defaultErrorMessage: \"The :input must be at most :years years old\",\n async validate(value: Date, context) {\n const birthDate = new Date(value);\n const today = new Date();\n let age = today.getFullYear() - birthDate.getFullYear();\n const monthDiff = today.getMonth() - birthDate.getMonth();\n\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n\n if (age <= this.context.options.years) {\n return VALID_RULE;\n }\n\n this.context.translationParams.years = this.context.options.years;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Week day rule - date must be specific weekday\n */\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\n name: \"weekDay\",\n defaultErrorMessage: \"The :input must be a :day\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const dayOfWeek = inputDate.getDay();\n const expectedDay = WEEK_DAYS[this.context.options.day];\n\n if (dayOfWeek === expectedDay) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.day = this.context.options.day;\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GACjD,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,cAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,O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MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,IAAI,OAAO,KAAK,QAAQ,QAAQ,OAC9B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;EAE5D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,aAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,IAAI,OAAO,KAAK,QAAQ,QAAQ,OAC9B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;EAE5D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,cAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAKnC,IAHkB,IADI,KAAK,KACD,CAAC,CAAC,OAGhB,MAFQ,UAAU,KAAK,QAAQ,QAAQ,MAGjD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,MAAM,KAAK,QAAQ,QAAQ;EAE3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
1
|
+
{"version":3,"file":"date.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/date/date.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isDateValue } from \"../../helpers/date-helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport type { WeekDay } from \"../../types/date-types\";\nimport { WEEK_DAYS } from \"../../types/date-types\";\n\n/**\n * Date rule - validates date format\n */\nexport const dateRule: SchemaRule = {\n name: \"date\",\n defaultErrorMessage: \"The :input must be a valid date\",\n async validate(value: any, context) {\n if (value instanceof Date && !isNaN(value.getTime())) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Min date rule - date must be >= given date or field\n * Smart detection: date value or field name\n */\nexport const minDateRule: SchemaRule<{\n dateOrField: Date | string | number;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"minDate\",\n description: \"The field must be at least the given date or field\",\n defaultErrorMessage: \"The :input must be at least :dateOrField\",\n async validate(value: Date, context) {\n const { dateOrField, scope = \"global\" } = this.context.options;\n let compareDate: Date;\n\n if (isDateValue(dateOrField)) {\n // Value comparison\n compareDate = new Date(dateOrField);\n } else {\n // Field comparison\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, dateOrField as string);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n compareDate = new Date(fieldValue);\n }\n\n const inputDate = new Date(value);\n\n if (inputDate >= compareDate) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max date rule - date must be <= given date or field\n * Smart detection: date value or field name\n */\nexport const maxDateRule: SchemaRule<{\n dateOrField: Date | string | number;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"maxDate\",\n defaultErrorMessage: \"The :input must be at most :dateOrField\",\n async validate(value: Date, context) {\n const { dateOrField, scope = \"global\" } = this.context.options;\n let compareDate: Date;\n\n if (isDateValue(dateOrField)) {\n // Value comparison\n compareDate = new Date(dateOrField);\n } else {\n // Field comparison\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, dateOrField as string);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n compareDate = new Date(fieldValue);\n }\n\n const inputDate = new Date(value);\n\n if (inputDate <= compareDate) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * From today rule - date must be today or in the future\n */\nexport const fromTodayRule: SchemaRule = {\n name: \"fromToday\",\n defaultErrorMessage: \"The :input must be today or in the future\",\n async validate(value: Date, context) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n const inputDate = new Date(value);\n inputDate.setHours(0, 0, 0, 0);\n\n if (inputDate >= today) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Before today rule - date must be before today\n */\nexport const beforeTodayRule: SchemaRule = {\n name: \"beforeToday\",\n defaultErrorMessage: \"The :input must be before today\",\n async validate(value: Date, context) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n const inputDate = new Date(value);\n inputDate.setHours(0, 0, 0, 0);\n\n if (inputDate < today) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * From hour rule - time must be from specific hour onwards\n */\nexport const fromHourRule: SchemaRule<{ hour: number }> = {\n name: \"fromHour\",\n defaultErrorMessage: \"The :input must be from :hour:00 onwards\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const hour = inputDate.getHours();\n\n if (hour >= this.context.options.hour) {\n return VALID_RULE;\n }\n\n this.context.translationParams.hour = this.context.options.hour;\n return invalidRule(this, context);\n },\n};\n\n/**\n * Before hour rule - time must be before specific hour\n */\nexport const beforeHourRule: SchemaRule<{ hour: number }> = {\n name: \"beforeHour\",\n defaultErrorMessage: \"The :input must be before :hour:00\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const hour = inputDate.getHours();\n\n if (hour < this.context.options.hour) {\n return VALID_RULE;\n }\n\n this.context.translationParams.hour = this.context.options.hour;\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between hours rule - time must be between start and end hours\n */\nexport const betweenHoursRule: SchemaRule<{\n startHour: number;\n endHour: number;\n}> = {\n name: \"betweenHours\",\n defaultErrorMessage: \"The :input must be between :startHour:00 and :endHour:00\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const hour = inputDate.getHours();\n const { startHour, endHour } = this.context.options;\n\n if (hour >= startHour && hour <= endHour) {\n return VALID_RULE;\n }\n\n this.context.translationParams.startHour = startHour;\n this.context.translationParams.endHour = endHour;\n return invalidRule(this, context);\n },\n};\n\n/**\n * From minute rule - time must be from specific minute onwards\n */\nexport const fromMinuteRule: SchemaRule<{ minute: number }> = {\n name: \"fromMinute\",\n defaultErrorMessage: \"The :input must be from minute :minute onwards\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const minute = inputDate.getMinutes();\n\n if (minute >= this.context.options.minute) {\n return VALID_RULE;\n }\n\n this.context.translationParams.minute = this.context.options.minute;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Before minute rule - time must be before specific minute\n */\nexport const beforeMinuteRule: SchemaRule<{ minute: number }> = {\n name: \"beforeMinute\",\n defaultErrorMessage: \"The :input must be before minute :minute\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const minute = inputDate.getMinutes();\n\n if (minute < this.context.options.minute) {\n return VALID_RULE;\n }\n\n this.context.translationParams.minute = this.context.options.minute;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between minutes rule - time must be between start and end minutes\n */\nexport const betweenMinutesRule: SchemaRule<{\n startMinute: number;\n endMinute: number;\n}> = {\n name: \"betweenMinutes\",\n defaultErrorMessage: \"The :input must be between minute :startMinute and :endMinute\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const minute = inputDate.getMinutes();\n const { startMinute, endMinute } = this.context.options;\n\n if (minute >= startMinute && minute <= endMinute) {\n return VALID_RULE;\n }\n\n this.context.translationParams.startMinute = startMinute;\n this.context.translationParams.endMinute = endMinute;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Age rule - calculate age from date\n */\nexport const ageRule: SchemaRule<{ years: number }> = {\n name: \"age\",\n defaultErrorMessage: \"The :input must be exactly :years years old\",\n async validate(value: Date, context) {\n const birthDate = new Date(value);\n const today = new Date();\n let age = today.getFullYear() - birthDate.getFullYear();\n const monthDiff = today.getMonth() - birthDate.getMonth();\n\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n\n if (age === this.context.options.years) {\n return VALID_RULE;\n }\n\n this.context.translationParams.years = this.context.options.years;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Min age rule - minimum age requirement\n */\nexport const minAgeRule: SchemaRule<{ years: number }> = {\n name: \"minAge\",\n defaultErrorMessage: \"The :input must be at least :years years old\",\n async validate(value: Date, context) {\n const birthDate = new Date(value);\n const today = new Date();\n let age = today.getFullYear() - birthDate.getFullYear();\n const monthDiff = today.getMonth() - birthDate.getMonth();\n\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n\n if (age >= this.context.options.years) {\n return VALID_RULE;\n }\n\n this.context.translationParams.years = this.context.options.years;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max age rule - maximum age requirement\n */\nexport const maxAgeRule: SchemaRule<{ years: number }> = {\n name: \"maxAge\",\n defaultErrorMessage: \"The :input must be at most :years years old\",\n async validate(value: Date, context) {\n const birthDate = new Date(value);\n const today = new Date();\n let age = today.getFullYear() - birthDate.getFullYear();\n const monthDiff = today.getMonth() - birthDate.getMonth();\n\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n\n if (age <= this.context.options.years) {\n return VALID_RULE;\n }\n\n this.context.translationParams.years = this.context.options.years;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Week day rule - date must be specific weekday\n */\nexport const weekDayRule: SchemaRule<{ day: WeekDay }> = {\n name: \"weekDay\",\n defaultErrorMessage: \"The :input must be a :day\",\n async validate(value: Date, context) {\n const inputDate = new Date(value);\n const dayOfWeek = inputDate.getDay();\n const expectedDay = WEEK_DAYS[this.context.options.day];\n\n if (dayOfWeek === expectedDay) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.day = this.context.options.day;\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GACjD,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,cAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,aAAa,QAAQ,aAAa,KAAK,QAAQ;EACvD,IAAI;EAEJ,IAAI,YAAY,WAAW,GAEzB,cAAc,IAAI,KAAK,WAAW;OAC7B;GAEL,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;GAC9D,MAAM,aAAa,IAAI,QAAQ,WAAqB;GAEpD,IAAI,eAAe,QACjB,OAAO;GAGT,cAAc,IAAI,KAAK,UAAU;EACnC;EAIA,IAAI,IAFkB,KAAK,KAEf,KAAK,aACf,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,cAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,aAAa,QAAQ,aAAa,KAAK,QAAQ;EACvD,IAAI;EAEJ,IAAI,YAAY,WAAW,GAEzB,cAAc,IAAI,KAAK,WAAW;OAC7B;GAEL,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;GAC9D,MAAM,aAAa,IAAI,QAAQ,WAAqB;GAEpD,IAAI,eAAe,QACjB,OAAO;GAGT,cAAc,IAAI,KAAK,UAAU;EACnC;EAIA,IAAI,IAFkB,KAAK,KAEf,KAAK,aACf,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAA4B;CACvC,MAAM;CAC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cAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAKnC,IAHkB,IADI,KAAK,KACD,CAAC,CAAC,OAGhB,MAFQ,UAAU,KAAK,QAAQ,QAAQ,MAGjD,OAAO;EAGT,KAAK,QAAQ,mBAAmB,MAAM,KAAK,QAAQ,QAAQ;EAE3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ageRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenHoursRule, betweenMinutesRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, maxAgeRule, maxDateRule, minAgeRule, minDateRule, weekDayRule } from "./date.mjs";
|
|
2
|
+
import { afterTodayRule, betweenDatesRule, futureRule, pastRule, todayRule } from "./date-comparison-rules.mjs";
|
|
3
|
+
import { businessDayRule, weekdayRule, weekdaysRule, weekendRule } from "./date-day-rules.mjs";
|
|
4
|
+
import { afterFieldRule, beforeFieldRule, sameAsFieldDateRule } from "./date-field-comparison-rules.mjs";
|
|
5
|
+
import { Month, betweenDaysRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule, maxDayRule, maxMonthRule, maxYearRule, minDayRule, minMonthRule, minYearRule, monthRule, quarterRule, yearRule } from "./date-period-rules.mjs";
|
|
6
|
+
import { withinDaysRule, withinFutureDaysRule, withinPastDaysRule } from "./date-relative-rules.mjs";
|
|
7
|
+
import { betweenAgeRule, birthdayRule, leapYearRule } from "./date-special-rules.mjs";
|
|
8
|
+
export { Month, afterFieldRule, afterTodayRule, ageRule, beforeFieldRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenAgeRule, betweenDatesRule, betweenDaysRule, betweenHoursRule, betweenMinutesRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule, birthdayRule, businessDayRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, futureRule, leapYearRule, maxAgeRule, maxDateRule, maxDayRule, maxMonthRule, maxYearRule, minAgeRule, minDateRule, minDayRule, minMonthRule, minYearRule, monthRule, pastRule, quarterRule, sameAsFieldDateRule, todayRule, weekDayRule, weekdayRule, weekdaysRule, weekendRule, withinDaysRule, withinFutureDaysRule, withinPastDaysRule, yearRule };
|
package/esm/rules/date/index.mjs
CHANGED
|
@@ -6,4 +6,4 @@ import { betweenDaysRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule,
|
|
|
6
6
|
import { withinDaysRule, withinFutureDaysRule, withinPastDaysRule } from "./date-relative-rules.mjs";
|
|
7
7
|
import { betweenAgeRule, birthdayRule, leapYearRule } from "./date-special-rules.mjs";
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { afterFieldRule, afterTodayRule, ageRule, beforeFieldRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenAgeRule, betweenDatesRule, betweenDaysRule, betweenHoursRule, betweenMinutesRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule, birthdayRule, businessDayRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, futureRule, leapYearRule, maxAgeRule, maxDateRule, maxDayRule, maxMonthRule, maxYearRule, minAgeRule, minDateRule, minDayRule, minMonthRule, minYearRule, monthRule, pastRule, quarterRule, sameAsFieldDateRule, todayRule, weekDayRule, weekdayRule, weekdaysRule, weekendRule, withinDaysRule, withinFutureDaysRule, withinPastDaysRule, yearRule };
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/file/dimensions.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Min width rule - image width validation
|
|
6
6
|
*/
|
|
7
|
-
declare const minWidthRule: SchemaRule<{
|
|
7
|
+
export declare const minWidthRule: SchemaRule<{
|
|
8
8
|
minWidth: number;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
11
11
|
* Max width rule - image width validation
|
|
12
12
|
*/
|
|
13
|
-
declare const maxWidthRule: SchemaRule<{
|
|
13
|
+
export declare const maxWidthRule: SchemaRule<{
|
|
14
14
|
maxWidth: number;
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
17
|
* Min height rule - image height validation
|
|
18
18
|
*/
|
|
19
|
-
declare const minHeightRule: SchemaRule<{
|
|
19
|
+
export declare const minHeightRule: SchemaRule<{
|
|
20
20
|
minHeight: number;
|
|
21
21
|
}>;
|
|
22
22
|
/**
|
|
23
23
|
* Max height rule - image height validation
|
|
24
24
|
*/
|
|
25
|
-
declare const maxHeightRule: SchemaRule<{
|
|
25
|
+
export declare const maxHeightRule: SchemaRule<{
|
|
26
26
|
maxHeight: number;
|
|
27
27
|
}>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { maxHeightRule, maxWidthRule, minHeightRule, minWidthRule };
|
|
30
29
|
//# sourceMappingURL=dimensions.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimensions.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/file/dimensions.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dimensions.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/file/dimensions.ts"],"mappings":";;;;;;qBAMa,cAAc;EAAa;;;;;qBAmB3B,cAAc;EAAa;;;;;qBAmB3B,eAAe;EAAa;;;;;qBAmB5B,eAAe;EAAa"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/file/file-size.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Max file size rule
|
|
6
6
|
*/
|
|
7
|
-
declare const maxFileSizeRule: SchemaRule<{
|
|
7
|
+
export declare const maxFileSizeRule: SchemaRule<{
|
|
8
8
|
maxSize: number;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
11
11
|
* Min file size rule
|
|
12
12
|
*/
|
|
13
|
-
declare const minFileSizeRule: SchemaRule<{
|
|
13
|
+
export declare const minFileSizeRule: SchemaRule<{
|
|
14
14
|
minSize: number;
|
|
15
15
|
}>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { maxFileSizeRule, minFileSizeRule };
|
|
18
17
|
//# sourceMappingURL=file-size.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-size.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/file/file-size.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-size.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/file/file-size.ts"],"mappings":";;;;;;qBAMa,iBAAiB;EAAa;;;;;qBAmB9B,iBAAiB;EAAa"}
|
package/esm/rules/file/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { maxHeightRule, maxWidthRule, minHeightRule, minWidthRule } from "./dimensions.mjs";
|
|
2
2
|
import { maxFileSizeRule, minFileSizeRule } from "./file-size.mjs";
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { maxFileSizeRule, maxHeightRule, maxWidthRule, minFileSizeRule, minHeightRule, minWidthRule };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { equalRule } from "./core/equal.mjs";
|
|
2
|
+
import { forbiddenRule } from "./core/forbidden.mjs";
|
|
3
|
+
import { presentRule, requiredRule } from "./core/required.mjs";
|
|
4
|
+
import { unionRule } from "./core/union.mjs";
|
|
5
|
+
import { whenRule } from "./core/when.mjs";
|
|
6
|
+
import "./core/index.mjs";
|
|
7
|
+
import { alphaNumericRule, alphaRule, isNumericRule } from "./string/alpha.mjs";
|
|
8
|
+
import { isCreditCardRule } from "./string/credit-card.mjs";
|
|
9
|
+
import { emailRule } from "./string/email.mjs";
|
|
10
|
+
import { UUIDVersion, cuidRule, nanoidRule, ulidRule, uuidRule } from "./string/id-formats.mjs";
|
|
11
|
+
import { ip4Rule, ip6Rule, ipRule, isIP, isIPv4, isIPv6 } from "./string/ip.mjs";
|
|
12
|
+
import { matchesRule } from "./string/matches.mjs";
|
|
13
|
+
import { patternRule } from "./string/pattern.mjs";
|
|
14
|
+
import { containsRule, endsWithRule, notContainsRule, startsWithRule } from "./string/string-comparison.mjs";
|
|
15
|
+
import { strongPasswordRule } from "./string/strong-password-rule.mjs";
|
|
16
|
+
import { urlRule } from "./string/url.mjs";
|
|
17
|
+
import { withoutWhitespaceRule } from "./string/without-whitespace.mjs";
|
|
18
|
+
import "./string/index.mjs";
|
|
19
|
+
import { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule } from "./number/number-rules.mjs";
|
|
20
|
+
import "./number/index.mjs";
|
|
21
|
+
import { betweenLengthRule, lengthRule, maxLengthRule, maxWordsRule, minLengthRule, minWordsRule, wordsRule } from "./length/length-rules.mjs";
|
|
22
|
+
import "./length/index.mjs";
|
|
23
|
+
import { sortedArrayRule, uniqueArrayRule } from "./array/array-rules.mjs";
|
|
24
|
+
import "./array/index.mjs";
|
|
25
|
+
import { ageRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenHoursRule, betweenMinutesRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, maxAgeRule, maxDateRule, minAgeRule, minDateRule, weekDayRule } from "./date/date.mjs";
|
|
26
|
+
import { afterTodayRule, betweenDatesRule, futureRule, pastRule, todayRule } from "./date/date-comparison-rules.mjs";
|
|
27
|
+
import { businessDayRule, weekdayRule, weekdaysRule, weekendRule } from "./date/date-day-rules.mjs";
|
|
28
|
+
import { afterFieldRule, beforeFieldRule, sameAsFieldDateRule } from "./date/date-field-comparison-rules.mjs";
|
|
29
|
+
import { Month, betweenDaysRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule, maxDayRule, maxMonthRule, maxYearRule, minDayRule, minMonthRule, minYearRule, monthRule, quarterRule, yearRule } from "./date/date-period-rules.mjs";
|
|
30
|
+
import { withinDaysRule, withinFutureDaysRule, withinPastDaysRule } from "./date/date-relative-rules.mjs";
|
|
31
|
+
import { betweenAgeRule, birthdayRule, leapYearRule } from "./date/date-special-rules.mjs";
|
|
32
|
+
import "./date/index.mjs";
|
|
33
|
+
import { maxHeightRule, maxWidthRule, minHeightRule, minWidthRule } from "./file/dimensions.mjs";
|
|
34
|
+
import { maxFileSizeRule, minFileSizeRule } from "./file/file-size.mjs";
|
|
35
|
+
import "./file/index.mjs";
|
|
36
|
+
import { colorRule, darkColorRule, hexColorRule, hslColorRule, lightColorRule, rgbColorRule, rgbaColorRule } from "./color/color-rules.mjs";
|
|
37
|
+
import "./color/index.mjs";
|
|
38
|
+
import { requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule } from "./conditional/required-if-rules.mjs";
|
|
39
|
+
import { requiredUnlessRule } from "./conditional/required-unless-rules.mjs";
|
|
40
|
+
import { requiredWhenRule } from "./conditional/required-when-rule.mjs";
|
|
41
|
+
import { requiredWithAllRule, requiredWithAnyRule, requiredWithRule } from "./conditional/required-with-rules.mjs";
|
|
42
|
+
import { requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule } from "./conditional/required-without-rules.mjs";
|
|
43
|
+
import { presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule } from "./conditional/present-if-rules.mjs";
|
|
44
|
+
import { presentUnlessRule } from "./conditional/present-unless-rules.mjs";
|
|
45
|
+
import { presentWithAllRule, presentWithAnyRule, presentWithRule } from "./conditional/present-with-rules.mjs";
|
|
46
|
+
import { presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule } from "./conditional/present-without-rules.mjs";
|
|
47
|
+
import { forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule } from "./conditional/forbidden-if-rules.mjs";
|
|
48
|
+
import "./conditional/index.mjs";
|
|
49
|
+
import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from "./common/enum.mjs";
|
|
50
|
+
import { equalsFieldRule, notEqualsFieldRule } from "./common/equals-field-rules.mjs";
|
|
51
|
+
import { instanceofRule } from "./common/instanceof.mjs";
|
|
52
|
+
import { literalRule } from "./common/literal.mjs";
|
|
53
|
+
import { arrayRule, booleanRule, floatRule, intRule, numberRule, objectRule, plainObjectRule, scalarRule, stringRule } from "./common/type-rules.mjs";
|
|
54
|
+
import { unknownKeyRule } from "./common/unknown-key.mjs";
|
|
55
|
+
import "./common/index.mjs";
|
|
56
|
+
export { Month, UUIDVersion, afterFieldRule, afterTodayRule, ageRule, allowedValuesRule, alphaNumericRule, alphaRule, arrayRule, beforeFieldRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenAgeRule, betweenDatesRule, betweenDaysRule, betweenHoursRule, betweenLengthRule, betweenMinutesRule, betweenMonthsRule, betweenNumbersRule, betweenTimesRule, betweenYearsRule, birthdayRule, booleanRule, businessDayRule, colorRule, containsRule, cuidRule, darkColorRule, dateRule, emailRule, endsWithRule, enumRule, equalRule, equalsFieldRule, evenRule, floatRule, forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule, forbiddenRule, fromHourRule, fromMinuteRule, fromTodayRule, futureRule, greaterThanRule, hexColorRule, hslColorRule, inRule, instanceofRule, intRule, ip4Rule, ip6Rule, ipRule, isCreditCardRule, isIP, isIPv4, isIPv6, isNumericRule, leapYearRule, lengthRule, lessThanRule, lightColorRule, literalRule, matchesRule, maxAgeRule, maxDateRule, maxDayRule, maxFileSizeRule, maxHeightRule, maxLengthRule, maxMonthRule, maxRule, maxWidthRule, maxWordsRule, maxYearRule, minAgeRule, minDateRule, minDayRule, minFileSizeRule, minHeightRule, minLengthRule, minMonthRule, minRule, minWidthRule, minWordsRule, minYearRule, moduloRule, monthRule, nanoidRule, negativeRule, notAllowedValuesRule, notContainsRule, notEqualsFieldRule, numberRule, objectRule, oddRule, pastRule, patternRule, plainObjectRule, positiveRule, presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule, presentRule, presentUnlessRule, presentWithAllRule, presentWithAnyRule, presentWithRule, presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule, quarterRule, requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule, requiredRule, requiredUnlessRule, requiredWhenRule, requiredWithAllRule, requiredWithAnyRule, requiredWithRule, requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule, rgbColorRule, rgbaColorRule, sameAsFieldDateRule, scalarRule, sortedArrayRule, startsWithRule, stringRule, strongPasswordRule, todayRule, ulidRule, unionRule, uniqueArrayRule, unknownKeyRule, urlRule, uuidRule, weekDayRule, weekdayRule, weekdaysRule, weekendRule, whenRule, withinDaysRule, withinFutureDaysRule, withinPastDaysRule, withoutWhitespaceRule, wordsRule, yearRule };
|
package/esm/rules/index.mjs
CHANGED
|
@@ -54,4 +54,4 @@ import { arrayRule, booleanRule, floatRule, intRule, numberRule, objectRule, pla
|
|
|
54
54
|
import { unknownKeyRule } from "./common/unknown-key.mjs";
|
|
55
55
|
import "./common/index.mjs";
|
|
56
56
|
|
|
57
|
-
export {
|
|
57
|
+
export { afterFieldRule, afterTodayRule, ageRule, allowedValuesRule, alphaNumericRule, alphaRule, arrayRule, beforeFieldRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenAgeRule, betweenDatesRule, betweenDaysRule, betweenHoursRule, betweenLengthRule, betweenMinutesRule, betweenMonthsRule, betweenNumbersRule, betweenTimesRule, betweenYearsRule, birthdayRule, booleanRule, businessDayRule, colorRule, containsRule, cuidRule, darkColorRule, dateRule, emailRule, endsWithRule, enumRule, equalRule, equalsFieldRule, evenRule, floatRule, forbiddenIfEmptyRule, forbiddenIfInRule, forbiddenIfNotEmptyRule, forbiddenIfNotInRule, forbiddenIfNotRule, forbiddenIfRule, forbiddenRule, fromHourRule, fromMinuteRule, fromTodayRule, futureRule, greaterThanRule, hexColorRule, hslColorRule, inRule, instanceofRule, intRule, ip4Rule, ip6Rule, ipRule, isCreditCardRule, isIP, isIPv4, isIPv6, isNumericRule, leapYearRule, lengthRule, lessThanRule, lightColorRule, literalRule, matchesRule, maxAgeRule, maxDateRule, maxDayRule, maxFileSizeRule, maxHeightRule, maxLengthRule, maxMonthRule, maxRule, maxWidthRule, maxWordsRule, maxYearRule, minAgeRule, minDateRule, minDayRule, minFileSizeRule, minHeightRule, minLengthRule, minMonthRule, minRule, minWidthRule, minWordsRule, minYearRule, moduloRule, monthRule, nanoidRule, negativeRule, notAllowedValuesRule, notContainsRule, notEqualsFieldRule, numberRule, objectRule, oddRule, pastRule, patternRule, plainObjectRule, positiveRule, presentIfEmptyRule, presentIfInRule, presentIfNotEmptyRule, presentIfNotInRule, presentIfRule, presentRule, presentUnlessRule, presentWithAllRule, presentWithAnyRule, presentWithRule, presentWithoutAllRule, presentWithoutAnyRule, presentWithoutRule, quarterRule, requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule, requiredRule, requiredUnlessRule, requiredWhenRule, requiredWithAllRule, requiredWithAnyRule, requiredWithRule, requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule, rgbColorRule, rgbaColorRule, sameAsFieldDateRule, scalarRule, sortedArrayRule, startsWithRule, stringRule, strongPasswordRule, todayRule, ulidRule, unionRule, uniqueArrayRule, unknownKeyRule, urlRule, uuidRule, weekDayRule, weekdayRule, weekdaysRule, weekendRule, whenRule, withinDaysRule, withinFutureDaysRule, withinPastDaysRule, withoutWhitespaceRule, wordsRule, yearRule };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/length/length-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Min length rule - validates minimum length
|
|
6
6
|
* Works for any value with a length property (strings, arrays, etc.)
|
|
7
7
|
*/
|
|
8
|
-
declare const minLengthRule: SchemaRule<{
|
|
8
|
+
export declare const minLengthRule: SchemaRule<{
|
|
9
9
|
minLength: number;
|
|
10
10
|
}>;
|
|
11
11
|
/**
|
|
12
12
|
* Max length rule - validates maximum length
|
|
13
13
|
* Works for any value with a length property (strings, arrays, etc.)
|
|
14
14
|
*/
|
|
15
|
-
declare const maxLengthRule: SchemaRule<{
|
|
15
|
+
export declare const maxLengthRule: SchemaRule<{
|
|
16
16
|
maxLength: number;
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
19
19
|
* Between length rule - validates length is between min and max (inclusive)
|
|
20
20
|
* Works for any value with a length property (strings, arrays, etc.)
|
|
21
21
|
*/
|
|
22
|
-
declare const betweenLengthRule: SchemaRule<{
|
|
22
|
+
export declare const betweenLengthRule: SchemaRule<{
|
|
23
23
|
minLength: number;
|
|
24
24
|
maxLength: number;
|
|
25
25
|
}>;
|
|
@@ -27,27 +27,26 @@ declare const betweenLengthRule: SchemaRule<{
|
|
|
27
27
|
* Length rule - validates exact length
|
|
28
28
|
* Works for any value with a length property (strings, arrays, etc.)
|
|
29
29
|
*/
|
|
30
|
-
declare const lengthRule: SchemaRule<{
|
|
30
|
+
export declare const lengthRule: SchemaRule<{
|
|
31
31
|
length: number;
|
|
32
32
|
}>;
|
|
33
33
|
/**
|
|
34
34
|
* Min words rule - validates minimum word count
|
|
35
35
|
*/
|
|
36
|
-
declare const minWordsRule: SchemaRule<{
|
|
36
|
+
export declare const minWordsRule: SchemaRule<{
|
|
37
37
|
minWords: number;
|
|
38
38
|
}>;
|
|
39
39
|
/**
|
|
40
40
|
* Max words rule - validates maximum word count
|
|
41
41
|
*/
|
|
42
|
-
declare const maxWordsRule: SchemaRule<{
|
|
42
|
+
export declare const maxWordsRule: SchemaRule<{
|
|
43
43
|
maxWords: number;
|
|
44
44
|
}>;
|
|
45
45
|
/**
|
|
46
46
|
* Words rule - validates exact word count
|
|
47
47
|
*/
|
|
48
|
-
declare const wordsRule: SchemaRule<{
|
|
48
|
+
export declare const wordsRule: SchemaRule<{
|
|
49
49
|
words: number;
|
|
50
50
|
}>;
|
|
51
51
|
//#endregion
|
|
52
|
-
export { betweenLengthRule, lengthRule, maxLengthRule, maxWordsRule, minLengthRule, minWordsRule, wordsRule };
|
|
53
52
|
//# sourceMappingURL=length-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"length-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/length/length-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"length-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/length/length-rules.ts"],"mappings":";;;;;;;qBAOa,eAAe;EAAa;;;;;;qBAoB5B,eAAe;EAAa;;;;;;qBAoB5B,mBAAmB;EAC9B;EACA;;;;;;qBAsBW,YAAY;EAAa;;;;;qBAmBzB,cAAc;EAAa;;;;;qBAiB3B,cAAc;EAAa;;;;;qBAiB3B,WAAW;EAAa"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule } from "./number-rules.mjs";
|
|
2
|
+
export { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule } from "./number-rules.mjs";
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/number/number-rules.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Min rule - value must be equal or greater than minimum
|
|
6
6
|
* Supports field names with sibling scope
|
|
7
7
|
*/
|
|
8
|
-
declare const minRule: SchemaRule<{
|
|
8
|
+
export declare const minRule: SchemaRule<{
|
|
9
9
|
min: number | string;
|
|
10
10
|
scope?: "global" | "sibling";
|
|
11
11
|
}>;
|
|
@@ -13,7 +13,7 @@ declare const minRule: SchemaRule<{
|
|
|
13
13
|
* Max rule - value must be equal or less than maximum
|
|
14
14
|
* Supports field names with sibling scope
|
|
15
15
|
*/
|
|
16
|
-
declare const maxRule: SchemaRule<{
|
|
16
|
+
export declare const maxRule: SchemaRule<{
|
|
17
17
|
max: number | string;
|
|
18
18
|
scope?: "global" | "sibling";
|
|
19
19
|
}>;
|
|
@@ -21,7 +21,7 @@ declare const maxRule: SchemaRule<{
|
|
|
21
21
|
* Greater than rule - value must be strictly greater than minimum
|
|
22
22
|
* Supports field names with sibling scope
|
|
23
23
|
*/
|
|
24
|
-
declare const greaterThanRule: SchemaRule<{
|
|
24
|
+
export declare const greaterThanRule: SchemaRule<{
|
|
25
25
|
value: number | string;
|
|
26
26
|
scope?: "global" | "sibling";
|
|
27
27
|
}>;
|
|
@@ -29,41 +29,40 @@ declare const greaterThanRule: SchemaRule<{
|
|
|
29
29
|
* Less than rule - value must be strictly less than maximum
|
|
30
30
|
* Supports field names with sibling scope
|
|
31
31
|
*/
|
|
32
|
-
declare const lessThanRule: SchemaRule<{
|
|
32
|
+
export declare const lessThanRule: SchemaRule<{
|
|
33
33
|
value: number | string;
|
|
34
34
|
scope?: "global" | "sibling";
|
|
35
35
|
}>;
|
|
36
36
|
/**
|
|
37
37
|
* Positive rule - value must be greater than 0
|
|
38
38
|
*/
|
|
39
|
-
declare const positiveRule: SchemaRule;
|
|
39
|
+
export declare const positiveRule: SchemaRule;
|
|
40
40
|
/**
|
|
41
41
|
* Negative rule - value must be less than 0
|
|
42
42
|
*/
|
|
43
|
-
declare const negativeRule: SchemaRule;
|
|
43
|
+
export declare const negativeRule: SchemaRule;
|
|
44
44
|
/**
|
|
45
45
|
* Odd rule - value must be an odd number
|
|
46
46
|
*/
|
|
47
|
-
declare const oddRule: SchemaRule;
|
|
47
|
+
export declare const oddRule: SchemaRule;
|
|
48
48
|
/**
|
|
49
49
|
* Even rule - value must be an even number
|
|
50
50
|
*/
|
|
51
|
-
declare const evenRule: SchemaRule;
|
|
51
|
+
export declare const evenRule: SchemaRule;
|
|
52
52
|
/**
|
|
53
53
|
* Modulo rule - value must be divisible by given number
|
|
54
54
|
*/
|
|
55
|
-
declare const moduloRule: SchemaRule<{
|
|
55
|
+
export declare const moduloRule: SchemaRule<{
|
|
56
56
|
value: number;
|
|
57
57
|
}>;
|
|
58
58
|
/**
|
|
59
59
|
* Between rule - value must be between the given two numbers (Inclusive)
|
|
60
60
|
* Supports field names with sibling scope
|
|
61
61
|
*/
|
|
62
|
-
declare const betweenNumbersRule: SchemaRule<{
|
|
62
|
+
export declare const betweenNumbersRule: SchemaRule<{
|
|
63
63
|
min: number | string;
|
|
64
64
|
max: number | string;
|
|
65
65
|
scope?: "global" | "sibling";
|
|
66
66
|
}>;
|
|
67
67
|
//#endregion
|
|
68
|
-
export { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule };
|
|
69
68
|
//# sourceMappingURL=number-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/number/number-rules.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"number-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/number/number-rules.ts"],"mappings":";;;;;;;qBAQa,SAAS;EACpB;EACA;;;;;;qBAwCW,SAAS;EACpB;EACA;;;;;;qBAwCW,iBAAiB;EAC5B;EACA;;;;;;qBAwCW,cAAc;EACzB;EACA;;;;;qBAuCW,cAAc;;;;qBAed,cAAc;;;;qBAed,SAAS;;;;qBAeT,UAAU;;;;qBAeV,YAAY;EAAa;;;;;;qBAkBzB,oBAAoB;EAC/B;EACA;EACA"}
|
|
@@ -17,7 +17,8 @@ const minRule = {
|
|
|
17
17
|
compareMin = min;
|
|
18
18
|
this.context.translationParams.min = min;
|
|
19
19
|
} else {
|
|
20
|
-
const
|
|
20
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
21
|
+
const fieldValue = get(source, min);
|
|
21
22
|
if (fieldValue === void 0) return VALID_RULE;
|
|
22
23
|
this.context.translatableParams.min = min;
|
|
23
24
|
compareMin = Number(fieldValue);
|
|
@@ -41,7 +42,8 @@ const maxRule = {
|
|
|
41
42
|
compareMax = max;
|
|
42
43
|
this.context.translationParams.max = max;
|
|
43
44
|
} else {
|
|
44
|
-
const
|
|
45
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
46
|
+
const fieldValue = get(source, max);
|
|
45
47
|
if (fieldValue === void 0) return VALID_RULE;
|
|
46
48
|
this.context.translatableParams.max = max;
|
|
47
49
|
compareMax = Number(fieldValue);
|
|
@@ -65,7 +67,8 @@ const greaterThanRule = {
|
|
|
65
67
|
compareNumber = compareValue;
|
|
66
68
|
this.context.translationParams.value = compareValue;
|
|
67
69
|
} else {
|
|
68
|
-
const
|
|
70
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
71
|
+
const fieldValue = get(source, compareValue);
|
|
69
72
|
if (fieldValue === void 0) return VALID_RULE;
|
|
70
73
|
this.context.translatableParams.value = compareValue;
|
|
71
74
|
compareNumber = Number(fieldValue);
|
|
@@ -89,7 +92,8 @@ const lessThanRule = {
|
|
|
89
92
|
compareNumber = compareValue;
|
|
90
93
|
this.context.translationParams.value = compareValue;
|
|
91
94
|
} else {
|
|
92
|
-
const
|
|
95
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
96
|
+
const fieldValue = get(source, compareValue);
|
|
93
97
|
if (fieldValue === void 0) return VALID_RULE;
|
|
94
98
|
this.context.translatableParams.value = compareValue;
|
|
95
99
|
compareNumber = Number(fieldValue);
|
|
@@ -169,7 +173,8 @@ const betweenNumbersRule = {
|
|
|
169
173
|
compareMin = min;
|
|
170
174
|
this.context.translationParams.min = min;
|
|
171
175
|
} else {
|
|
172
|
-
const
|
|
176
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
177
|
+
const fieldValue = get(source, min);
|
|
173
178
|
if (fieldValue === void 0) return VALID_RULE;
|
|
174
179
|
this.context.translatableParams.min = min;
|
|
175
180
|
compareMin = Number(fieldValue);
|
|
@@ -180,7 +185,8 @@ const betweenNumbersRule = {
|
|
|
180
185
|
compareMax = max;
|
|
181
186
|
this.context.translationParams.max = max;
|
|
182
187
|
} else {
|
|
183
|
-
const
|
|
188
|
+
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
189
|
+
const fieldValue = get(source, max);
|
|
184
190
|
if (fieldValue === void 0) return VALID_RULE;
|
|
185
191
|
this.context.translatableParams.max = max;
|
|
186
192
|
compareMax = Number(fieldValue);
|