vest 5.0.0-dev-781e21 → 5.0.2-dev-d315d9
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/LICENSE +2 -2
- package/README.md +2 -57
- package/dist/cjs/classnames.development.js +18 -16
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/enforce/compose.development.js +5 -54
- package/dist/cjs/enforce/compose.production.js +1 -1
- package/dist/cjs/enforce/compounds.development.js +20 -83
- package/dist/cjs/enforce/compounds.production.js +1 -1
- package/dist/cjs/enforce/schema.development.js +19 -82
- package/dist/cjs/enforce/schema.production.js +1 -1
- package/dist/cjs/parser.development.js +12 -9
- package/dist/cjs/parser.production.js +1 -1
- package/dist/cjs/promisify.development.js +4 -8
- package/dist/cjs/promisify.production.js +1 -1
- package/dist/cjs/vest.development.js +1287 -1153
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +20 -18
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/enforce/compose.development.js +1 -58
- package/dist/es/enforce/compose.production.js +1 -1
- package/dist/es/enforce/compounds.development.js +2 -90
- package/dist/es/enforce/compounds.production.js +1 -1
- package/dist/es/enforce/schema.development.js +2 -88
- package/dist/es/enforce/schema.production.js +1 -1
- package/dist/es/parser.development.js +12 -9
- package/dist/es/parser.production.js +1 -1
- package/dist/es/promisify.development.js +5 -9
- package/dist/es/promisify.production.js +1 -1
- package/dist/es/vest.development.js +1286 -1148
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +21 -19
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +9 -57
- package/dist/umd/enforce/compose.production.js +1 -1
- package/dist/umd/enforce/compounds.development.js +32 -94
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +32 -94
- package/dist/umd/enforce/schema.production.js +1 -1
- package/dist/umd/parser.development.js +16 -13
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/promisify.development.js +7 -11
- package/dist/umd/promisify.production.js +1 -1
- package/dist/umd/vest.development.js +1289 -1155
- package/dist/umd/vest.production.js +1 -1
- package/package.json +12 -16
- package/src/__tests__/__snapshots__/integration.async-tests.test.ts.snap +71 -0
- package/src/__tests__/__snapshots__/integration.base.test.ts.snap +71 -0
- package/src/__tests__/__snapshots__/integration.stateful-async.test.ts.snap +243 -0
- package/src/__tests__/__snapshots__/integration.stateful-tests.test.ts.snap +376 -0
- package/src/__tests__/integration.async-tests.test.ts +90 -0
- package/src/__tests__/integration.base.test.ts +45 -0
- package/src/__tests__/integration.exclusive.test.ts +88 -0
- package/src/__tests__/integration.stateful-async.test.ts +137 -0
- package/src/__tests__/integration.stateful-tests.test.ts +155 -0
- package/src/__tests__/isolate.test.ts +288 -0
- package/src/__tests__/state_refill.test.ts +41 -0
- package/src/core/SuiteWalker/SuiteWalker.ts +64 -0
- package/src/core/SuiteWalker/__tests__/hasRemainingTests.test.ts +130 -0
- package/src/core/VestBus/VestBus.ts +78 -0
- package/src/core/context/PersistedContext.ts +243 -0
- package/src/core/context/SuiteContext.ts +74 -0
- package/src/core/isolate/IsolateTest/IsolateTest.ts +213 -0
- package/src/core/isolate/IsolateTest/IsolateTestReconciler.ts +156 -0
- package/src/core/isolate/IsolateTest/IsolateTestStateMachine.ts +69 -0
- package/src/core/isolate/IsolateTest/SimpleStateMachine.ts +43 -0
- package/src/core/isolate/IsolateTest/TestWalker.ts +77 -0
- package/src/core/isolate/IsolateTypes.ts +10 -0
- package/src/core/isolate/isIsolate.ts +6 -0
- package/src/core/isolate/isolate.ts +110 -0
- package/src/core/isolate/reconciler/Reconciler/Reconciler.ts +123 -0
- package/src/core/isolate/reconciler/cancelOverriddenPendingTest.ts +15 -0
- package/src/core/isolate/reconciler/isSameProfileTest.ts +12 -0
- package/src/core/isolate/walker.ts +127 -0
- package/src/core/test/TestTypes.ts +3 -0
- package/src/core/test/__tests__/IsolateTest.test.ts +152 -0
- package/src/core/test/__tests__/__snapshots__/IsolateTest.test.ts.snap +39 -0
- package/src/core/test/__tests__/__snapshots__/memo.test.ts.snap +101 -0
- package/src/core/test/__tests__/__snapshots__/test.test.ts.snap +231 -0
- package/src/core/test/__tests__/key.test.ts +195 -0
- package/src/core/test/__tests__/memo.test.ts +218 -0
- package/src/core/test/__tests__/merging_of_previous_test_runs.test.ts +341 -0
- package/src/core/test/__tests__/runAsyncTest.test.ts +175 -0
- package/src/core/test/__tests__/test.test.ts +226 -0
- package/src/core/test/helpers/__tests__/nonMatchingSeverityProfile.test.ts +52 -0
- package/src/core/test/helpers/asVestTest.ts +9 -0
- package/src/core/test/helpers/matchingFieldName.ts +16 -0
- package/src/core/test/helpers/matchingGroupName.ts +12 -0
- package/src/core/test/helpers/nonMatchingSeverityProfile.ts +14 -0
- package/src/core/test/helpers/shouldUseErrorMessage.ts +9 -0
- package/src/core/test/test.memo.ts +81 -0
- package/src/core/test/test.ts +64 -0
- package/src/core/test/testLevelFlowControl/runTest.ts +86 -0
- package/src/core/test/testLevelFlowControl/verifyTestRun.ts +32 -0
- package/src/core/test/testObjectIsolate.ts +11 -0
- package/src/errors/ErrorStrings.ts +4 -0
- package/src/exports/__tests__/classnames.test.ts +92 -0
- package/src/exports/__tests__/parser.test.ts +441 -0
- package/src/exports/__tests__/promisify.test.ts +77 -0
- package/src/exports/classnames.ts +35 -0
- package/src/exports/enforce@compose.ts +1 -0
- package/src/exports/enforce@compounds.ts +1 -0
- package/src/exports/enforce@schema.ts +1 -0
- package/src/exports/parser.ts +63 -0
- package/src/exports/promisify.ts +18 -0
- package/src/hooks/__tests__/__snapshots__/include.test.ts.snap +794 -0
- package/src/hooks/__tests__/eager.test.ts +130 -0
- package/src/hooks/__tests__/exclusive.test.ts +578 -0
- package/src/hooks/__tests__/include.test.ts +431 -0
- package/src/hooks/__tests__/optional.test.ts +83 -0
- package/src/hooks/__tests__/warn.test.ts +42 -0
- package/src/hooks/exclusive.ts +179 -0
- package/src/hooks/include.ts +54 -0
- package/src/hooks/mode.ts +47 -0
- package/src/hooks/optional/OptionalTypes.ts +31 -0
- package/src/hooks/optional/optional.ts +69 -0
- package/src/hooks/warn.ts +19 -0
- package/src/isolates/__tests__/__snapshots__/each.test.ts.snap +3 -0
- package/src/isolates/__tests__/__snapshots__/group.test.ts.snap +114 -0
- package/src/isolates/__tests__/__snapshots__/omitWhen.test.ts.snap +443 -0
- package/src/isolates/__tests__/__snapshots__/skipWhen.test.ts.snap +99 -0
- package/src/isolates/__tests__/each.test.ts +35 -0
- package/src/isolates/__tests__/group.test.ts +362 -0
- package/src/isolates/__tests__/omitWhen.test.ts +246 -0
- package/src/isolates/__tests__/skipWhen.test.ts +163 -0
- package/src/isolates/each.ts +30 -0
- package/src/isolates/group.ts +9 -0
- package/src/isolates/omitWhen.ts +41 -0
- package/src/isolates/skipWhen.ts +42 -0
- package/src/suite/__tests__/__snapshots__/create.test.ts.snap +67 -0
- package/src/suite/__tests__/create.test.ts +109 -0
- package/src/suite/__tests__/remove.test.ts +50 -0
- package/src/suite/__tests__/resetField.test.ts +74 -0
- package/src/suite/createSuite.ts +94 -0
- package/src/suite/runCallbacks.ts +28 -0
- package/src/suiteResult/Severity.ts +15 -0
- package/src/suiteResult/SuiteResultTypes.ts +42 -0
- package/src/suiteResult/__tests__/done.test.ts +334 -0
- package/src/suiteResult/__tests__/produce.test.ts +163 -0
- package/src/suiteResult/done/deferDoneCallback.ts +28 -0
- package/src/suiteResult/done/shouldSkipDoneRegistration.ts +20 -0
- package/src/suiteResult/selectors/__tests__/__snapshots__/collectFailureMessages.test.ts.snap +89 -0
- package/src/suiteResult/selectors/__tests__/collectFailureMessages.test.ts +124 -0
- package/src/suiteResult/selectors/__tests__/getFailures.test.ts +158 -0
- package/src/suiteResult/selectors/__tests__/getFailuresByGroup.test.ts +199 -0
- package/src/suiteResult/selectors/__tests__/hasFailures.test.ts +141 -0
- package/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts +185 -0
- package/src/suiteResult/selectors/__tests__/hasFailuresByTestObject.test.ts +88 -0
- package/src/suiteResult/selectors/__tests__/isValid.test.ts +359 -0
- package/src/suiteResult/selectors/__tests__/isValidByGroup.test.ts +480 -0
- package/src/suiteResult/selectors/collectFailures.ts +43 -0
- package/src/suiteResult/selectors/hasFailuresByTestObjects.ts +62 -0
- package/src/suiteResult/selectors/produceSuiteSummary.ts +135 -0
- package/src/suiteResult/selectors/shouldAddValidProperty.ts +148 -0
- package/src/suiteResult/selectors/suiteSelectors.ts +199 -0
- package/src/suiteResult/suiteResult.ts +15 -0
- package/src/suiteResult/suiteRunResult.ts +43 -0
- package/src/vest.ts +36 -0
- package/testUtils/TVestMock.ts +5 -0
- package/testUtils/__tests__/partition.test.ts +4 -4
- package/testUtils/mockThrowError.ts +4 -2
- package/testUtils/suiteDummy.ts +2 -1
- package/testUtils/testDummy.ts +12 -10
- package/testUtils/testPromise.ts +3 -0
- package/tsconfig.json +84 -2
- package/types/classnames.d.ts +39 -4
- package/types/classnames.d.ts.map +1 -0
- package/types/enforce/compose.d.ts +2 -126
- package/types/enforce/compose.d.ts.map +1 -0
- package/types/enforce/compounds.d.ts +2 -136
- package/types/enforce/compounds.d.ts.map +1 -0
- package/types/enforce/schema.d.ts +2 -144
- package/types/enforce/schema.d.ts.map +1 -0
- package/types/parser.d.ts +45 -10
- package/types/parser.d.ts.map +1 -0
- package/types/promisify.d.ts +36 -34
- package/types/promisify.d.ts.map +1 -0
- package/types/vest.d.ts +169 -224
- package/types/vest.d.ts.map +1 -0
- package/CHANGELOG.md +0 -87
- package/testUtils/expandStateRef.ts +0 -8
- package/testUtils/runCreateRef.ts +0 -10
- package/testUtils/testObjects.ts +0 -6
package/types/classnames.d.ts
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
interface Done<F extends TFieldName> {
|
|
2
|
+
(...args: [
|
|
3
|
+
cb: (res: SuiteResult<F>) => void
|
|
4
|
+
]): SuiteRunResult<F>;
|
|
5
|
+
(...args: [
|
|
6
|
+
fieldName: F,
|
|
7
|
+
cb: (res: SuiteResult<F>) => void
|
|
8
|
+
]): SuiteRunResult<F>;
|
|
9
|
+
}
|
|
10
|
+
interface SuiteSelectors<F extends TFieldName> {
|
|
11
|
+
getErrors(fieldName: F): string[];
|
|
12
|
+
getErrors(): FailureMessages;
|
|
13
|
+
getWarnings(): FailureMessages;
|
|
14
|
+
getWarnings(fieldName: F): string[];
|
|
15
|
+
getErrorsByGroup(groupName: string, fieldName: F): string[];
|
|
16
|
+
getErrorsByGroup(groupName: string): FailureMessages;
|
|
17
|
+
getWarningsByGroup(groupName: string): FailureMessages;
|
|
18
|
+
getWarningsByGroup(groupName: string, fieldName: F): string[];
|
|
19
|
+
hasErrors(fieldName?: F): boolean;
|
|
20
|
+
hasWarnings(fieldName?: F): boolean;
|
|
21
|
+
hasErrorsByGroup(groupName: string, fieldName?: F): boolean;
|
|
22
|
+
hasWarningsByGroup(groupName: string, fieldName?: F): boolean;
|
|
23
|
+
isValid(fieldName?: F): boolean;
|
|
24
|
+
isValidByGroup(groupName: string, fieldName?: F): boolean;
|
|
25
|
+
}
|
|
26
|
+
type SuiteSummary<F extends TFieldName> = {
|
|
2
27
|
groups: Groups;
|
|
3
|
-
tests: Tests
|
|
28
|
+
tests: Tests<F>;
|
|
4
29
|
valid: boolean;
|
|
5
30
|
} & SummaryBase;
|
|
6
31
|
type GroupTestSummary = SingleTestSummary;
|
|
7
32
|
type Groups = Record<string, Group>;
|
|
8
33
|
type Group = Record<string, GroupTestSummary>;
|
|
9
|
-
type Tests = Record<
|
|
34
|
+
type Tests<F extends TFieldName> = Record<F, SingleTestSummary>;
|
|
10
35
|
type SingleTestSummary = SummaryBase & {
|
|
11
36
|
errors: string[];
|
|
12
37
|
warnings: string[];
|
|
@@ -17,10 +42,19 @@ type SummaryBase = {
|
|
|
17
42
|
warnCount: number;
|
|
18
43
|
testCount: number;
|
|
19
44
|
};
|
|
45
|
+
type FailureMessages = Record<string, string[]>;
|
|
46
|
+
type SuiteResult<F extends TFieldName> = SuiteSummary<F> & SuiteSelectors<F> & {
|
|
47
|
+
suiteName: SuiteName;
|
|
48
|
+
};
|
|
49
|
+
type SuiteRunResult<F extends TFieldName> = SuiteResult<F> & {
|
|
50
|
+
done: Done<F>;
|
|
51
|
+
};
|
|
52
|
+
type SuiteName = string | undefined;
|
|
53
|
+
type TFieldName<T extends string = string> = T;
|
|
20
54
|
/**
|
|
21
55
|
* Creates a function that returns class names that match the validation result
|
|
22
56
|
*/
|
|
23
|
-
declare function classnames(res: SuiteSummary
|
|
57
|
+
declare function classnames<F extends TFieldName>(res: SuiteSummary<F>, classes?: SupportedClasses): (fieldName: F) => string;
|
|
24
58
|
type SupportedClasses = {
|
|
25
59
|
valid?: string;
|
|
26
60
|
tested?: string;
|
|
@@ -29,3 +63,4 @@ type SupportedClasses = {
|
|
|
29
63
|
untested?: string;
|
|
30
64
|
};
|
|
31
65
|
export { classnames as default };
|
|
66
|
+
//# sourceMappingURL=classnames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classnames.d.ts","sourceRoot":"","sources":["../src/exports/classnames.ts","../src/hooks/optional/OptionalTypes.ts","../src/hooks/optional/optional.ts","../src/core/isolate/IsolateTypes.ts","../src/core/isolate/isolate.ts","../src/core/isolate/reconciler/Reconciler/Reconciler.ts","../src/core/isolate/reconciler/isSameProfileTest.ts","../src/core/isolate/reconciler/cancelOverriddenPendingTest.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/isolate/walker.ts","../src/core/SuiteWalker/SuiteWalker.ts","../src/core/test/helpers/matchingFieldName.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/core/isolate/isIsolate.ts","../src/isolates/omitWhen.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/SimpleStateMachine.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/TestTypes.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","../src/exports/parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;GAEG;AACH,iBAAwB,UAAU,CAAC,CAAC,SAAS,UAAU,EACrD,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,gBAAqB,GAC7B,CAAC,SAAS,EAAE,CAAC,KAAK,MAAM,CAe1B;AAED,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1,126 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
...infer U
|
|
4
|
-
] ? U : never;
|
|
5
|
-
type Stringable = string | ((...args: any[]) => string);
|
|
6
|
-
type CB = (...args: any[]) => any;
|
|
7
|
-
type RuleReturn = boolean | {
|
|
8
|
-
pass: boolean;
|
|
9
|
-
message?: Stringable;
|
|
10
|
-
};
|
|
11
|
-
type RuleDetailedResult = {
|
|
12
|
-
pass: boolean;
|
|
13
|
-
message?: string;
|
|
14
|
-
};
|
|
15
|
-
type Args = any[];
|
|
16
|
-
type BaseRules = typeof baseRules;
|
|
17
|
-
type KBaseRules = keyof BaseRules;
|
|
18
|
-
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
19
|
-
declare function endsWith(value: string, arg1: string): boolean;
|
|
20
|
-
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
21
|
-
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
22
|
-
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
23
|
-
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
24
|
-
declare function isBlank(value: unknown): boolean;
|
|
25
|
-
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
26
|
-
declare function isNaN(value: unknown): boolean;
|
|
27
|
-
declare function isNegative(value: number | string): boolean;
|
|
28
|
-
declare function isNumber(value: unknown): value is number;
|
|
29
|
-
declare function isTruthy(value: unknown): boolean;
|
|
30
|
-
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
31
|
-
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
32
|
-
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
33
|
-
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
34
|
-
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
35
|
-
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
36
|
-
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
37
|
-
declare function startsWith(value: string, arg1: string): boolean;
|
|
38
|
-
declare const baseRules: {
|
|
39
|
-
condition: typeof condition;
|
|
40
|
-
doesNotEndWith: (value: string, arg1: string) => boolean;
|
|
41
|
-
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
42
|
-
endsWith: typeof endsWith;
|
|
43
|
-
equals: typeof equals;
|
|
44
|
-
greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
45
|
-
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
46
|
-
gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
47
|
-
gte: typeof greaterThanOrEquals;
|
|
48
|
-
inside: typeof inside;
|
|
49
|
-
isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
|
|
50
|
-
isBetween: typeof isBetween;
|
|
51
|
-
isBlank: typeof isBlank;
|
|
52
|
-
isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
|
|
53
|
-
isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
|
|
54
|
-
isEven: (value: any) => boolean;
|
|
55
|
-
isFalsy: (value: unknown) => boolean;
|
|
56
|
-
isKeyOf: typeof isKeyOf;
|
|
57
|
-
isNaN: typeof isNaN;
|
|
58
|
-
isNegative: typeof isNegative;
|
|
59
|
-
isNotArray: (value: unknown) => boolean;
|
|
60
|
-
isNotBetween: (value: string | number, min: string | number, max: string | number) => boolean;
|
|
61
|
-
isNotBlank: (value: unknown) => boolean;
|
|
62
|
-
isNotBoolean: (value: unknown) => boolean;
|
|
63
|
-
isNotEmpty: (value: unknown) => boolean;
|
|
64
|
-
isNotKeyOf: (key: string | number | symbol, obj: any) => boolean;
|
|
65
|
-
isNotNaN: (value: unknown) => boolean;
|
|
66
|
-
isNotNull: (value: unknown) => boolean;
|
|
67
|
-
isNotNullish: (value: any) => boolean;
|
|
68
|
-
isNotNumber: (value: unknown) => boolean;
|
|
69
|
-
isNotNumeric: (value: string | number) => boolean;
|
|
70
|
-
isNotString: (v: unknown) => boolean;
|
|
71
|
-
isNotUndefined: (value?: unknown) => boolean;
|
|
72
|
-
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
73
|
-
isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
|
|
74
|
-
isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
|
|
75
|
-
isNumber: typeof isNumber;
|
|
76
|
-
isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
|
|
77
|
-
isOdd: (value: any) => boolean;
|
|
78
|
-
isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
|
|
79
|
-
isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
|
|
80
|
-
isTruthy: typeof isTruthy;
|
|
81
|
-
isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
|
|
82
|
-
isValueOf: typeof isValueOf;
|
|
83
|
-
lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
|
|
84
|
-
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
85
|
-
lessThan: typeof lessThan;
|
|
86
|
-
lessThanOrEquals: typeof lessThanOrEquals;
|
|
87
|
-
longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
|
|
88
|
-
longerThanOrEquals: typeof longerThanOrEquals;
|
|
89
|
-
lt: typeof lessThan;
|
|
90
|
-
lte: typeof lessThanOrEquals;
|
|
91
|
-
matches: typeof matches;
|
|
92
|
-
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
93
|
-
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
94
|
-
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
95
|
-
numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
|
|
96
|
-
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
97
|
-
shorterThan: typeof shorterThan;
|
|
98
|
-
shorterThanOrEquals: typeof shorterThanOrEquals;
|
|
99
|
-
startsWith: typeof startsWith;
|
|
100
|
-
};
|
|
101
|
-
type Rules<E> = n4s.EnforceCustomMatchers<Rules<E> & E> & Record<string, (...args: Args) => Rules<E> & E> & {
|
|
102
|
-
[P in KBaseRules]: (...args: DropFirst<Parameters<BaseRules[P]>> | Args) => Rules<E> & E;
|
|
103
|
-
};
|
|
104
|
-
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
|
|
105
|
-
declare global {
|
|
106
|
-
namespace n4s {
|
|
107
|
-
interface IRules<E> extends Rules<E> {
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
type LazyRules = n4s.IRules<LazyRuleMethods>;
|
|
112
|
-
type Lazy = LazyRules & LazyRuleMethods &
|
|
113
|
-
// This is a "catch all" hack to make TS happy while not
|
|
114
|
-
// losing type hints
|
|
115
|
-
Record<string, CB>;
|
|
116
|
-
type LazyRuleMethods = LazyRuleRunners & {
|
|
117
|
-
message: (message: LazyMessage) => Lazy;
|
|
118
|
-
};
|
|
119
|
-
type LazyRuleRunners = {
|
|
120
|
-
test: (value: unknown) => boolean;
|
|
121
|
-
run: (value: unknown) => RuleDetailedResult;
|
|
122
|
-
};
|
|
123
|
-
type ComposeResult = LazyRuleRunners & ((value: any) => void);
|
|
124
|
-
type LazyMessage = string | ((value: unknown, originalMessage?: Stringable) => string);
|
|
125
|
-
declare function compose(...composites: LazyRuleRunners[]): ComposeResult;
|
|
126
|
-
export { compose as default };
|
|
1
|
+
export { default } from 'n4s/compose';
|
|
2
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/exports/enforce@compose.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC"}
|
|
@@ -1,136 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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,12 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
interface Done<F extends TFieldName> {
|
|
2
|
+
(...args: [
|
|
3
|
+
cb: (res: SuiteResult<F>) => void
|
|
4
|
+
]): SuiteRunResult<F>;
|
|
5
|
+
(...args: [
|
|
6
|
+
fieldName: F,
|
|
7
|
+
cb: (res: SuiteResult<F>) => void
|
|
8
|
+
]): SuiteRunResult<F>;
|
|
9
|
+
}
|
|
10
|
+
interface SuiteSelectors<F extends TFieldName> {
|
|
11
|
+
getErrors(fieldName: F): string[];
|
|
12
|
+
getErrors(): FailureMessages;
|
|
13
|
+
getWarnings(): FailureMessages;
|
|
14
|
+
getWarnings(fieldName: F): string[];
|
|
15
|
+
getErrorsByGroup(groupName: string, fieldName: F): string[];
|
|
16
|
+
getErrorsByGroup(groupName: string): FailureMessages;
|
|
17
|
+
getWarningsByGroup(groupName: string): FailureMessages;
|
|
18
|
+
getWarningsByGroup(groupName: string, fieldName: F): string[];
|
|
19
|
+
hasErrors(fieldName?: F): boolean;
|
|
20
|
+
hasWarnings(fieldName?: F): boolean;
|
|
21
|
+
hasErrorsByGroup(groupName: string, fieldName?: F): boolean;
|
|
22
|
+
hasWarningsByGroup(groupName: string, fieldName?: F): boolean;
|
|
23
|
+
isValid(fieldName?: F): boolean;
|
|
24
|
+
isValidByGroup(groupName: string, fieldName?: F): boolean;
|
|
25
|
+
}
|
|
26
|
+
type SuiteSummary<F extends TFieldName> = {
|
|
2
27
|
groups: Groups;
|
|
3
|
-
tests: Tests
|
|
28
|
+
tests: Tests<F>;
|
|
4
29
|
valid: boolean;
|
|
5
30
|
} & SummaryBase;
|
|
6
31
|
type GroupTestSummary = SingleTestSummary;
|
|
7
32
|
type Groups = Record<string, Group>;
|
|
8
33
|
type Group = Record<string, GroupTestSummary>;
|
|
9
|
-
type Tests = Record<
|
|
34
|
+
type Tests<F extends TFieldName> = Record<F, SingleTestSummary>;
|
|
10
35
|
type SingleTestSummary = SummaryBase & {
|
|
11
36
|
errors: string[];
|
|
12
37
|
warnings: string[];
|
|
@@ -17,12 +42,22 @@ type SummaryBase = {
|
|
|
17
42
|
warnCount: number;
|
|
18
43
|
testCount: number;
|
|
19
44
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
type FailureMessages = Record<string, string[]>;
|
|
46
|
+
type SuiteResult<F extends TFieldName> = SuiteSummary<F> & SuiteSelectors<F> & {
|
|
47
|
+
suiteName: SuiteName;
|
|
48
|
+
};
|
|
49
|
+
type SuiteRunResult<F extends TFieldName> = SuiteResult<F> & {
|
|
50
|
+
done: Done<F>;
|
|
51
|
+
};
|
|
52
|
+
type SuiteName = string | undefined;
|
|
53
|
+
type TFieldName<T extends string = string> = T;
|
|
54
|
+
declare function parse<F extends TFieldName>(summary: SuiteSummary<F>): ParsedVestObject<F>;
|
|
55
|
+
interface ParsedVestObject<F extends TFieldName> {
|
|
56
|
+
valid(fieldName?: F): boolean;
|
|
57
|
+
tested(fieldName?: F): boolean;
|
|
58
|
+
invalid(fieldName?: F): boolean;
|
|
59
|
+
untested(fieldName?: F): boolean;
|
|
60
|
+
warning(fieldName?: F): boolean;
|
|
27
61
|
}
|
|
28
62
|
export { parse };
|
|
63
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/exports/parser.ts","../src/hooks/optional/OptionalTypes.ts","../src/hooks/optional/optional.ts","../src/core/isolate/IsolateTypes.ts","../src/core/isolate/isolate.ts","../src/core/isolate/reconciler/Reconciler/Reconciler.ts","../src/core/isolate/reconciler/isSameProfileTest.ts","../src/core/isolate/reconciler/cancelOverriddenPendingTest.ts","../src/errors/ErrorStrings.ts","../src/suiteResult/Severity.ts","../src/core/isolate/walker.ts","../src/core/SuiteWalker/SuiteWalker.ts","../src/core/test/helpers/matchingFieldName.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/core/isolate/isIsolate.ts","../src/isolates/omitWhen.ts","../src/core/isolate/IsolateTest/IsolateTestReconciler.ts","../src/core/isolate/IsolateTest/SimpleStateMachine.ts","../src/core/isolate/IsolateTest/IsolateTestStateMachine.ts","../src/core/test/TestTypes.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,iBAAgB,KAAK,CAAC,CAAC,SAAS,UAAU,EACxC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB,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"}
|