vest 5.0.0-dev-781e21 → 5.0.0-dev-9c596e

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.
Files changed (70) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +2 -57
  3. package/dist/cjs/classnames.development.js +38 -17
  4. package/dist/cjs/classnames.production.js +1 -1
  5. package/dist/cjs/enforce/compose.development.js +5 -54
  6. package/dist/cjs/enforce/compose.production.js +1 -1
  7. package/dist/cjs/enforce/compounds.development.js +20 -83
  8. package/dist/cjs/enforce/compounds.production.js +1 -1
  9. package/dist/cjs/enforce/schema.development.js +19 -82
  10. package/dist/cjs/enforce/schema.production.js +1 -1
  11. package/dist/cjs/parser.development.js +31 -9
  12. package/dist/cjs/parser.production.js +1 -1
  13. package/dist/cjs/promisify.development.js +22 -9
  14. package/dist/cjs/promisify.production.js +1 -1
  15. package/dist/cjs/vest.development.js +1421 -1223
  16. package/dist/cjs/vest.production.js +1 -1
  17. package/dist/es/classnames.development.js +40 -19
  18. package/dist/es/classnames.production.js +1 -1
  19. package/dist/es/enforce/compose.development.js +1 -58
  20. package/dist/es/enforce/compose.production.js +1 -1
  21. package/dist/es/enforce/compounds.development.js +2 -90
  22. package/dist/es/enforce/compounds.production.js +1 -1
  23. package/dist/es/enforce/schema.development.js +2 -88
  24. package/dist/es/enforce/schema.production.js +1 -1
  25. package/dist/es/parser.development.js +32 -10
  26. package/dist/es/parser.production.js +1 -1
  27. package/dist/es/promisify.development.js +23 -10
  28. package/dist/es/promisify.production.js +1 -1
  29. package/dist/es/vest.development.js +1415 -1214
  30. package/dist/es/vest.production.js +1 -1
  31. package/dist/umd/classnames.development.js +41 -20
  32. package/dist/umd/classnames.production.js +1 -1
  33. package/dist/umd/enforce/compose.development.js +9 -57
  34. package/dist/umd/enforce/compose.production.js +1 -1
  35. package/dist/umd/enforce/compounds.development.js +32 -94
  36. package/dist/umd/enforce/compounds.production.js +1 -1
  37. package/dist/umd/enforce/schema.development.js +32 -94
  38. package/dist/umd/enforce/schema.production.js +1 -1
  39. package/dist/umd/parser.development.js +34 -12
  40. package/dist/umd/parser.production.js +1 -1
  41. package/dist/umd/promisify.development.js +25 -12
  42. package/dist/umd/promisify.production.js +1 -1
  43. package/dist/umd/vest.development.js +1423 -1225
  44. package/dist/umd/vest.production.js +1 -1
  45. package/package.json +12 -16
  46. package/testUtils/TVestMock.ts +7 -0
  47. package/testUtils/__tests__/partition.test.ts +4 -4
  48. package/testUtils/mockThrowError.ts +4 -2
  49. package/testUtils/suiteDummy.ts +4 -1
  50. package/testUtils/testDummy.ts +12 -10
  51. package/testUtils/testPromise.ts +3 -0
  52. package/types/classnames.d.ts +63 -12
  53. package/types/classnames.d.ts.map +1 -0
  54. package/types/enforce/compose.d.ts +2 -126
  55. package/types/enforce/compose.d.ts.map +1 -0
  56. package/types/enforce/compounds.d.ts +2 -136
  57. package/types/enforce/compounds.d.ts.map +1 -0
  58. package/types/enforce/schema.d.ts +2 -144
  59. package/types/enforce/schema.d.ts.map +1 -0
  60. package/types/parser.d.ts +69 -18
  61. package/types/parser.d.ts.map +1 -0
  62. package/types/promisify.d.ts +60 -42
  63. package/types/promisify.d.ts.map +1 -0
  64. package/types/vest.d.ts +246 -243
  65. package/types/vest.d.ts.map +1 -0
  66. package/CHANGELOG.md +0 -87
  67. package/testUtils/expandStateRef.ts +0 -8
  68. package/testUtils/runCreateRef.ts +0 -10
  69. package/testUtils/testObjects.ts +0 -6
  70. package/tsconfig.json +0 -8
