n4s 5.0.1 → 5.0.2
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 +0 -4
- package/README.md +2 -0
- package/compose/package.json +2 -0
- package/compounds/package.json +2 -0
- package/date/package.json +9 -0
- package/dist/cjs/compose.development.js +14 -97
- package/dist/cjs/compose.js +0 -1
- package/dist/cjs/compose.production.js +1 -1
- package/dist/cjs/compounds.development.js +30 -86
- package/dist/cjs/compounds.js +0 -1
- package/dist/cjs/compounds.production.js +1 -1
- package/dist/cjs/date.development.js +186 -0
- package/dist/cjs/date.js +6 -0
- package/dist/cjs/date.production.js +1 -0
- package/dist/cjs/email.development.js +363 -0
- package/dist/cjs/email.js +6 -0
- package/dist/cjs/email.production.js +1 -0
- package/dist/cjs/isURL.development.js +353 -0
- package/dist/cjs/isURL.js +6 -0
- package/dist/cjs/isURL.production.js +1 -0
- package/dist/cjs/n4s.development.js +205 -387
- package/dist/cjs/n4s.js +0 -1
- package/dist/cjs/n4s.production.js +1 -1
- package/dist/cjs/schema.development.js +19 -80
- package/dist/cjs/schema.js +0 -1
- package/dist/cjs/schema.production.js +1 -1
- package/dist/es/compose.development.js +14 -97
- package/dist/es/compose.production.js +1 -1
- package/dist/es/compounds.development.js +28 -84
- package/dist/es/compounds.production.js +1 -1
- package/dist/es/date.development.js +184 -0
- package/dist/es/date.production.js +1 -0
- package/dist/es/email.development.js +361 -0
- package/dist/es/email.production.js +1 -0
- package/dist/es/isURL.development.js +351 -0
- package/dist/es/isURL.production.js +1 -0
- package/dist/es/n4s.development.js +192 -372
- package/dist/es/n4s.production.js +1 -1
- package/dist/es/schema.development.js +16 -75
- package/dist/es/schema.production.js +1 -1
- package/dist/umd/compose.development.js +18 -102
- package/dist/umd/compose.production.js +1 -1
- package/dist/umd/compounds.development.js +34 -91
- package/dist/umd/compounds.production.js +1 -1
- package/dist/umd/date.development.js +190 -0
- package/dist/umd/date.production.js +1 -0
- package/dist/umd/email.development.js +367 -0
- package/dist/umd/email.production.js +1 -0
- package/dist/umd/isURL.development.js +357 -0
- package/dist/umd/isURL.production.js +1 -0
- package/dist/umd/n4s.development.js +209 -392
- package/dist/umd/n4s.production.js +1 -1
- package/dist/umd/schema.development.js +23 -85
- package/dist/umd/schema.production.js +1 -1
- package/email/package.json +9 -0
- package/isURL/package.json +9 -0
- package/package.json +162 -55
- package/schema/package.json +2 -0
- package/testUtils/TEnforceMock.ts +3 -0
- package/types/compose.d.ts +46 -55
- package/types/compose.d.ts.map +1 -0
- package/types/compounds.d.ts +50 -62
- package/types/compounds.d.ts.map +1 -0
- package/types/date.d.ts +18 -0
- package/types/date.d.ts.map +1 -0
- package/types/email.d.ts +12 -0
- package/types/email.d.ts.map +1 -0
- package/types/isURL.d.ts +12 -0
- package/types/isURL.d.ts.map +1 -0
- package/types/n4s.d.ts +62 -73
- package/types/n4s.d.ts.map +1 -0
- package/types/schema.d.ts +55 -63
- package/types/schema.d.ts.map +1 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -44
- package/docs/_sidebar.md +0 -5
- package/docs/external.md +0 -27
- package/docs/index.html +0 -32
- package/docs/rules.md +0 -1282
- package/tsconfig.json +0 -8
package/types/compose.d.ts
CHANGED
|
@@ -1,49 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
...infer U
|
|
4
|
-
] ? U : never;
|
|
5
|
-
type TStringable = string | ((...args: any[]) => string);
|
|
6
|
-
type TRuleReturn = boolean | {
|
|
1
|
+
import { CB, Stringable, DynamicValue, DropFirst, BlankValue } from "vest-utils";
|
|
2
|
+
type RuleReturn = boolean | {
|
|
7
3
|
pass: boolean;
|
|
8
|
-
message?:
|
|
4
|
+
message?: Stringable;
|
|
9
5
|
};
|
|
10
|
-
type
|
|
6
|
+
type RuleDetailedResult = {
|
|
11
7
|
pass: boolean;
|
|
12
8
|
message?: string;
|
|
13
9
|
};
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
type KBaseRules = keyof
|
|
17
|
-
declare function condition(value: any, callback: (value: any) =>
|
|
10
|
+
type Args = any[];
|
|
11
|
+
type BaseRules = typeof baseRules;
|
|
12
|
+
type KBaseRules = keyof BaseRules;
|
|
13
|
+
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
18
14
|
declare function endsWith(value: string, arg1: string): boolean;
|
|
19
15
|
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
20
|
-
declare function greaterThan(value: number | string, gt: number | string): boolean;
|
|
21
16
|
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
22
17
|
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
23
|
-
// The module is named "isArrayValue" since it
|
|
24
|
-
// is conflicting with a nested npm dependency.
|
|
25
|
-
// We may need to revisit this in the future.
|
|
26
|
-
declare function isArray(value: unknown): value is Array<unknown>;
|
|
27
18
|
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
28
|
-
declare function isBlank(value: unknown):
|
|
29
|
-
declare function
|
|
30
|
-
declare function isEmpty(value: unknown): boolean;
|
|
19
|
+
declare function isBlank(value: unknown): value is BlankValue;
|
|
20
|
+
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
31
21
|
declare function isNaN(value: unknown): boolean;
|
|
32
22
|
declare function isNegative(value: number | string): boolean;
|
|
33
|
-
declare function isNull(value: unknown): value is null;
|
|
34
|
-
declare function isNullish(value: any): value is null | undefined;
|
|
35
23
|
declare function isNumber(value: unknown): value is number;
|
|
36
|
-
declare function isNumeric(value: string | number): boolean;
|
|
37
|
-
declare function isStringValue(v: unknown): v is string;
|
|
38
24
|
declare function isTruthy(value: unknown): boolean;
|
|
39
|
-
declare function
|
|
40
|
-
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
25
|
+
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
41
26
|
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
42
27
|
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
43
|
-
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
|
|
44
28
|
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
45
29
|
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
46
|
-
declare function numberEquals(value: string | number, eq: string | number): boolean;
|
|
47
30
|
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
48
31
|
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
49
32
|
declare function startsWith(value: string, arg1: string): boolean;
|
|
@@ -53,18 +36,19 @@ declare const baseRules: {
|
|
|
53
36
|
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
54
37
|
endsWith: typeof endsWith;
|
|
55
38
|
equals: typeof equals;
|
|
56
|
-
greaterThan: typeof greaterThan;
|
|
39
|
+
greaterThan: typeof import("vest-utils").greaterThan;
|
|
57
40
|
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
58
|
-
gt: typeof greaterThan;
|
|
41
|
+
gt: typeof import("vest-utils").greaterThan;
|
|
59
42
|
gte: typeof greaterThanOrEquals;
|
|
60
43
|
inside: typeof inside;
|
|
61
|
-
isArray: typeof isArray;
|
|
44
|
+
isArray: typeof import("vest-utils").isArray;
|
|
62
45
|
isBetween: typeof isBetween;
|
|
63
46
|
isBlank: typeof isBlank;
|
|
64
|
-
isBoolean: typeof isBoolean;
|
|
65
|
-
isEmpty: typeof isEmpty;
|
|
47
|
+
isBoolean: typeof import("vest-utils").isBoolean;
|
|
48
|
+
isEmpty: typeof import("vest-utils").isEmpty;
|
|
66
49
|
isEven: (value: any) => boolean;
|
|
67
50
|
isFalsy: (value: unknown) => boolean;
|
|
51
|
+
isKeyOf: typeof isKeyOf;
|
|
68
52
|
isNaN: typeof isNaN;
|
|
69
53
|
isNegative: typeof isNegative;
|
|
70
54
|
isNotArray: (value: unknown) => boolean;
|
|
@@ -72,6 +56,7 @@ declare const baseRules: {
|
|
|
72
56
|
isNotBlank: (value: unknown) => boolean;
|
|
73
57
|
isNotBoolean: (value: unknown) => boolean;
|
|
74
58
|
isNotEmpty: (value: unknown) => boolean;
|
|
59
|
+
isNotKeyOf: (key: string | number | symbol, obj: any) => boolean;
|
|
75
60
|
isNotNaN: (value: unknown) => boolean;
|
|
76
61
|
isNotNull: (value: unknown) => boolean;
|
|
77
62
|
isNotNullish: (value: any) => boolean;
|
|
@@ -79,20 +64,22 @@ declare const baseRules: {
|
|
|
79
64
|
isNotNumeric: (value: string | number) => boolean;
|
|
80
65
|
isNotString: (v: unknown) => boolean;
|
|
81
66
|
isNotUndefined: (value?: unknown) => boolean;
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
68
|
+
isNull: typeof import("vest-utils").isNull;
|
|
69
|
+
isNullish: typeof import("vest-utils").isNullish;
|
|
84
70
|
isNumber: typeof isNumber;
|
|
85
|
-
isNumeric: typeof isNumeric;
|
|
71
|
+
isNumeric: typeof import("vest-utils").isNumeric;
|
|
86
72
|
isOdd: (value: any) => boolean;
|
|
87
|
-
isPositive: (
|
|
88
|
-
isString: typeof isStringValue;
|
|
73
|
+
isPositive: typeof import("vest-utils").isPositive;
|
|
74
|
+
isString: typeof import("vest-utils").isStringValue;
|
|
89
75
|
isTruthy: typeof isTruthy;
|
|
90
|
-
isUndefined: typeof isUndefined;
|
|
91
|
-
|
|
76
|
+
isUndefined: typeof import("vest-utils").isUndefined;
|
|
77
|
+
isValueOf: typeof isValueOf;
|
|
78
|
+
lengthEquals: typeof import("vest-utils").lengthEquals;
|
|
92
79
|
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
93
80
|
lessThan: typeof lessThan;
|
|
94
81
|
lessThanOrEquals: typeof lessThanOrEquals;
|
|
95
|
-
longerThan: typeof longerThan;
|
|
82
|
+
longerThan: typeof import("vest-utils").longerThan;
|
|
96
83
|
longerThanOrEquals: typeof longerThanOrEquals;
|
|
97
84
|
lt: typeof lessThan;
|
|
98
85
|
lte: typeof lessThanOrEquals;
|
|
@@ -100,35 +87,39 @@ declare const baseRules: {
|
|
|
100
87
|
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
101
88
|
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
102
89
|
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
103
|
-
numberEquals: typeof numberEquals;
|
|
90
|
+
numberEquals: typeof import("vest-utils").numberEquals;
|
|
104
91
|
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
105
92
|
shorterThan: typeof shorterThan;
|
|
106
93
|
shorterThanOrEquals: typeof shorterThanOrEquals;
|
|
107
94
|
startsWith: typeof startsWith;
|
|
108
95
|
};
|
|
109
|
-
type
|
|
110
|
-
[P in KBaseRules]: (...args: DropFirst<Parameters<
|
|
96
|
+
type Rules<E = Record<string, unknown>> = n4s.EnforceCustomMatchers<Rules<E> & E> & Record<string, (...args: Args) => Rules<E> & E> & {
|
|
97
|
+
[P in KBaseRules]: (...args: DropFirst<Parameters<BaseRules[P]>> | Args) => Rules<E> & E;
|
|
111
98
|
};
|
|
112
99
|
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
|
|
113
100
|
declare global {
|
|
114
101
|
namespace n4s {
|
|
115
|
-
interface IRules<E> extends
|
|
102
|
+
interface IRules<E> extends Rules<E> {
|
|
116
103
|
}
|
|
117
104
|
}
|
|
118
105
|
}
|
|
119
|
-
type
|
|
120
|
-
type
|
|
106
|
+
type LazyRules = n4s.IRules<LazyRuleMethods>;
|
|
107
|
+
type Lazy = LazyRules & LazyRuleMethods &
|
|
121
108
|
// This is a "catch all" hack to make TS happy while not
|
|
122
109
|
// losing type hints
|
|
123
|
-
Record<string,
|
|
124
|
-
type
|
|
125
|
-
message: (message:
|
|
110
|
+
Record<string, CB>;
|
|
111
|
+
type LazyRuleMethods = LazyRuleRunners & {
|
|
112
|
+
message: (message: LazyMessage) => Lazy;
|
|
126
113
|
};
|
|
127
|
-
type
|
|
114
|
+
type LazyRuleRunners = {
|
|
128
115
|
test: (value: unknown) => boolean;
|
|
129
|
-
run: (value: unknown) =>
|
|
116
|
+
run: (value: unknown) => RuleDetailedResult;
|
|
130
117
|
};
|
|
131
|
-
type
|
|
132
|
-
type
|
|
133
|
-
|
|
118
|
+
type ComposeResult = LazyRuleRunners & ((value: any) => void);
|
|
119
|
+
type LazyMessage = DynamicValue<string, [
|
|
120
|
+
value: unknown,
|
|
121
|
+
originalMessage?: Stringable
|
|
122
|
+
]>;
|
|
123
|
+
declare function compose(...composites: LazyRuleRunners[]): ComposeResult;
|
|
134
124
|
export { compose as default };
|
|
125
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/exports/compose.ts","../src/runtime/enforceContext.ts","../src/lib/ruleReturn.ts","../src/rules/endsWith.ts","../src/rules/equals.ts","../src/rules/greaterThanOrEquals.ts","../src/rules/inside.ts","../src/rules/lessThan.ts","../src/rules/lessThanOrEquals.ts","../src/rules/isBetween.ts","../src/rules/isBlank.ts","../src/rules/isBoolean.ts","../src/rules/isEven.ts","../src/rules/isKeyOf.ts","../src/rules/isNaN.ts","../src/rules/isNegative.ts","../src/rules/isNumber.ts","../src/rules/isOdd.ts","../src/rules/isString.ts","../src/rules/isTruthy.ts","../src/rules/isValueOf.ts","../src/rules/longerThanOrEquals.ts","../src/rules/matches.ts","../src/rules/ruleCondition.ts","../src/rules/shorterThan.ts","../src/rules/shorterThanOrEquals.ts","../src/rules/startsWith.ts","../src/runtime/rules.ts","../src/runtime/runtimeRules.ts","../src/lib/transformResult.ts","../src/runtime/genEnforceLazy.ts","../src/lib/runLazyRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,iBAAwB,OAAO,CAC7B,GAAG,UAAU,EAAE,eAAe,EAAE,GAC/B,aAAa,CAoCf"}
|
package/types/compounds.d.ts
CHANGED
|
@@ -1,49 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
] ? U : never;
|
|
5
|
-
type TStringable = string | ((...args: any[]) => string);
|
|
6
|
-
type TRuleReturn = boolean | {
|
|
1
|
+
import { CB, DropFirst, Stringable, DynamicValue, BlankValue } from "vest-utils";
|
|
2
|
+
type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
|
|
3
|
+
type RuleReturn = boolean | {
|
|
7
4
|
pass: boolean;
|
|
8
|
-
message?:
|
|
5
|
+
message?: Stringable;
|
|
9
6
|
};
|
|
10
|
-
type
|
|
7
|
+
type RuleDetailedResult = {
|
|
11
8
|
pass: boolean;
|
|
12
9
|
message?: string;
|
|
13
10
|
};
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
type KBaseRules = keyof
|
|
17
|
-
declare function condition(value: any, callback: (value: any) =>
|
|
11
|
+
type Args = any[];
|
|
12
|
+
type BaseRules = typeof baseRules;
|
|
13
|
+
type KBaseRules = keyof BaseRules;
|
|
14
|
+
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
18
15
|
declare function endsWith(value: string, arg1: string): boolean;
|
|
19
16
|
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
20
|
-
declare function greaterThan(value: number | string, gt: number | string): boolean;
|
|
21
17
|
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
22
18
|
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
23
|
-
// The module is named "isArrayValue" since it
|
|
24
|
-
// is conflicting with a nested npm dependency.
|
|
25
|
-
// We may need to revisit this in the future.
|
|
26
|
-
declare function isArray(value: unknown): value is Array<unknown>;
|
|
27
19
|
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
28
|
-
declare function isBlank(value: unknown):
|
|
29
|
-
declare function
|
|
30
|
-
declare function isEmpty(value: unknown): boolean;
|
|
20
|
+
declare function isBlank(value: unknown): value is BlankValue;
|
|
21
|
+
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
31
22
|
declare function isNaN(value: unknown): boolean;
|
|
32
23
|
declare function isNegative(value: number | string): boolean;
|
|
33
|
-
declare function isNull(value: unknown): value is null;
|
|
34
|
-
declare function isNullish(value: any): value is null | undefined;
|
|
35
24
|
declare function isNumber(value: unknown): value is number;
|
|
36
|
-
declare function isNumeric(value: string | number): boolean;
|
|
37
|
-
declare function isStringValue(v: unknown): v is string;
|
|
38
25
|
declare function isTruthy(value: unknown): boolean;
|
|
39
|
-
declare function
|
|
40
|
-
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
26
|
+
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
41
27
|
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
42
28
|
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
43
|
-
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
|
|
44
29
|
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
45
30
|
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
46
|
-
declare function numberEquals(value: string | number, eq: string | number): boolean;
|
|
47
31
|
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
48
32
|
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
49
33
|
declare function startsWith(value: string, arg1: string): boolean;
|
|
@@ -53,18 +37,19 @@ declare const baseRules: {
|
|
|
53
37
|
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
54
38
|
endsWith: typeof endsWith;
|
|
55
39
|
equals: typeof equals;
|
|
56
|
-
greaterThan: typeof greaterThan;
|
|
40
|
+
greaterThan: typeof import("vest-utils").greaterThan;
|
|
57
41
|
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
58
|
-
gt: typeof greaterThan;
|
|
42
|
+
gt: typeof import("vest-utils").greaterThan;
|
|
59
43
|
gte: typeof greaterThanOrEquals;
|
|
60
44
|
inside: typeof inside;
|
|
61
|
-
isArray: typeof isArray;
|
|
45
|
+
isArray: typeof import("vest-utils").isArray;
|
|
62
46
|
isBetween: typeof isBetween;
|
|
63
47
|
isBlank: typeof isBlank;
|
|
64
|
-
isBoolean: typeof isBoolean;
|
|
65
|
-
isEmpty: typeof isEmpty;
|
|
48
|
+
isBoolean: typeof import("vest-utils").isBoolean;
|
|
49
|
+
isEmpty: typeof import("vest-utils").isEmpty;
|
|
66
50
|
isEven: (value: any) => boolean;
|
|
67
51
|
isFalsy: (value: unknown) => boolean;
|
|
52
|
+
isKeyOf: typeof isKeyOf;
|
|
68
53
|
isNaN: typeof isNaN;
|
|
69
54
|
isNegative: typeof isNegative;
|
|
70
55
|
isNotArray: (value: unknown) => boolean;
|
|
@@ -72,6 +57,7 @@ declare const baseRules: {
|
|
|
72
57
|
isNotBlank: (value: unknown) => boolean;
|
|
73
58
|
isNotBoolean: (value: unknown) => boolean;
|
|
74
59
|
isNotEmpty: (value: unknown) => boolean;
|
|
60
|
+
isNotKeyOf: (key: string | number | symbol, obj: any) => boolean;
|
|
75
61
|
isNotNaN: (value: unknown) => boolean;
|
|
76
62
|
isNotNull: (value: unknown) => boolean;
|
|
77
63
|
isNotNullish: (value: any) => boolean;
|
|
@@ -79,20 +65,22 @@ declare const baseRules: {
|
|
|
79
65
|
isNotNumeric: (value: string | number) => boolean;
|
|
80
66
|
isNotString: (v: unknown) => boolean;
|
|
81
67
|
isNotUndefined: (value?: unknown) => boolean;
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
69
|
+
isNull: typeof import("vest-utils").isNull;
|
|
70
|
+
isNullish: typeof import("vest-utils").isNullish;
|
|
84
71
|
isNumber: typeof isNumber;
|
|
85
|
-
isNumeric: typeof isNumeric;
|
|
72
|
+
isNumeric: typeof import("vest-utils").isNumeric;
|
|
86
73
|
isOdd: (value: any) => boolean;
|
|
87
|
-
isPositive: (
|
|
88
|
-
isString: typeof isStringValue;
|
|
74
|
+
isPositive: typeof import("vest-utils").isPositive;
|
|
75
|
+
isString: typeof import("vest-utils").isStringValue;
|
|
89
76
|
isTruthy: typeof isTruthy;
|
|
90
|
-
isUndefined: typeof isUndefined;
|
|
91
|
-
|
|
77
|
+
isUndefined: typeof import("vest-utils").isUndefined;
|
|
78
|
+
isValueOf: typeof isValueOf;
|
|
79
|
+
lengthEquals: typeof import("vest-utils").lengthEquals;
|
|
92
80
|
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
93
81
|
lessThan: typeof lessThan;
|
|
94
82
|
lessThanOrEquals: typeof lessThanOrEquals;
|
|
95
|
-
longerThan: typeof longerThan;
|
|
83
|
+
longerThan: typeof import("vest-utils").longerThan;
|
|
96
84
|
longerThanOrEquals: typeof longerThanOrEquals;
|
|
97
85
|
lt: typeof lessThan;
|
|
98
86
|
lte: typeof lessThanOrEquals;
|
|
@@ -100,47 +88,47 @@ declare const baseRules: {
|
|
|
100
88
|
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
101
89
|
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
102
90
|
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
103
|
-
numberEquals: typeof numberEquals;
|
|
91
|
+
numberEquals: typeof import("vest-utils").numberEquals;
|
|
104
92
|
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
105
93
|
shorterThan: typeof shorterThan;
|
|
106
94
|
shorterThanOrEquals: typeof shorterThanOrEquals;
|
|
107
95
|
startsWith: typeof startsWith;
|
|
108
96
|
};
|
|
109
|
-
type
|
|
110
|
-
[P in KBaseRules]: (...args: DropFirst<Parameters<
|
|
97
|
+
type Rules<E = Record<string, unknown>> = n4s.EnforceCustomMatchers<Rules<E> & E> & Record<string, (...args: Args) => Rules<E> & E> & {
|
|
98
|
+
[P in KBaseRules]: (...args: DropFirst<Parameters<BaseRules[P]>> | Args) => Rules<E> & E;
|
|
111
99
|
};
|
|
112
100
|
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
|
|
113
101
|
declare global {
|
|
114
102
|
namespace n4s {
|
|
115
|
-
interface IRules<E> extends
|
|
103
|
+
interface IRules<E> extends Rules<E> {
|
|
116
104
|
}
|
|
117
105
|
}
|
|
118
106
|
}
|
|
119
|
-
type
|
|
120
|
-
type
|
|
107
|
+
type LazyRules = n4s.IRules<LazyRuleMethods>;
|
|
108
|
+
type Lazy = LazyRules & LazyRuleMethods &
|
|
121
109
|
// This is a "catch all" hack to make TS happy while not
|
|
122
110
|
// losing type hints
|
|
123
|
-
Record<string,
|
|
124
|
-
type
|
|
125
|
-
message: (message:
|
|
111
|
+
Record<string, CB>;
|
|
112
|
+
type LazyRuleMethods = LazyRuleRunners & {
|
|
113
|
+
message: (message: LazyMessage) => Lazy;
|
|
126
114
|
};
|
|
127
|
-
type
|
|
115
|
+
type LazyRuleRunners = {
|
|
128
116
|
test: (value: unknown) => boolean;
|
|
129
|
-
run: (value: unknown) =>
|
|
117
|
+
run: (value: unknown) => RuleDetailedResult;
|
|
130
118
|
};
|
|
131
|
-
type
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
type LazyMessage = DynamicValue<string, [
|
|
120
|
+
value: unknown,
|
|
121
|
+
originalMessage?: Stringable
|
|
122
|
+
]>;
|
|
123
|
+
type EnforceCompoundRule = (value: unknown, ...rules: Lazy[]) => RuleDetailedResult;
|
|
136
124
|
declare global {
|
|
137
125
|
namespace n4s {
|
|
138
126
|
interface EnforceCustomMatchers<R> {
|
|
139
|
-
allOf:
|
|
140
|
-
anyOf:
|
|
141
|
-
noneOf:
|
|
142
|
-
oneOf:
|
|
127
|
+
allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
|
|
128
|
+
anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
|
|
129
|
+
noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
|
|
130
|
+
oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
|
|
143
131
|
}
|
|
144
132
|
}
|
|
145
133
|
}
|
|
146
|
-
|
|
134
|
+
//# sourceMappingURL=compounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compounds.d.ts","sourceRoot":"","sources":["../src/exports/compounds.ts","../src/runtime/enforceContext.ts","../src/lib/ruleReturn.ts","../src/rules/endsWith.ts","../src/rules/equals.ts","../src/rules/greaterThanOrEquals.ts","../src/rules/inside.ts","../src/rules/lessThan.ts","../src/rules/lessThanOrEquals.ts","../src/rules/isBetween.ts","../src/rules/isBlank.ts","../src/rules/isBoolean.ts","../src/rules/isEven.ts","../src/rules/isKeyOf.ts","../src/rules/isNaN.ts","../src/rules/isNegative.ts","../src/rules/isNumber.ts","../src/rules/isOdd.ts","../src/rules/isString.ts","../src/rules/isTruthy.ts","../src/rules/isValueOf.ts","../src/rules/longerThanOrEquals.ts","../src/rules/matches.ts","../src/rules/ruleCondition.ts","../src/rules/shorterThan.ts","../src/rules/shorterThanOrEquals.ts","../src/rules/startsWith.ts","../src/runtime/rules.ts","../src/runtime/runtimeRules.ts","../src/lib/transformResult.ts","../src/runtime/genEnforceLazy.ts","../src/lib/runLazyRule.ts","../src/plugins/compounds/allOf.ts","../src/plugins/compounds/anyOf.ts","../src/lib/enforceUtilityTypes.ts","../src/plugins/compounds/noneOf.ts","../src/plugins/compounds/oneOf.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,KAAK,mBAAmB,GAAG,CACzB,KAAK,EAAE,OAAO,EACd,GAAG,KAAK,EAAE,IAAI,EAAE,KACb,kBAAkB,CAAC;AAGxB,QAAQ,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,qBAAqB,CAAC,CAAC;YAC/B,KAAK,EAAE,oBAAoB,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YACpD,KAAK,EAAE,oBAAoB,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YACpD,MAAM,EAAE,oBAAoB,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YACrD,KAAK,EAAE,oBAAoB,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;SACrD;KACF;CACF"}
|
package/types/date.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="validator" />
|
|
2
|
+
import isAfter from 'validator/es/lib/isAfter';
|
|
3
|
+
import isBefore from 'validator/es/lib/isBefore';
|
|
4
|
+
import isDate from 'validator/es/lib/isDate';
|
|
5
|
+
import isISO8601 from 'validator/es/lib/isISO8601';
|
|
6
|
+
import { CB, DropFirst } from "vest-utils";
|
|
7
|
+
type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
|
|
8
|
+
declare global {
|
|
9
|
+
namespace n4s {
|
|
10
|
+
interface EnforceCustomMatchers<R> {
|
|
11
|
+
isAfter: EnforceCustomMatcher<typeof isAfter, R>;
|
|
12
|
+
isBefore: EnforceCustomMatcher<typeof isBefore, R>;
|
|
13
|
+
isDate: EnforceCustomMatcher<typeof isDate, R>;
|
|
14
|
+
isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/exports/date.ts","../src/lib/enforceUtilityTypes.ts"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,SAAS,MAAM,4BAA4B,CAAC;;;AAOnD,QAAQ,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,qBAAqB,CAAC,CAAC;YAC/B,OAAO,EAAE,oBAAoB,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC;YACjD,QAAQ,EAAE,oBAAoB,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC,CAAC;YACnD,MAAM,EAAE,oBAAoB,CAAC,OAAO,MAAM,EAAE,CAAC,CAAC,CAAC;YAC/C,SAAS,EAAE,oBAAoB,CAAC,OAAO,SAAS,EAAE,CAAC,CAAC,CAAC;SACtD;KACF;CACF"}
|
package/types/email.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="validator" />
|
|
2
|
+
import isEmail from 'validator/es/lib/isEmail';
|
|
3
|
+
import { CB, DropFirst } from "vest-utils";
|
|
4
|
+
type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
|
|
5
|
+
declare global {
|
|
6
|
+
namespace n4s {
|
|
7
|
+
interface EnforceCustomMatchers<R> {
|
|
8
|
+
isEmail: EnforceCustomMatcher<typeof isEmail, R>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/exports/email.ts","../src/lib/enforceUtilityTypes.ts"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,0BAA0B,CAAC;;;AAO/C,QAAQ,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,qBAAqB,CAAC,CAAC;YAC/B,OAAO,EAAE,oBAAoB,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC;SAClD;KACF;CACF"}
|
package/types/isURL.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="validator" />
|
|
2
|
+
import isURL from 'validator/es/lib/isURL';
|
|
3
|
+
import { CB, DropFirst } from "vest-utils";
|
|
4
|
+
type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
|
|
5
|
+
declare global {
|
|
6
|
+
namespace n4s {
|
|
7
|
+
interface EnforceCustomMatchers<R> {
|
|
8
|
+
isURL: EnforceCustomMatcher<typeof isURL, R>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=isURL.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isURL.d.ts","sourceRoot":"","sources":["../src/exports/isURL.ts","../src/lib/enforceUtilityTypes.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,wBAAwB,CAAC;;;AAO3C,QAAQ,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,qBAAqB,CAAC,CAAC;YAC/B,KAAK,EAAE,oBAAoB,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC;SAC9C;KACF;CACF"}
|