umt 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module/Date/getDay.d.ts +1 -2
- package/module/Object/keyBy.d.ts +3 -4
- package/module/Validate/any/core.d.ts +2 -1
- package/module/Validate/any/core.js +3 -2
- package/module/Validate/any/core.js.map +1 -1
- package/module/Validate/array/arrayOf.d.ts +3 -3
- package/module/Validate/array/arrayOf.js +3 -1
- package/module/Validate/array/arrayOf.js.map +1 -1
- package/module/Validate/bigint/core.d.ts +2 -1
- package/module/Validate/bigint/core.js +3 -1
- package/module/Validate/bigint/core.js.map +1 -1
- package/module/Validate/boolean/core.d.ts +2 -1
- package/module/Validate/boolean/core.js +3 -1
- package/module/Validate/boolean/core.js.map +1 -1
- package/module/Validate/date/core.d.ts +2 -1
- package/module/Validate/date/core.js +3 -1
- package/module/Validate/date/core.js.map +1 -1
- package/module/Validate/file/core.d.ts +2 -1
- package/module/Validate/file/core.js +3 -1
- package/module/Validate/file/core.js.map +1 -1
- package/module/Validate/function/core.d.ts +11 -11
- package/module/Validate/function/core.js +2 -1
- package/module/Validate/function/core.js.map +1 -1
- package/module/Validate/index.d.ts +1 -0
- package/module/Validate/index.js +1 -0
- package/module/Validate/index.js.map +1 -1
- package/module/Validate/instanceof/core.d.ts +3 -3
- package/module/Validate/instanceof/core.js +3 -1
- package/module/Validate/instanceof/core.js.map +1 -1
- package/module/Validate/map/core.d.ts +3 -3
- package/module/Validate/map/core.js +3 -1
- package/module/Validate/map/core.js.map +1 -1
- package/module/Validate/never/core.d.ts +2 -1
- package/module/Validate/never/core.js +7 -8
- package/module/Validate/never/core.js.map +1 -1
- package/module/Validate/number/core.d.ts +3 -2
- package/module/Validate/number/core.js +3 -1
- package/module/Validate/number/core.js.map +1 -1
- package/module/Validate/object/core.d.ts +2 -1
- package/module/Validate/object/core.js +2 -1
- package/module/Validate/object/core.js.map +1 -1
- package/module/Validate/object/intersection.d.ts +5 -5
- package/module/Validate/object/intersection.js +3 -1
- package/module/Validate/object/intersection.js.map +1 -1
- package/module/Validate/object/nullable.d.ts +3 -3
- package/module/Validate/object/nullable.js +2 -1
- package/module/Validate/object/nullable.js.map +1 -1
- package/module/Validate/object/optional.d.ts +3 -3
- package/module/Validate/object/optional.js +2 -1
- package/module/Validate/object/optional.js.map +1 -1
- package/module/Validate/object/partial.d.ts +1 -2
- package/module/Validate/object/required.d.ts +2 -3
- package/module/Validate/object/union.d.ts +3 -3
- package/module/Validate/object/union.js +3 -1
- package/module/Validate/object/union.js.map +1 -1
- package/module/Validate/set/core.d.ts +3 -3
- package/module/Validate/set/core.js +3 -1
- package/module/Validate/set/core.js.map +1 -1
- package/module/Validate/standardSchema.d.ts +93 -0
- package/module/Validate/standardSchema.js +58 -0
- package/module/Validate/standardSchema.js.map +1 -0
- package/module/Validate/string/core.d.ts +3 -2
- package/module/Validate/string/core.js +5 -1
- package/module/Validate/string/core.js.map +1 -1
- package/module/Validate/templateLiteral/core.d.ts +7 -7
- package/module/Validate/templateLiteral/core.js +3 -1
- package/module/Validate/templateLiteral/core.js.map +1 -1
- package/module/Validate/unknown/core.d.ts +2 -1
- package/module/Validate/unknown/core.js +3 -1
- package/module/Validate/unknown/core.js.map +1 -1
- package/module/es5/Date/getDay.d.ts +1 -2
- package/module/es5/Object/keyBy.d.ts +3 -4
- package/module/es5/Validate/any/core.d.ts +2 -1
- package/module/es5/Validate/any/core.js +3 -2
- package/module/es5/Validate/array/arrayOf.d.ts +3 -3
- package/module/es5/Validate/array/arrayOf.js +3 -1
- package/module/es5/Validate/bigint/core.d.ts +2 -1
- package/module/es5/Validate/bigint/core.js +4 -4
- package/module/es5/Validate/boolean/core.d.ts +2 -1
- package/module/es5/Validate/boolean/core.js +3 -1
- package/module/es5/Validate/date/core.d.ts +2 -1
- package/module/es5/Validate/date/core.js +3 -1
- package/module/es5/Validate/file/core.d.ts +2 -1
- package/module/es5/Validate/file/core.js +3 -1
- package/module/es5/Validate/function/core.d.ts +11 -11
- package/module/es5/Validate/function/core.js +3 -6
- package/module/es5/Validate/index.d.ts +1 -0
- package/module/es5/Validate/index.js +11 -0
- package/module/es5/Validate/instanceof/core.d.ts +3 -3
- package/module/es5/Validate/instanceof/core.js +3 -1
- package/module/es5/Validate/map/core.d.ts +3 -3
- package/module/es5/Validate/map/core.js +4 -4
- package/module/es5/Validate/never/core.d.ts +2 -1
- package/module/es5/Validate/never/core.js +3 -2
- package/module/es5/Validate/number/core.d.ts +3 -2
- package/module/es5/Validate/number/core.js +3 -1
- package/module/es5/Validate/object/core.d.ts +2 -1
- package/module/es5/Validate/object/core.js +2 -1
- package/module/es5/Validate/object/intersection.d.ts +5 -5
- package/module/es5/Validate/object/intersection.js +3 -1
- package/module/es5/Validate/object/nullable.d.ts +3 -3
- package/module/es5/Validate/object/nullable.js +2 -1
- package/module/es5/Validate/object/optional.d.ts +3 -3
- package/module/es5/Validate/object/optional.js +2 -1
- package/module/es5/Validate/object/partial.d.ts +1 -2
- package/module/es5/Validate/object/required.d.ts +2 -3
- package/module/es5/Validate/object/union.d.ts +3 -3
- package/module/es5/Validate/object/union.js +3 -1
- package/module/es5/Validate/set/core.d.ts +3 -3
- package/module/es5/Validate/set/core.js +4 -4
- package/module/es5/Validate/standardSchema.d.ts +93 -0
- package/module/es5/Validate/standardSchema.js +91 -0
- package/module/es5/Validate/string/core.d.ts +3 -2
- package/module/es5/Validate/string/core.js +3 -1
- package/module/es5/Validate/templateLiteral/core.d.ts +7 -7
- package/module/es5/Validate/templateLiteral/core.js +7 -6
- package/module/es5/Validate/unknown/core.d.ts +2 -1
- package/module/es5/Validate/unknown/core.js +3 -1
- package/module/es5/types/array/chunk.d.ts +1 -2
- package/module/es5/types/array/zip.d.ts +4 -2
- package/module/es5/types/logic/binary1bitNor.d.ts +1 -2
- package/module/es5/types/logic/binaryFullAdder.d.ts +1 -2
- package/module/es5/types/math/divide.d.ts +1 -2
- package/module/es5/types/math/multiply.d.ts +1 -2
- package/module/es5/types/object/pickDeep.d.ts +3 -4
- package/module/types/array/chunk.d.ts +1 -2
- package/module/types/array/zip.d.ts +4 -2
- package/module/types/logic/binary1bitNor.d.ts +1 -2
- package/module/types/logic/binaryFullAdder.d.ts +1 -2
- package/module/types/math/divide.d.ts +1 -2
- package/module/types/math/multiply.d.ts +1 -2
- package/module/types/object/pickDeep.d.ts +3 -4
- package/package.json +9 -9
package/module/Date/getDay.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ArrayToUnion } from "../types/logic/arrayToUnion";
|
|
2
|
-
interface DayList {
|
|
2
|
+
export interface DayList {
|
|
3
3
|
de: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
|
|
4
4
|
ko: ["일", "월", "화", "수", "목", "금", "토"];
|
|
5
5
|
en: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
@@ -17,4 +17,3 @@ interface DayList {
|
|
|
17
17
|
* getDay(1, "fr"); // Returns "Lun"
|
|
18
18
|
*/
|
|
19
19
|
export declare const getDay: <T extends keyof DayList>(day: number, lang?: T) => ArrayToUnion<DayList[T]>;
|
|
20
|
-
export {};
|
package/module/Object/keyBy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
type PropertyName = string | number | symbol;
|
|
2
|
-
type IterateeFunction<T> = (value: T) => PropertyName;
|
|
3
|
-
type Iteratee<T> = IterateeFunction<T> | keyof T;
|
|
1
|
+
export type PropertyName = string | number | symbol;
|
|
2
|
+
export type IterateeFunction<T> = (value: T) => PropertyName;
|
|
3
|
+
export type Iteratee<T> = IterateeFunction<T> | keyof T;
|
|
4
4
|
/**
|
|
5
5
|
* Creates an object composed of keys generated from the results of running each element of collection through iteratee
|
|
6
6
|
* @param collection The collection to iterate over
|
|
@@ -17,4 +17,3 @@ type Iteratee<T> = IterateeFunction<T> | keyof T;
|
|
|
17
17
|
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
18
18
|
*/
|
|
19
19
|
export declare function keyBy<T>(collection: T[] | Record<PropertyName, T>, iteratee?: Iteratee<T>): Record<PropertyName, T>;
|
|
20
|
-
export {};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* schema needs to remain wide open while still participating in `object()`,
|
|
5
5
|
* `union()`, `intersection()`, and other compositional helpers.
|
|
6
6
|
*/
|
|
7
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
7
8
|
/**
|
|
8
9
|
* Return type produced by an `any` validator. Exposes the literal `"any"`
|
|
9
10
|
* tag through the `type` field so `ValidateType<"any">` can map it back to
|
|
@@ -18,4 +19,4 @@ export interface AnyReturnType {
|
|
|
18
19
|
* Creates a validator that accepts any value
|
|
19
20
|
* @returns {Function} - Validator that always succeeds
|
|
20
21
|
*/
|
|
21
|
-
export declare const any: () => ((value: any) => AnyReturnType)
|
|
22
|
+
export declare const any: () => ((value: any) => AnyReturnType) & StandardSchemaV1<any, any>;
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
* schema needs to remain wide open while still participating in `object()`,
|
|
5
5
|
* `union()`, `intersection()`, and other compositional helpers.
|
|
6
6
|
*/
|
|
7
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
7
8
|
// biome-ignore lint/suspicious/noExplicitAny: signature mirrors the return type
|
|
8
9
|
const anyValidator = (_value) => ({
|
|
9
10
|
validate: true,
|
|
10
11
|
message: "",
|
|
11
12
|
type: "any",
|
|
12
13
|
});
|
|
14
|
+
const standardAnyValidator = attachStandard(anyValidator);
|
|
13
15
|
/**
|
|
14
16
|
* Creates a validator that accepts any value
|
|
15
17
|
* @returns {Function} - Validator that always succeeds
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
|
-
export const any = () => anyValidator;
|
|
19
|
+
export const any = () => standardAnyValidator;
|
|
19
20
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/any/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/any/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAanC,gFAAgF;AAChF,MAAM,YAAY,GAAG,CAAC,MAAW,EAAiB,EAAE,CAAC,CAAC;IACpD,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,KAAK;CACZ,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG,cAAc,CAMzC,YAAY,CAAC,CAAC;AAEhB;;;GAGG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,GAKU,EAAE,CAAC,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
1
2
|
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
2
|
-
type
|
|
3
|
+
export type ArrayOfExtractValidatedType<V> = V extends (value: never) => {
|
|
3
4
|
type: infer T;
|
|
4
5
|
} ? ValidateType<T> : never;
|
|
5
6
|
/**
|
|
@@ -13,5 +14,4 @@ export declare const arrayOf: <V extends (value: never) => {
|
|
|
13
14
|
type: unknown;
|
|
14
15
|
message: string;
|
|
15
16
|
validate: boolean;
|
|
16
|
-
}>(validator: V, message?: string) => (values:
|
|
17
|
-
export {};
|
|
17
|
+
}>(validator: V, message?: string) => ((values: ArrayOfExtractValidatedType<V>[]) => ValidateCoreReturnType<ArrayOfExtractValidatedType<V>[]>) & StandardSchemaV1<ArrayOfExtractValidatedType<V>[], ArrayOfExtractValidatedType<V>[]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isArray } from "../../Validate/isArray";
|
|
2
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
2
3
|
/**
|
|
3
4
|
* Creates an array validator that validates every element with a single validator
|
|
4
5
|
* @template V - The validator function applied to each element (its return `type` field carries the element type)
|
|
@@ -7,7 +8,7 @@ import { isArray } from "../../Validate/isArray";
|
|
|
7
8
|
* @returns {Function} - Validator function for arrays whose elements satisfy the given validator
|
|
8
9
|
*/
|
|
9
10
|
export const arrayOf = (validator, message) => {
|
|
10
|
-
|
|
11
|
+
const arrayValidator = (values) => {
|
|
11
12
|
if (!isArray(values)) {
|
|
12
13
|
return {
|
|
13
14
|
validate: false,
|
|
@@ -31,5 +32,6 @@ export const arrayOf = (validator, message) => {
|
|
|
31
32
|
type: values,
|
|
32
33
|
};
|
|
33
34
|
};
|
|
35
|
+
return attachStandard(arrayValidator);
|
|
34
36
|
};
|
|
35
37
|
//# sourceMappingURL=arrayOf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayOf.js","sourceRoot":"","sources":["../../../src/Validate/array/arrayOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"arrayOf.js","sourceRoot":"","sources":["../../../src/Validate/array/arrayOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAcnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAOrB,SAAY,EACZ,OAAgB,EAOd,EAAE;IAEJ,MAAM,cAAc,GAAG,CACrB,MAAiB,EACkB,EAAE;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,MAAM,GACV,SAID,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,cAAc,CACnB,cAAc,CACf,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* BigInt validation core module
|
|
3
3
|
* Provides the base validation functionality for bigint values
|
|
4
4
|
*/
|
|
5
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
5
6
|
import type { ValidateReturnType } from "../../Validate/type";
|
|
6
7
|
/**
|
|
7
8
|
* Return type produced by a `bigint` validator. Structurally compatible with
|
|
@@ -21,4 +22,4 @@ export interface BigIntReturnType {
|
|
|
21
22
|
* @param {string} [message] - Custom error message for type validation
|
|
22
23
|
* @returns {Function} - Validator function that checks if the value is a bigint and applies validation rules
|
|
23
24
|
*/
|
|
24
|
-
export declare const bigint: <T extends ValidateReturnType<bigint>[]>(option?: T, message?: string) => (value: bigint) => BigIntReturnType
|
|
25
|
+
export declare const bigint: <T extends ValidateReturnType<bigint>[]>(option?: T, message?: string) => ((value: bigint) => BigIntReturnType) & StandardSchemaV1<bigint, bigint>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* BigInt validation core module
|
|
3
3
|
* Provides the base validation functionality for bigint values
|
|
4
4
|
*/
|
|
5
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
5
6
|
/**
|
|
6
7
|
* Creates a bigint validator with optional validation rules
|
|
7
8
|
* @template T - Array of validation rules for bigints
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
* @returns {Function} - Validator function that checks if the value is a bigint and applies validation rules
|
|
11
12
|
*/
|
|
12
13
|
export const bigint = (option = [], message) => {
|
|
13
|
-
|
|
14
|
+
const validator = (value) => {
|
|
14
15
|
if (typeof value !== "bigint") {
|
|
15
16
|
return {
|
|
16
17
|
validate: false,
|
|
@@ -33,5 +34,6 @@ export const bigint = (option = [], message) => {
|
|
|
33
34
|
type: "bigint",
|
|
34
35
|
};
|
|
35
36
|
};
|
|
37
|
+
return attachStandard(validator);
|
|
36
38
|
};
|
|
37
39
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/bigint/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/bigint/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAenC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,SAAY,EAAkB,EAC9B,OAAgB,EAC0D,EAAE;IAC5E,MAAM,SAAS,GAAG,CAAC,KAAa,EAAoB,EAAE;QACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,QAAQ;aACf,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;oBAC3B,IAAI,EAAE,QAAQ;iBACf,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,QAAQ;SACf,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,cAAc,CAAmC,SAAS,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Boolean validation core module
|
|
3
3
|
* Provides the base validation functionality for boolean values
|
|
4
4
|
*/
|
|
5
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
5
6
|
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a boolean validator
|
|
8
9
|
* @param {string} [message] - Custom error message for type validation
|
|
9
10
|
* @returns {Function} - Validator function that checks if the value is a boolean
|
|
10
11
|
*/
|
|
11
|
-
export declare const boolean: (message?: string) => (value: boolean) => ValidateCoreReturnType<boolean>;
|
|
12
|
+
export declare const boolean: (message?: string) => ((value: boolean) => ValidateCoreReturnType<boolean>) & StandardSchemaV1<boolean, boolean>;
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* Provides the base validation functionality for boolean values
|
|
4
4
|
*/
|
|
5
5
|
import { core } from "../../Validate/core";
|
|
6
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a boolean validator
|
|
8
9
|
* @param {string} [message] - Custom error message for type validation
|
|
9
10
|
* @returns {Function} - Validator function that checks if the value is a boolean
|
|
10
11
|
*/
|
|
11
12
|
export const boolean = (message) => {
|
|
12
|
-
|
|
13
|
+
const validator = (value) => core("boolean")(value, [], message);
|
|
14
|
+
return attachStandard(validator);
|
|
13
15
|
};
|
|
14
16
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/boolean/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/boolean/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAGnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,OAAgB,EAEmB,EAAE;IACrC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAmC,EAAE,CACpE,IAAI,CAAU,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,OAAO,cAAc,CAAqC,SAAS,CAAC,CAAC;AACvE,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Date validation core module
|
|
3
3
|
* Provides the base validation functionality for Date instances
|
|
4
4
|
*/
|
|
5
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
5
6
|
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a Date validator. The validator checks both that the value is an
|
|
@@ -11,4 +12,4 @@ import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
|
11
12
|
* @param {string} [message] - Custom error message for type validation
|
|
12
13
|
* @returns {Function} - Validator function that checks if the value is a Date instance
|
|
13
14
|
*/
|
|
14
|
-
export declare const date: (message?: string) => (value: Date) => ValidateCoreReturnType<Date>;
|
|
15
|
+
export declare const date: (message?: string) => ((value: Date) => ValidateCoreReturnType<Date>) & StandardSchemaV1<Date, Date>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Date validation core module
|
|
3
3
|
* Provides the base validation functionality for Date instances
|
|
4
4
|
*/
|
|
5
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
5
6
|
/**
|
|
6
7
|
* Creates a Date validator. The validator checks both that the value is an
|
|
7
8
|
* instance of Date and that it represents a valid moment in time (i.e. its
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
* @returns {Function} - Validator function that checks if the value is a Date instance
|
|
12
13
|
*/
|
|
13
14
|
export const date = (message) => {
|
|
14
|
-
|
|
15
|
+
const validator = (value) => {
|
|
15
16
|
if (!(value instanceof Date) || Number.isNaN(value.getTime())) {
|
|
16
17
|
return {
|
|
17
18
|
validate: false,
|
|
@@ -25,5 +26,6 @@ export const date = (message) => {
|
|
|
25
26
|
type: value,
|
|
26
27
|
};
|
|
27
28
|
};
|
|
29
|
+
return attachStandard(validator);
|
|
28
30
|
};
|
|
29
31
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/date/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/date/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,OAAgB,EAEa,EAAE;IAC/B,MAAM,SAAS,GAAG,CAAC,KAAW,EAAgC,EAAE;QAC9D,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;YAC9D,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,cAAc,CAA+B,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides validation for File / Blob instances. Falls back to `Blob` when
|
|
4
4
|
* the global `File` constructor is unavailable.
|
|
5
5
|
*/
|
|
6
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
6
7
|
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
7
8
|
/**
|
|
8
9
|
* Creates a validator that checks whether a value is a `File` (or `Blob` in
|
|
@@ -10,4 +11,4 @@ import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
|
10
11
|
* @param {string} [message] - Custom error message for type validation
|
|
11
12
|
* @returns {Function} - Validator function for File / Blob instances
|
|
12
13
|
*/
|
|
13
|
-
export declare const file: (message?: string) => (value: File) => ValidateCoreReturnType<File>;
|
|
14
|
+
export declare const file: (message?: string) => ((value: File) => ValidateCoreReturnType<File>) & StandardSchemaV1<File, File>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides validation for File / Blob instances. Falls back to `Blob` when
|
|
4
4
|
* the global `File` constructor is unavailable.
|
|
5
5
|
*/
|
|
6
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
6
7
|
const hasFileConstructor = typeof File !== "undefined";
|
|
7
8
|
const hasBlobConstructor = typeof Blob !== "undefined";
|
|
8
9
|
/**
|
|
@@ -12,7 +13,7 @@ const hasBlobConstructor = typeof Blob !== "undefined";
|
|
|
12
13
|
* @returns {Function} - Validator function for File / Blob instances
|
|
13
14
|
*/
|
|
14
15
|
export const file = (message) => {
|
|
15
|
-
|
|
16
|
+
const validator = (value) => {
|
|
16
17
|
const isFile = hasFileConstructor && value instanceof File;
|
|
17
18
|
const isBlob = hasBlobConstructor && value instanceof Blob;
|
|
18
19
|
if (!(isFile || isBlob)) {
|
|
@@ -28,5 +29,6 @@ export const file = (message) => {
|
|
|
28
29
|
type: value,
|
|
29
30
|
};
|
|
30
31
|
};
|
|
32
|
+
return attachStandard(validator);
|
|
31
33
|
};
|
|
32
34
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/file/core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/file/core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAGnC,MAAM,kBAAkB,GAAG,OAAO,IAAI,KAAK,WAAW,CAAC;AACvD,MAAM,kBAAkB,GAAG,OAAO,IAAI,KAAK,WAAW,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,OAAgB,EAEa,EAAE;IAC/B,MAAM,SAAS,GAAG,CAAC,KAAW,EAAgC,EAAE;QAC9D,MAAM,MAAM,GAAG,kBAAkB,IAAI,KAAK,YAAY,IAAI,CAAC;QAC3D,MAAM,MAAM,GAAG,kBAAkB,IAAI,KAAK,YAAY,IAAI,CAAC;QAC3D,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC;YACxB,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,cAAc,CAA+B,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -10,28 +10,29 @@
|
|
|
10
10
|
* `implement` property directly) to create a wrapped function that asserts
|
|
11
11
|
* the schema on every call.
|
|
12
12
|
*/
|
|
13
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
13
14
|
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
14
|
-
type
|
|
15
|
-
type
|
|
15
|
+
export type FunctionAnyValidator = (value: any) => ValidateCoreReturnType<unknown>;
|
|
16
|
+
export type FunctionExtractValidatedType<V> = V extends (value: never) => {
|
|
16
17
|
type: infer T;
|
|
17
18
|
} ? ValidateType<T> : never;
|
|
18
|
-
type InferInputs<Inputs> = Inputs extends readonly
|
|
19
|
-
[K in keyof Inputs]:
|
|
19
|
+
export type InferInputs<Inputs> = Inputs extends readonly FunctionAnyValidator[] ? {
|
|
20
|
+
[K in keyof Inputs]: FunctionExtractValidatedType<Inputs[K]>;
|
|
20
21
|
} : any[];
|
|
21
|
-
type InferOutput<Output> = Output extends
|
|
22
|
+
export type InferOutput<Output> = Output extends FunctionAnyValidator ? FunctionExtractValidatedType<Output> : any;
|
|
22
23
|
/**
|
|
23
24
|
* Function schema definition. `input` describes positional parameters and
|
|
24
25
|
* `output` describes the return type. Both are optional; when omitted the
|
|
25
26
|
* validator only enforces that the value is callable.
|
|
26
27
|
*/
|
|
27
28
|
export interface FunctionSchema {
|
|
28
|
-
input?: readonly
|
|
29
|
-
output?:
|
|
29
|
+
input?: readonly FunctionAnyValidator[];
|
|
30
|
+
output?: FunctionAnyValidator;
|
|
30
31
|
}
|
|
31
|
-
type ExtractInput<S> = S extends {
|
|
32
|
+
export type ExtractInput<S> = S extends {
|
|
32
33
|
input: infer I;
|
|
33
34
|
} ? I : undefined;
|
|
34
|
-
type ExtractOutput<S> = S extends {
|
|
35
|
+
export type ExtractOutput<S> = S extends {
|
|
35
36
|
output: infer O;
|
|
36
37
|
} ? O : undefined;
|
|
37
38
|
/**
|
|
@@ -71,5 +72,4 @@ export interface FunctionValidator<Inputs, Output> {
|
|
|
71
72
|
* @param {string} [message] - Custom error message for type validation
|
|
72
73
|
* @returns {FunctionValidator} - Validator augmented with `implement()`
|
|
73
74
|
*/
|
|
74
|
-
export declare const function_: <const S extends FunctionSchema = FunctionSchema>(schema?: S, message?: string) => FunctionValidator<ExtractInput<S>, ExtractOutput<S
|
|
75
|
-
export {};
|
|
75
|
+
export declare const function_: <const S extends FunctionSchema = FunctionSchema>(schema?: S, message?: string) => FunctionValidator<ExtractInput<S>, ExtractOutput<S>> & StandardSchemaV1<InferFunction<ExtractInput<S>, ExtractOutput<S>>, InferFunction<ExtractInput<S>, ExtractOutput<S>>>;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* `implement` property directly) to create a wrapped function that asserts
|
|
11
11
|
* the schema on every call.
|
|
12
12
|
*/
|
|
13
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
13
14
|
/**
|
|
14
15
|
* Creates a function validator. When invoked the validator only checks that
|
|
15
16
|
* the value is callable; use `.implement()` on the returned validator to
|
|
@@ -61,6 +62,6 @@ export const function_ = (schema, message) => {
|
|
|
61
62
|
};
|
|
62
63
|
return wrapped;
|
|
63
64
|
};
|
|
64
|
-
return validator;
|
|
65
|
+
return attachStandard(validator);
|
|
65
66
|
};
|
|
66
67
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/function/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/function/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAwEnC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAU,EACV,OAAgB,EAKd,EAAE;IAGJ,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC;IAE9B,MAAM,SAAS,GAAG,CAAC,CAAC,KAAoC,EAAE,EAAE;QAC1D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAsC,CAAC;IAExC,SAAS,CAAC,SAAS,GAAG,CAAC,UAAU,EAAE,EAAE;QACnC,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;YACrC,MAAM,IAAI,SAAS,CAAC,OAAO,IAAI,yBAAyB,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,GAAG,UAA+B,EAAE,EAAE;YACrD,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;oBACvD,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;oBACjD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;wBACrB,MAAM,IAAI,SAAS,CACjB,MAAM,CAAC,OAAO;4BACZ,2BAA2B,KAAK,oBAAoB,CACvD,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,MAAM,WAAW,GACf,UACD,CAAC,GAAI,UAAmC,CAAC,CAAC;YAC3C,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;gBACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACrB,MAAM,IAAI,SAAS,CACjB,MAAM,CAAC,OAAO,IAAI,mCAAmC,CACtD,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,OAAO,WAAkC,CAAC;QAC5C,CAAC,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,cAAc,CAInB,SAAS,CAAC,CAAC;AACf,CAAC,CAAC"}
|
package/module/Validate/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Validate/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAE1B,iBAAiB;AACjB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Validate/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAE1B,iBAAiB;AACjB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* specific constructor, including subclasses. The validator is exported as
|
|
5
5
|
* `instanceof_` because `instanceof` is a reserved keyword in JavaScript.
|
|
6
6
|
*/
|
|
7
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
7
8
|
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
8
|
-
type Constructor<T> = new (...arguments_: any[]) => T;
|
|
9
|
+
export type Constructor<T> = new (...arguments_: any[]) => T;
|
|
9
10
|
/**
|
|
10
11
|
* Creates a validator that checks whether a value is an instance of the given
|
|
11
12
|
* constructor. Subclasses of the constructor satisfy the validator, matching
|
|
@@ -15,5 +16,4 @@ type Constructor<T> = new (...arguments_: any[]) => T;
|
|
|
15
16
|
* @param {string} [message] - Custom error message for validation failure
|
|
16
17
|
* @returns {Function} - Validator function for instances of the constructor
|
|
17
18
|
*/
|
|
18
|
-
export declare const instanceof_: <T>(classConstructor: Constructor<T>, message?: string) => (value: T) => ValidateCoreReturnType<T>;
|
|
19
|
-
export {};
|
|
19
|
+
export declare const instanceof_: <T>(classConstructor: Constructor<T>, message?: string) => ((value: T) => ValidateCoreReturnType<T>) & StandardSchemaV1<T, T>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* specific constructor, including subclasses. The validator is exported as
|
|
5
5
|
* `instanceof_` because `instanceof` is a reserved keyword in JavaScript.
|
|
6
6
|
*/
|
|
7
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
7
8
|
/**
|
|
8
9
|
* Creates a validator that checks whether a value is an instance of the given
|
|
9
10
|
* constructor. Subclasses of the constructor satisfy the validator, matching
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
* @returns {Function} - Validator function for instances of the constructor
|
|
15
16
|
*/
|
|
16
17
|
export const instanceof_ = (classConstructor, message) => {
|
|
17
|
-
|
|
18
|
+
const validator = (value) => {
|
|
18
19
|
if (!(value instanceof classConstructor)) {
|
|
19
20
|
return {
|
|
20
21
|
validate: false,
|
|
@@ -28,5 +29,6 @@ export const instanceof_ = (classConstructor, message) => {
|
|
|
28
29
|
type: value,
|
|
29
30
|
};
|
|
30
31
|
};
|
|
32
|
+
return attachStandard(validator);
|
|
31
33
|
};
|
|
32
34
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/instanceof/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/instanceof/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAMnC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,gBAAgC,EAChC,OAAgB,EACoD,EAAE;IACtE,MAAM,SAAS,GAAG,CAAC,KAAQ,EAA6B,EAAE;QACxD,IAAI,CAAC,CAAC,KAAK,YAAY,gBAAgB,CAAC,EAAE,CAAC;YACzC,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAA4B;aACnC,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAA4B;SACnC,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,cAAc,CAAyB,SAAS,CAAC,CAAC;AAC3D,CAAC,CAAC"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* delegate to per-entry validators for keys and values, mirroring how
|
|
5
5
|
* `arrayOf()` validates each element of an array.
|
|
6
6
|
*/
|
|
7
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
7
8
|
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
8
|
-
type
|
|
9
|
+
export type MapExtractValidatedType<V> = V extends (value: never) => {
|
|
9
10
|
type: infer T;
|
|
10
11
|
} ? ValidateType<T> : never;
|
|
11
12
|
/**
|
|
@@ -20,5 +21,4 @@ type ExtractValidatedType<V> = V extends (value: never) => {
|
|
|
20
21
|
* @param {string} [message] - Custom error message for type validation
|
|
21
22
|
* @returns {Function} - Validator function for Map instances
|
|
22
23
|
*/
|
|
23
|
-
export declare const map: <KV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, VV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, K =
|
|
24
|
-
export {};
|
|
24
|
+
export declare const map: <KV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, VV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, K = MapExtractValidatedType<KV>, V = MapExtractValidatedType<VV>>(keyValidator?: KV, valueValidator?: VV, message?: string) => ((value: Map<K, V>) => ValidateCoreReturnType<Map<K, V>>) & StandardSchemaV1<Map<K, V>, Map<K, V>>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* delegate to per-entry validators for keys and values, mirroring how
|
|
5
5
|
* `arrayOf()` validates each element of an array.
|
|
6
6
|
*/
|
|
7
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
7
8
|
/**
|
|
8
9
|
* Creates a Map validator. The validator can optionally accept per-entry key
|
|
9
10
|
* and value validators that are applied to every entry of the map. When the
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
* @returns {Function} - Validator function for Map instances
|
|
18
19
|
*/
|
|
19
20
|
export const map = (keyValidator, valueValidator, message) => {
|
|
20
|
-
|
|
21
|
+
const mapValidator = (value) => {
|
|
21
22
|
if (!(value instanceof Map)) {
|
|
22
23
|
return {
|
|
23
24
|
validate: false,
|
|
@@ -53,5 +54,6 @@ export const map = (keyValidator, valueValidator, message) => {
|
|
|
53
54
|
type: value,
|
|
54
55
|
};
|
|
55
56
|
};
|
|
57
|
+
return attachStandard(mapValidator);
|
|
56
58
|
};
|
|
57
59
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/map/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/map/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AASnC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAYjB,YAAiB,EACjB,cAAmB,EACnB,OAAgB,EAEuB,EAAE;IACzC,MAAM,YAAY,GAAG,CACnB,KAAgB,EACmB,EAAE;QACrC,IAAI,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC;YAC3C,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,SAAS,GACb,YACD,CAAC,QAAQ,CAAC,CAAC;gBACZ,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;oBACxB,OAAO;wBACL,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE,SAAS,CAAC,OAAO;wBAC1B,IAAI,EAAE,KAAK;qBACZ,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,IAAI,cAAc,EAAE,CAAC;gBACnB,MAAM,WAAW,GACf,cAID,CAAC,UAAU,CAAC,CAAC;gBACd,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;oBAC1B,OAAO;wBACL,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE,WAAW,CAAC,OAAO;wBAC5B,IAAI,EAAE,KAAK;qBACZ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,cAAc,CACnB,YAAY,CACb,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* positions in a schema that must never be filled (for example, exhaustive
|
|
5
5
|
* union members that should be unreachable at the type level).
|
|
6
6
|
*/
|
|
7
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
7
8
|
/**
|
|
8
9
|
* Return type produced by a `never` validator. Exposes the literal `"never"`
|
|
9
10
|
* tag through the `type` field so `ValidateType<"never">` can map it back to
|
|
@@ -19,4 +20,4 @@ export interface NeverReturnType {
|
|
|
19
20
|
* @param {string} [message] - Custom error message for validation failure
|
|
20
21
|
* @returns {Function} - Validator that always returns a failing result
|
|
21
22
|
*/
|
|
22
|
-
export declare const never: (message?: string) => ((value: any) => NeverReturnType)
|
|
23
|
+
export declare const never: (message?: string) => ((value: any) => NeverReturnType) & StandardSchemaV1<never, never>;
|
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
* positions in a schema that must never be filled (for example, exhaustive
|
|
5
5
|
* union members that should be unreachable at the type level).
|
|
6
6
|
*/
|
|
7
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
7
8
|
/**
|
|
8
9
|
* Creates a validator that always fails
|
|
9
10
|
* @param {string} [message] - Custom error message for validation failure
|
|
10
11
|
* @returns {Function} - Validator that always returns a failing result
|
|
11
12
|
*/
|
|
12
|
-
// biome-ignore lint/suspicious/noExplicitAny: never() is widened to accept any input from union/intersection
|
|
13
13
|
export const never = (message) => {
|
|
14
14
|
// biome-ignore lint/suspicious/noExplicitAny: signature mirrors the public type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
15
|
+
const neverValidator = (_value) => ({
|
|
16
|
+
validate: false,
|
|
17
|
+
message: message ?? "",
|
|
18
|
+
type: "never",
|
|
19
|
+
});
|
|
20
|
+
return attachStandard(neverValidator);
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/never/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/never/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAanC;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,OAAgB,EAKe,EAAE;IACjC,gFAAgF;IAChF,MAAM,cAAc,GAAG,CAAC,MAAW,EAAmB,EAAE,CAAC,CAAC;QACxD,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,OAAO,IAAI,EAAE;QACtB,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,OAAO,cAAc,CAAsC,cAAc,CAAC,CAAC;AAC7E,CAAC,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Number validation core module
|
|
3
3
|
* Provides the base validation functionality for number values
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
6
|
+
import type { ValidateCoreReturnType, ValidateReturnType } from "../../Validate/type";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a number validator with optional validation rules
|
|
8
9
|
* @template T - Array of validation rules for numbers
|
|
@@ -10,4 +11,4 @@ import type { ValidateReturnType } from "../../Validate/type";
|
|
|
10
11
|
* @param {string} [message] - Custom error message for type validation
|
|
11
12
|
* @returns {Function} - Validator function that checks if the value is a number and applies validation rules
|
|
12
13
|
*/
|
|
13
|
-
export declare const number: <T extends ValidateReturnType<number>[]>(option?: T, message?: string) => (value: number) =>
|
|
14
|
+
export declare const number: <T extends ValidateReturnType<number>[]>(option?: T, message?: string) => ((value: number) => ValidateCoreReturnType<number>) & StandardSchemaV1<number, number>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides the base validation functionality for number values
|
|
4
4
|
*/
|
|
5
5
|
import { core } from "../../Validate/core";
|
|
6
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a number validator with optional validation rules
|
|
8
9
|
* @template T - Array of validation rules for numbers
|
|
@@ -11,6 +12,7 @@ import { core } from "../../Validate/core";
|
|
|
11
12
|
* @returns {Function} - Validator function that checks if the value is a number and applies validation rules
|
|
12
13
|
*/
|
|
13
14
|
export const number = (option, message) => {
|
|
14
|
-
|
|
15
|
+
const validator = (value) => core("number")(value, option, message);
|
|
16
|
+
return attachStandard(validator);
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/number/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/number/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,cAAc,GAEf,MAAM,2BAA2B,CAAC;AAMnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAAU,EACV,OAAgB,EAEiB,EAAE;IACnC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAClC,IAAI,CAAS,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,cAAc,CAAmC,SAAS,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides validation functionality for objects with type-specific validation rules for each property
|
|
4
4
|
*/
|
|
5
5
|
import type { PickPartial } from "../../types/object";
|
|
6
|
+
import { type StandardSchemaV1 } from "../../Validate/standardSchema";
|
|
6
7
|
import type { OptionalKeys, ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
7
8
|
/**
|
|
8
9
|
* Shape map describing per-property validators consumed by `object()`
|
|
@@ -31,4 +32,4 @@ export type ObjectValidator<T extends ObjectShape, U = {
|
|
|
31
32
|
* @param {string} [message] - Custom error message for object type validation
|
|
32
33
|
* @returns {ObjectValidator<T>} - Validator function with `.shape` attached so it can compose with `pick()`, `omit()`, `partial()`, and `required()`
|
|
33
34
|
*/
|
|
34
|
-
export declare const object: <T extends ObjectShape>(option?: T, message?: string) => ObjectValidator<T>;
|
|
35
|
+
export declare const object: <T extends ObjectShape>(option?: T, message?: string) => ObjectValidator<T> & StandardSchemaV1<unknown, unknown>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides validation functionality for objects with type-specific validation rules for each property
|
|
4
4
|
*/
|
|
5
5
|
import { isDictionaryObject } from "../../Validate/isDictionaryObject";
|
|
6
|
+
import { attachStandard, } from "../../Validate/standardSchema";
|
|
6
7
|
/**
|
|
7
8
|
* Creates an object validator with property-specific validation rules
|
|
8
9
|
* @template T - Object type containing validation functions for each property
|
|
@@ -39,6 +40,6 @@ export const object = (option = {}, message) => {
|
|
|
39
40
|
};
|
|
40
41
|
});
|
|
41
42
|
validator.shape = option;
|
|
42
|
-
return validator;
|
|
43
|
+
return attachStandard(validator);
|
|
43
44
|
};
|
|
44
45
|
//# sourceMappingURL=core.js.map
|