@@ -1,136 +1,2 @@
1
- type DropFirst<T extends unknown[]> = T extends [
2
- unknown,
3
- ...infer U
4
- ] ? U : never;
5
- type Stringable = string | ((...args: any[]) => string);
6
- type CB = (...args: any[]) => any;
7
- type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
8
- type RuleReturn = boolean | {
9
- pass: boolean;
10
- message?: Stringable;
11
- };
12
- type RuleDetailedResult = {
13
- pass: boolean;
14
- message?: string;
15
- };
16
- type Args = any[];
17
- type BaseRules = typeof baseRules;
18
- type KBaseRules = keyof BaseRules;
19
- declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
20
- declare function endsWith(value: string, arg1: string): boolean;
21
- declare function equals(value: unknown, arg1: unknown): boolean;
22
- declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
23
- declare function inside(value: unknown, arg1: string | unknown[]): boolean;
24
- declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
25
- declare function isBlank(value: unknown): boolean;
26
- declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
27
- declare function isNaN(value: unknown): boolean;
28
- declare function isNegative(value: number | string): boolean;
29
- declare function isNumber(value: unknown): value is number;
30
- declare function isTruthy(value: unknown): boolean;
31
- declare function isValueOf(value: any, objectToCheck: any): boolean;
32
- declare function lessThan(value: string | number, lt: string | number): boolean;
33
- declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
34
- declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
35
- declare function matches(value: string, regex: RegExp | string): boolean;
36
- declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
37
- declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
38
- declare function startsWith(value: string, arg1: string): boolean;
39
- declare const baseRules: {
40
- condition: typeof condition;
41
- doesNotEndWith: (value: string, arg1: string) => boolean;
42
- doesNotStartWith: (value: string, arg1: string) => boolean;
43
- endsWith: typeof endsWith;
44
- equals: typeof equals;
45
- greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
46
- greaterThanOrEquals: typeof greaterThanOrEquals;
47
- gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
48
- gte: typeof greaterThanOrEquals;
49
- inside: typeof inside;
50
- isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
51
- isBetween: typeof isBetween;
52
- isBlank: typeof isBlank;
53
- isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
54
- isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
55
- isEven: (value: any) => boolean;
56
- isFalsy: (value: unknown) => boolean;
57
- isKeyOf: typeof isKeyOf;
58
- isNaN: typeof isNaN;
59
- isNegative: typeof isNegative;
60
- isNotArray: (value: unknown) => boolean;
61
- isNotBetween: (value: string | number, min: string | number, max: string | number) => boolean;
62
- isNotBlank: (value: unknown) => boolean;
63
- isNotBoolean: (value: unknown) => boolean;
64
- isNotEmpty: (value: unknown) => boolean;
65
- isNotKeyOf: (key: string | number | symbol, obj: any) => boolean;
66
- isNotNaN: (value: unknown) => boolean;
67
- isNotNull: (value: unknown) => boolean;
68
- isNotNullish: (value: any) => boolean;
69
- isNotNumber: (value: unknown) => boolean;
70
- isNotNumeric: (value: string | number) => boolean;
71
- isNotString: (v: unknown) => boolean;
72
- isNotUndefined: (value?: unknown) => boolean;
73
- isNotValueOf: (value: any, objectToCheck: any) => boolean;
74
- isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
75
- isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
76
- isNumber: typeof isNumber;
77
- isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
78
- isOdd: (value: any) => boolean;
79
- isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
80
- isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
81
- isTruthy: typeof isTruthy;
82
- isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
83
- isValueOf: typeof isValueOf;
84
- lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
85
- lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
86
- lessThan: typeof lessThan;
87
- lessThanOrEquals: typeof lessThanOrEquals;
88
- longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
89
- longerThanOrEquals: typeof longerThanOrEquals;
90
- lt: typeof lessThan;
91
- lte: typeof lessThanOrEquals;
92
- matches: typeof matches;
93
- notEquals: (value: unknown, arg1: unknown) => boolean;
94
- notInside: (value: unknown, arg1: string | unknown[]) => boolean;
95
- notMatches: (value: string, regex: string | RegExp) => boolean;
96
- numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
97
- numberNotEquals: (value: string | number, eq: string | number) => boolean;
98
- shorterThan: typeof shorterThan;
99
- shorterThanOrEquals: typeof shorterThanOrEquals;
100
- startsWith: typeof startsWith;
101
- };
102
- type Rules<E> = n4s.EnforceCustomMatchers<Rules<E> & E> & Record<string, (...args: Args) => Rules<E> & E> & {
103
- [P in KBaseRules]: (...args: DropFirst<Parameters<BaseRules[P]>> | Args) => Rules<E> & E;
104
- };
105
- /* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
106
- declare global {
107
- namespace n4s {
108
- interface IRules<E> extends Rules<E> {
109
- }
110
- }
111
- }
112
- type LazyRules = n4s.IRules<LazyRuleMethods>;
113
- type Lazy = LazyRules & LazyRuleMethods &
114
- // This is a "catch all" hack to make TS happy while not
115
- // losing type hints
116
- Record<string, CB>;
117
- type LazyRuleMethods = LazyRuleRunners & {
118
- message: (message: LazyMessage) => Lazy;
119
- };
120
- type LazyRuleRunners = {
121
- test: (value: unknown) => boolean;
122
- run: (value: unknown) => RuleDetailedResult;
123
- };
124
- type LazyMessage = string | ((value: unknown, originalMessage?: Stringable) => string);
125
- type EnforceCompoundRule = (value: unknown, ...rules: Lazy[]) => RuleDetailedResult;
126
- declare global {
127
- namespace n4s {
128
- interface EnforceCustomMatchers<R> {
129
- allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
130
- anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
131
- noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
132
- oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;
133
- }
134
- }
135
- }
136
- export {};
1
+ export * as compounds from 'n4s/compounds';
2
+ //# sourceMappingURL=compounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compounds.d.ts","sourceRoot":"","sources":["../../src/exports/enforce@compounds.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,eAAe,CAAC"}
@@ -1,144 +1,2 @@
1
- type DropFirst<T extends unknown[]> = T extends [
2
- unknown,
3
- ...infer U
4
- ] ? U : never;
5
- type Stringable = string | ((...args: any[]) => string);
6
- type CB = (...args: any[]) => any;
7
- type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
8
- type RuleReturn = boolean | {
9
- pass: boolean;
10
- message?: Stringable;
11
- };
12
- type RuleDetailedResult = {
13
- pass: boolean;
14
- message?: string;
15
- };
16
- type Args = any[];
17
- type BaseRules = typeof baseRules;
18
- type KBaseRules = keyof BaseRules;
19
- declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
20
- declare function endsWith(value: string, arg1: string): boolean;
21
- declare function equals(value: unknown, arg1: unknown): boolean;
22
- declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
23
- declare function inside(value: unknown, arg1: string | unknown[]): boolean;
24
- declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
25
- declare function isBlank(value: unknown): boolean;
26
- declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
27
- declare function isNaN(value: unknown): boolean;
28
- declare function isNegative(value: number | string): boolean;
29
- declare function isNumber(value: unknown): value is number;
30
- declare function isTruthy(value: unknown): boolean;
31
- declare function isValueOf(value: any, objectToCheck: any): boolean;
32
- declare function lessThan(value: string | number, lt: string | number): boolean;
33
- declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
34
- declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
35
- declare function matches(value: string, regex: RegExp | string): boolean;
36
- declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
37
- declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
38
- declare function startsWith(value: string, arg1: string): boolean;
39
- declare const baseRules: {
40
- condition: typeof condition;
41
- doesNotEndWith: (value: string, arg1: string) => boolean;
42
- doesNotStartWith: (value: string, arg1: string) => boolean;
43
- endsWith: typeof endsWith;
44
- equals: typeof equals;
45
- greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
46
- greaterThanOrEquals: typeof greaterThanOrEquals;
47
- gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
48
- gte: typeof greaterThanOrEquals;
49
- inside: typeof inside;
50
- isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
51
- isBetween: typeof isBetween;
52
- isBlank: typeof isBlank;
53
- isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
54
- isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
55
- isEven: (value: any) => boolean;
56
- isFalsy: (value: unknown) => boolean;
57
- isKeyOf: typeof isKeyOf;
58
- isNaN: typeof isNaN;
59
- isNegative: typeof isNegative;
60
- isNotArray: (value: unknown) => boolean;
61
- isNotBetween: (value: string | number, min: string | number, max: string | number) => boolean;
62
- isNotBlank: (value: unknown) => boolean;
63
- isNotBoolean: (value: unknown) => boolean;
64
- isNotEmpty: (value: unknown) => boolean;
65
- isNotKeyOf: (key: string | number | symbol, obj: any) => boolean;
66
- isNotNaN: (value: unknown) => boolean;
67
- isNotNull: (value: unknown) => boolean;
68
- isNotNullish: (value: any) => boolean;
69
- isNotNumber: (value: unknown) => boolean;
70
- isNotNumeric: (value: string | number) => boolean;
71
- isNotString: (v: unknown) => boolean;
72
- isNotUndefined: (value?: unknown) => boolean;
73
- isNotValueOf: (value: any, objectToCheck: any) => boolean;
74
- isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
75
- isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
76
- isNumber: typeof isNumber;
77
- isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
78
- isOdd: (value: any) => boolean;
79
- isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
80
- isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
81
- isTruthy: typeof isTruthy;
82
- isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
83
- isValueOf: typeof isValueOf;
84
- lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
85
- lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
86
- lessThan: typeof lessThan;
87
- lessThanOrEquals: typeof lessThanOrEquals;
88
- longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
89
- longerThanOrEquals: typeof longerThanOrEquals;
90
- lt: typeof lessThan;
91
- lte: typeof lessThanOrEquals;
92
- matches: typeof matches;
93
- notEquals: (value: unknown, arg1: unknown) => boolean;
94
- notInside: (value: unknown, arg1: string | unknown[]) => boolean;
95
- notMatches: (value: string, regex: string | RegExp) => boolean;
96
- numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
97
- numberNotEquals: (value: string | number, eq: string | number) => boolean;
98
- shorterThan: typeof shorterThan;
99
- shorterThanOrEquals: typeof shorterThanOrEquals;
100
- startsWith: typeof startsWith;
101
- };
102
- type Rules<E> = n4s.EnforceCustomMatchers<Rules<E> & E> & Record<string, (...args: Args) => Rules<E> & E> & {
103
- [P in KBaseRules]: (...args: DropFirst<Parameters<BaseRules[P]>> | Args) => Rules<E> & E;
104
- };
105
- /* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
106
- declare global {
107
- namespace n4s {
108
- interface IRules<E> extends Rules<E> {
109
- }
110
- }
111
- }
112
- type LazyRules = n4s.IRules<LazyRuleMethods>;
113
- type Lazy = LazyRules & LazyRuleMethods &
114
- // This is a "catch all" hack to make TS happy while not
115
- // losing type hints
116
- Record<string, CB>;
117
- type LazyRuleMethods = LazyRuleRunners & {
118
- message: (message: LazyMessage) => Lazy;
119
- };
120
- type LazyRuleRunners = {
121
- test: (value: unknown) => boolean;
122
- run: (value: unknown) => RuleDetailedResult;
123
- };
124
- type LazyMessage = string | ((value: unknown, originalMessage?: Stringable) => string);
125
- declare function isArrayOf(inputArray: any[], currentRule: LazyRuleRunners): RuleDetailedResult;
126
- interface ShapeObject extends Record<string, any>, Record<string, LazyRuleRunners> {
127
- }
128
- declare function loose(inputObject: Record<string, any>, shapeObject: ShapeObject): RuleDetailedResult;
129
- declare function optional(value: any, ruleChain: Lazy): RuleDetailedResult;
130
- declare function shape(inputObject: Record<string, any>, shapeObject: ShapeObject): RuleDetailedResult;
131
- // Help needed improving the typings of this file.
132
- // Ideally, we'd be able to extend ShapeObject, but that's not possible.
133
- declare function partial<T extends Record<any, any>>(shapeObject: T): T;
134
- declare global {
135
- namespace n4s {
136
- interface EnforceCustomMatchers<R> {
137
- isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;
138
- loose: EnforceCustomMatcher<typeof loose, R>;
139
- shape: EnforceCustomMatcher<typeof shape, R>;
140
- optional: EnforceCustomMatcher<typeof optional, R>;
141
- }
142
- }
143
- }
144
- export { partial };
1
+ export * as schema from 'n4s/schema';
2
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/exports/enforce@schema.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,YAAY,CAAC"}
package/types/parser.d.ts CHANGED
@@ -1,28 +1,79 @@
1
- type SuiteSummary = {
2
- groups: Groups;
3
- tests: Tests;
1
+ declare enum Severity {
2
+ WARNINGS = "warnings",
3
+ ERRORS = "errors"
4
+ }
5
+ type WithFieldName<F extends TFieldName = TFieldName> = {
6
+ fieldName: F;
7
+ };
8
+ interface Done<F extends TFieldName, G extends TGroupName> {
9
+ (...args: [
10
+ cb: (res: SuiteResult<F, G>) => void
11
+ ]): SuiteRunResult<F, G>;
12
+ (...args: [
13
+ fieldName: F,
14
+ cb: (res: SuiteResult<F, G>) => void
15
+ ]): SuiteRunResult<F, G>;
16
+ }
17
+ interface SuiteSelectors<F extends TFieldName, G extends TGroupName> {
18
+ getWarning(fieldName?: F): void | string | SummaryFailure<F, G>;
19
+ getError(fieldName?: F): void | string | SummaryFailure<F, G>;
20
+ getErrors(fieldName: F): string[];
21
+ getErrors(): FailureMessages;
22
+ getWarnings(): FailureMessages;
23
+ getWarnings(fieldName: F): string[];
24
+ getErrorsByGroup(groupName: G, fieldName: F): string[];
25
+ getErrorsByGroup(groupName: G): FailureMessages;
26
+ getWarningsByGroup(groupName: G): FailureMessages;
27
+ getWarningsByGroup(groupName: G, fieldName: F): string[];
28
+ hasErrors(fieldName?: F): boolean;
29
+ hasWarnings(fieldName?: F): boolean;
30
+ hasErrorsByGroup(groupName: G, fieldName?: F): boolean;
31
+ hasWarningsByGroup(groupName: G, fieldName?: F): boolean;
32
+ isValid(fieldName?: F): boolean;
33
+ isValidByGroup(groupName: G, fieldName?: F): boolean;
34
+ }
35
+ declare class SummaryBase {
36
+ errorCount: number;
37
+ warnCount: number;
38
+ testCount: number;
39
+ }
40
+ declare class SuiteSummary<F extends TFieldName, G extends TGroupName> extends SummaryBase {
41
+ [Severity.ERRORS]: SummaryFailure<F, G>[];
42
+ [Severity.WARNINGS]: SummaryFailure<F, G>[];
43
+ groups: Groups<G, F>;
44
+ tests: Tests<F>;
4
45
  valid: boolean;
5
- } & SummaryBase;
46
+ }
6
47
  type GroupTestSummary = SingleTestSummary;
7
- type Groups = Record<string, Group>;
8
- type Group = Record<string, GroupTestSummary>;
9
- type Tests = Record<string, SingleTestSummary>;
48
+ type Groups<G extends TGroupName, F extends TFieldName> = Record<G, Group<F>>;
49
+ type Group<F extends TFieldName> = Record<F, GroupTestSummary>;
50
+ type Tests<F extends TFieldName> = Record<F, SingleTestSummary>;
10
51
  type SingleTestSummary = SummaryBase & {
11
52
  errors: string[];
12
53
  warnings: string[];
13
54
  valid: boolean;
14
55
  };
15
- type SummaryBase = {
16
- errorCount: number;
17
- warnCount: number;
18
- testCount: number;
56
+ type SummaryFailure<F extends TFieldName, G extends TGroupName> = WithFieldName<F> & {
57
+ groupName: G | undefined;
58
+ message: string | undefined;
59
+ };
60
+ type FailureMessages = Record<string, string[]>;
61
+ type SuiteResult<F extends TFieldName, G extends TGroupName> = SuiteSummary<F, G> & SuiteSelectors<F, G> & {
62
+ suiteName: SuiteName;
63
+ };
64
+ type SuiteRunResult<F extends TFieldName, G extends TGroupName> = SuiteResult<F, G> & {
65
+ done: Done<F, G>;
19
66
  };
20
- declare function parse(summary: SuiteSummary): ParsedVestObject;
21
- interface ParsedVestObject {
22
- valid(fieldName?: string): boolean;
23
- tested(fieldName?: string): boolean;
24
- invalid(fieldName?: string): boolean;
25
- untested(fieldName?: string): boolean;
26
- warning(fieldName?: string): boolean;
67
+ type SuiteName = string | undefined;
68
+ type TFieldName<T extends string = string> = T;
69
+ type TGroupName<G extends string = string> = G;
70
+ declare function parse<F extends TFieldName, G extends TGroupName>(summary: SuiteSummary<F, G>): ParsedVestObject<F>;
71
+ interface ParsedVestObject<F extends TFieldName> {
72
+ valid(fieldName?: F): boolean;
73
+ tested(fieldName?: F): boolean;
74
+ invalid(fieldName?: F): boolean;
75
+ untested(fieldName?: F): boolean;
76
+ warning(fieldName?: F): boolean;
27
77
  }
28
78
  export { parse };
79
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/exports/parser.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/test/TestTypes.ts","../src/core/VestBus/Events.ts","../src/core/isolate/walker.ts","../src/core/isolate/reconciler/Reconciler/Reconciler.ts","../src/core/isolate/Isolate.ts","../src/hooks/optional/OptionalTypes.ts","../src/core/isolate/IsolateSuite/IsolateSuite.ts","../src/core/test/helpers/matchingFieldName.ts","../src/core/isolate/reconciler/isSameProfileTest.ts","../src/core/isolate/reconciler/cancelOverriddenPendingTest.ts","../src/hooks/optional/optional.ts","../src/core/isolate/IsolateTest/TestWalker.ts","../src/core/test/helpers/matchingGroupName.ts","../src/core/test/helpers/nonMatchingSeverityProfile.ts","../src/suiteResult/selectors/hasFailuresByTestObjects.ts","../src/hooks/mode.ts","../src/core/context/SuiteContext.ts","../src/suiteResult/selectors/shouldAddValidProperty.ts","../src/suiteResult/selectors/produceSuiteSummary.ts","../src/suiteResult/selectors/collectFailures.ts","../src/suiteResult/selectors/suiteSelectors.ts","../src/suiteResult/suiteResult.ts","../src/isolates/skipWhen.ts","../src/hooks/exclusive.ts","../src/isolates/omitWhen.ts","../src/core/test/testLevelFlowControl/verifyTestRun.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/SimpleStateMachine.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/helpers/shouldUseErrorMessage.ts","../src/core/isolate/IsolateTest/IsolateTest.ts","../src/suite/runCallbacks.ts","../src/core/VestBus/VestBus.ts","../src/core/context/PersistedContext.ts","../src/suiteResult/done/deferDoneCallback.ts","../src/suiteResult/done/shouldSkipDoneRegistration.ts","../src/suiteResult/suiteRunResult.ts","../src/suiteResult/SuiteResultTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,iBAAgB,KAAK,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC9D,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,gBAAgB,CAAC,CAAC,CAAC,CA4CrB;AAED,UAAU,gBAAgB,CAAC,CAAC,SAAS,UAAU;IAC7C,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAC9B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAC/B,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IACjC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;CACjC"}
@@ -1,54 +1,72 @@
1
- type SuiteSummary = {
2
- groups: Groups;
3
- tests: Tests;
1
+ declare enum Severity {
2
+ WARNINGS = "warnings",
3
+ ERRORS = "errors"
4
+ }
5
+ type WithFieldName<F extends TFieldName = TFieldName> = {
6
+ fieldName: F;
7
+ };
8
+ interface Done<F extends TFieldName, G extends TGroupName> {
9
+ (...args: [
10
+ cb: (res: SuiteResult<F, G>) => void
11
+ ]): SuiteRunResult<F, G>;
12
+ (...args: [
13
+ fieldName: F,
14
+ cb: (res: SuiteResult<F, G>) => void
15
+ ]): SuiteRunResult<F, G>;
16
+ }
17
+ interface SuiteSelectors<F extends TFieldName, G extends TGroupName> {
18
+ getWarning(fieldName?: F): void | string | SummaryFailure<F, G>;
19
+ getError(fieldName?: F): void | string | SummaryFailure<F, G>;
20
+ getErrors(fieldName: F): string[];
21
+ getErrors(): FailureMessages;
22
+ getWarnings(): FailureMessages;
23
+ getWarnings(fieldName: F): string[];
24
+ getErrorsByGroup(groupName: G, fieldName: F): string[];
25
+ getErrorsByGroup(groupName: G): FailureMessages;
26
+ getWarningsByGroup(groupName: G): FailureMessages;
27
+ getWarningsByGroup(groupName: G, fieldName: F): string[];
28
+ hasErrors(fieldName?: F): boolean;
29
+ hasWarnings(fieldName?: F): boolean;
30
+ hasErrorsByGroup(groupName: G, fieldName?: F): boolean;
31
+ hasWarningsByGroup(groupName: G, fieldName?: F): boolean;
32
+ isValid(fieldName?: F): boolean;
33
+ isValidByGroup(groupName: G, fieldName?: F): boolean;
34
+ }
35
+ declare class SummaryBase {
36
+ errorCount: number;
37
+ warnCount: number;
38
+ testCount: number;
39
+ }
40
+ declare class SuiteSummary<F extends TFieldName, G extends TGroupName> extends SummaryBase {
41
+ [Severity.ERRORS]: SummaryFailure<F, G>[];
42
+ [Severity.WARNINGS]: SummaryFailure<F, G>[];
43
+ groups: Groups<G, F>;
44
+ tests: Tests<F>;
4
45
  valid: boolean;
5
- } & SummaryBase;
46
+ }
6
47
  type GroupTestSummary = SingleTestSummary;
7
- type Groups = Record<string, Group>;
8
- type Group = Record<string, GroupTestSummary>;
9
- type Tests = Record<string, SingleTestSummary>;
48
+ type Groups<G extends TGroupName, F extends TFieldName> = Record<G, Group<F>>;
49
+ type Group<F extends TFieldName> = Record<F, GroupTestSummary>;
50
+ type Tests<F extends TFieldName> = Record<F, SingleTestSummary>;
10
51
  type SingleTestSummary = SummaryBase & {
11
52
  errors: string[];
12
53
  warnings: string[];
13
54
  valid: boolean;
14
55
  };
15
- type SummaryBase = {
16
- errorCount: number;
17
- warnCount: number;
18
- testCount: number;
56
+ type SummaryFailure<F extends TFieldName, G extends TGroupName> = WithFieldName<F> & {
57
+ groupName: G | undefined;
58
+ message: string | undefined;
19
59
  };
20
60
  type FailureMessages = Record<string, string[]>;
21
- type SuiteRunResult = SuiteResult & {
22
- done: Done;
23
- };
24
- interface Done {
25
- (...args: [
26
- cb: (res: SuiteResult) => void
27
- ]): SuiteRunResult;
28
- (...args: [
29
- fieldName: string,
30
- cb: (res: SuiteResult) => void
31
- ]): SuiteRunResult;
32
- }
33
- type SuiteName = string | void;
34
- interface SuiteSelectors {
35
- getErrors(fieldName: string): string[];
36
- getErrors(): FailureMessages;
37
- getWarnings(): FailureMessages;
38
- getWarnings(fieldName: string): string[];
39
- getErrorsByGroup(groupName: string, fieldName: string): string[];
40
- getErrorsByGroup(groupName: string): FailureMessages;
41
- getWarningsByGroup(groupName: string): FailureMessages;
42
- getWarningsByGroup(groupName: string, fieldName: string): string[];
43
- hasErrors(fieldName?: string): boolean;
44
- hasWarnings(fieldName?: string): boolean;
45
- hasErrorsByGroup(groupName: string, fieldName?: string): boolean;
46
- hasWarningsByGroup(groupName: string, fieldName?: string): boolean;
47
- isValid(fieldName?: string): boolean;
48
- isValidByGroup(groupName: string, fieldName?: string): boolean;
49
- }
50
- type SuiteResult = SuiteSummary & SuiteSelectors & {
61
+ type SuiteResult<F extends TFieldName, G extends TGroupName> = SuiteSummary<F, G> & SuiteSelectors<F, G> & {
51
62
  suiteName: SuiteName;
52
63
  };
53
- declare const promisify: (validatorFn: (...args: any[]) => SuiteRunResult) => (...args: any[]) => Promise<SuiteResult>;
64
+ type SuiteRunResult<F extends TFieldName, G extends TGroupName> = SuiteResult<F, G> & {
65
+ done: Done<F, G>;
66
+ };
67
+ type SuiteName = string | undefined;
68
+ type TFieldName<T extends string = string> = T;
69
+ type TGroupName<G extends string = string> = G;
70
+ declare function promisify<F extends TFieldName, G extends TGroupName>(validatorFn: (...args: any[]) => SuiteRunResult<F, G>): (...args: any[]) => Promise<SuiteResult<F, G>>;
54
71
  export { promisify as default };
72
+ //# sourceMappingURL=promisify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/exports/promisify.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/test/TestTypes.ts","../src/core/VestBus/Events.ts","../src/core/isolate/walker.ts","../src/core/isolate/reconciler/Reconciler/Reconciler.ts","../src/core/isolate/Isolate.ts","../src/hooks/optional/OptionalTypes.ts","../src/core/isolate/IsolateSuite/IsolateSuite.ts","../src/core/test/helpers/matchingFieldName.ts","../src/core/isolate/reconciler/isSameProfileTest.ts","../src/core/isolate/reconciler/cancelOverriddenPendingTest.ts","../src/hooks/optional/optional.ts","../src/core/isolate/IsolateTest/TestWalker.ts","../src/core/test/helpers/matchingGroupName.ts","../src/core/test/helpers/nonMatchingSeverityProfile.ts","../src/suiteResult/selectors/hasFailuresByTestObjects.ts","../src/hooks/mode.ts","../src/core/context/SuiteContext.ts","../src/suiteResult/selectors/shouldAddValidProperty.ts","../src/suiteResult/selectors/produceSuiteSummary.ts","../src/suiteResult/selectors/collectFailures.ts","../src/suiteResult/selectors/suiteSelectors.ts","../src/suiteResult/suiteResult.ts","../src/isolates/skipWhen.ts","../src/hooks/exclusive.ts","../src/isolates/omitWhen.ts","../src/core/test/testLevelFlowControl/verifyTestRun.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/SimpleStateMachine.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/helpers/shouldUseErrorMessage.ts","../src/core/isolate/IsolateTest/IsolateTest.ts","../src/suite/runCallbacks.ts","../src/core/VestBus/VestBus.ts","../src/core/context/PersistedContext.ts","../src/suiteResult/done/deferDoneCallback.ts","../src/suiteResult/done/shouldSkipDoneRegistration.ts","../src/suiteResult/suiteRunResult.ts","../src/suiteResult/SuiteResultTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC3D,WAAW,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,aAEpC,GAAG,EAAE,KAAG,QAAQ,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAKpD"}