@pithos/core 2.1.0 → 2.1.1
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/dist/.tsbuildinfo +1 -1
- package/dist/arkhe/array/to-array.d.ts +1 -1
- package/dist/arkhe/async/parallel.js +1 -1
- package/dist/arkhe/async/retry.js +1 -1
- package/dist/arkhe/number/parsers/parse-float-def.d.ts +1 -1
- package/dist/arkhe/number/parsers/parse-float-def.js +1 -1
- package/dist/arkhe/number/parsers/parse-int-def.d.ts +1 -1
- package/dist/arkhe/object/defaults-deep.js +1 -1
- package/dist/arkhe/object/get.js +1 -1
- package/dist/arkhe/object/merge-with.js +1 -1
- package/dist/arkhe/object/set.js +2 -2
- package/dist/arkhe/string/pascal-case.js +1 -1
- package/dist/arkhe/test/console.js +1 -1
- package/dist/autocompletion.d.ts +702 -702
- package/dist/bridges/ensure.d.ts +2 -2
- package/dist/bridges/ensure.js +2 -2
- package/dist/bridges/ensureAsync.d.ts +2 -2
- package/dist/bridges/ensureAsync.js +2 -2
- package/dist/bridges/ensurePromise.d.ts +3 -3
- package/dist/bridges/ensurePromise.js +3 -3
- package/dist/kanon/core/parser.d.ts +1 -1
- package/dist/kanon/core/parser.js +1 -1
- package/dist/kanon/helpers/as-zod.d.ts +1 -1
- package/dist/kanon/helpers/as-zod.js +2 -2
- package/dist/kanon/helpers/as-zod.shim.d.ts +1 -1
- package/dist/kanon/helpers/as-zod.shim.js +3 -3
- package/dist/kanon/helpers/k.d.ts +42 -42
- package/dist/kanon/helpers/k.js +41 -41
- package/dist/kanon/index.d.ts +56 -56
- package/dist/kanon/index.js +46 -46
- package/dist/kanon/jit/builders/coerce.d.ts +2 -2
- package/dist/kanon/jit/builders/coerce.js +2 -2
- package/dist/kanon/jit/builders/composites/array.d.ts +2 -2
- package/dist/kanon/jit/builders/composites/array.js +2 -2
- package/dist/kanon/jit/builders/composites/object.d.ts +3 -3
- package/dist/kanon/jit/builders/composites/object.js +2 -2
- package/dist/kanon/jit/builders/operators/union.d.ts +1 -1
- package/dist/kanon/jit/builders/operators/union.js +3 -3
- package/dist/kanon/jit/builders/primitives/boolean.d.ts +2 -2
- package/dist/kanon/jit/builders/primitives/boolean.js +3 -3
- package/dist/kanon/jit/builders/primitives/number.d.ts +2 -2
- package/dist/kanon/jit/builders/primitives/number.js +3 -3
- package/dist/kanon/jit/builders/primitives/others.d.ts +2 -2
- package/dist/kanon/jit/builders/primitives/others.js +3 -3
- package/dist/kanon/jit/builders/primitives/string.d.ts +2 -2
- package/dist/kanon/jit/builders/primitives/string.js +4 -4
- package/dist/kanon/jit/builders/refinements.d.ts +2 -2
- package/dist/kanon/jit/builders/refinements.js +2 -2
- package/dist/kanon/jit/cache.d.ts +1 -1
- package/dist/kanon/jit/compiler.d.ts +4 -4
- package/dist/kanon/jit/compiler.js +14 -14
- package/dist/kanon/jit/context.d.ts +1 -1
- package/dist/kanon/jit/utils/arbitraries.d.ts +1 -1
- package/dist/kanon/jit/utils/arbitraries.js +6 -6
- package/dist/kanon/jit/utils/code.d.ts +1 -1
- package/dist/kanon/jit/utils/code.js +1 -1
- package/dist/kanon/schemas/coerce/bigint.d.ts +1 -1
- package/dist/kanon/schemas/coerce/bigint.js +2 -2
- package/dist/kanon/schemas/coerce/boolean.d.ts +1 -1
- package/dist/kanon/schemas/coerce/date.d.ts +1 -1
- package/dist/kanon/schemas/coerce/date.js +2 -2
- package/dist/kanon/schemas/coerce/number.d.ts +1 -1
- package/dist/kanon/schemas/coerce/number.js +2 -2
- package/dist/kanon/schemas/coerce/string.d.ts +1 -1
- package/dist/kanon/schemas/coerce/string.js +2 -2
- package/dist/kanon/schemas/composites/array.d.ts +2 -2
- package/dist/kanon/schemas/composites/array.js +3 -3
- package/dist/kanon/schemas/composites/map.d.ts +2 -2
- package/dist/kanon/schemas/composites/map.js +3 -3
- package/dist/kanon/schemas/composites/object.d.ts +2 -2
- package/dist/kanon/schemas/composites/object.js +3 -3
- package/dist/kanon/schemas/composites/record.d.ts +2 -2
- package/dist/kanon/schemas/composites/record.js +2 -2
- package/dist/kanon/schemas/composites/set.d.ts +2 -2
- package/dist/kanon/schemas/composites/set.js +3 -3
- package/dist/kanon/schemas/composites/tuple.d.ts +2 -2
- package/dist/kanon/schemas/composites/tuple.js +2 -2
- package/dist/kanon/schemas/constraints/array.d.ts +3 -3
- package/dist/kanon/schemas/constraints/array.js +2 -2
- package/dist/kanon/schemas/constraints/bigint.d.ts +2 -2
- package/dist/kanon/schemas/constraints/bigint.js +2 -2
- package/dist/kanon/schemas/constraints/date.d.ts +2 -2
- package/dist/kanon/schemas/constraints/date.js +2 -2
- package/dist/kanon/schemas/constraints/map.d.ts +3 -3
- package/dist/kanon/schemas/constraints/map.js +2 -2
- package/dist/kanon/schemas/constraints/number.d.ts +2 -2
- package/dist/kanon/schemas/constraints/number.js +2 -2
- package/dist/kanon/schemas/constraints/object.d.ts +3 -3
- package/dist/kanon/schemas/constraints/object.js +2 -2
- package/dist/kanon/schemas/constraints/refine/array.d.ts +3 -3
- package/dist/kanon/schemas/constraints/refine/array.js +2 -2
- package/dist/kanon/schemas/constraints/refine/bigint.d.ts +2 -2
- package/dist/kanon/schemas/constraints/refine/date.d.ts +2 -2
- package/dist/kanon/schemas/constraints/refine/map.d.ts +3 -3
- package/dist/kanon/schemas/constraints/refine/map.js +2 -2
- package/dist/kanon/schemas/constraints/refine/number.d.ts +2 -2
- package/dist/kanon/schemas/constraints/refine/object.d.ts +3 -3
- package/dist/kanon/schemas/constraints/refine/object.js +2 -2
- package/dist/kanon/schemas/constraints/refine/set.d.ts +3 -3
- package/dist/kanon/schemas/constraints/refine/set.js +2 -2
- package/dist/kanon/schemas/constraints/refine/string.d.ts +2 -2
- package/dist/kanon/schemas/constraints/set.d.ts +3 -3
- package/dist/kanon/schemas/constraints/set.js +2 -2
- package/dist/kanon/schemas/constraints/string.d.ts +2 -2
- package/dist/kanon/schemas/constraints/string.js +3 -3
- package/dist/kanon/schemas/operators/intersection.d.ts +2 -2
- package/dist/kanon/schemas/operators/union.d.ts +2 -2
- package/dist/kanon/schemas/operators/union.js +1 -1
- package/dist/kanon/schemas/primitives/any.d.ts +1 -1
- package/dist/kanon/schemas/primitives/bigint.d.ts +1 -1
- package/dist/kanon/schemas/primitives/bigint.js +2 -2
- package/dist/kanon/schemas/primitives/boolean.d.ts +1 -1
- package/dist/kanon/schemas/primitives/boolean.js +1 -1
- package/dist/kanon/schemas/primitives/date.d.ts +1 -1
- package/dist/kanon/schemas/primitives/date.js +2 -2
- package/dist/kanon/schemas/primitives/enum.d.ts +1 -1
- package/dist/kanon/schemas/primitives/enum.js +1 -1
- package/dist/kanon/schemas/primitives/int.d.ts +1 -1
- package/dist/kanon/schemas/primitives/int.js +1 -1
- package/dist/kanon/schemas/primitives/literal.d.ts +1 -1
- package/dist/kanon/schemas/primitives/literal.js +1 -1
- package/dist/kanon/schemas/primitives/nativeEnum.d.ts +1 -1
- package/dist/kanon/schemas/primitives/nativeEnum.js +1 -1
- package/dist/kanon/schemas/primitives/never.d.ts +1 -1
- package/dist/kanon/schemas/primitives/never.js +1 -1
- package/dist/kanon/schemas/primitives/null.d.ts +1 -1
- package/dist/kanon/schemas/primitives/null.js +1 -1
- package/dist/kanon/schemas/primitives/number.d.ts +1 -1
- package/dist/kanon/schemas/primitives/number.js +2 -2
- package/dist/kanon/schemas/primitives/string.d.ts +1 -1
- package/dist/kanon/schemas/primitives/string.js +2 -2
- package/dist/kanon/schemas/primitives/symbol.d.ts +1 -1
- package/dist/kanon/schemas/primitives/symbol.js +1 -1
- package/dist/kanon/schemas/primitives/undefined.d.ts +1 -1
- package/dist/kanon/schemas/primitives/undefined.js +1 -1
- package/dist/kanon/schemas/primitives/unknown.d.ts +1 -1
- package/dist/kanon/schemas/primitives/void.d.ts +1 -1
- package/dist/kanon/schemas/primitives/void.js +1 -1
- package/dist/kanon/schemas/transforms/keyof.d.ts +4 -4
- package/dist/kanon/schemas/transforms/keyof.js +1 -1
- package/dist/kanon/schemas/transforms/omit.d.ts +4 -4
- package/dist/kanon/schemas/transforms/omit.js +1 -1
- package/dist/kanon/schemas/transforms/partial.d.ts +4 -4
- package/dist/kanon/schemas/transforms/partial.js +1 -1
- package/dist/kanon/schemas/transforms/pick.d.ts +4 -4
- package/dist/kanon/schemas/transforms/pick.js +1 -1
- package/dist/kanon/schemas/transforms/required.d.ts +4 -4
- package/dist/kanon/schemas/transforms/required.js +1 -1
- package/dist/kanon/schemas/wrappers/default.d.ts +2 -2
- package/dist/kanon/schemas/wrappers/lazy.d.ts +2 -2
- package/dist/kanon/schemas/wrappers/nullable.d.ts +2 -2
- package/dist/kanon/schemas/wrappers/nullish.d.ts +2 -2
- package/dist/kanon/schemas/wrappers/optional.d.ts +2 -2
- package/dist/kanon/schemas/wrappers/readonly.d.ts +2 -2
- package/dist/kanon/types/composites.d.ts +1 -1
- package/dist/kanon/types/constraints.d.ts +1 -1
- package/dist/kanon/types/guards.d.ts +7 -7
- package/dist/kanon/types/operators.d.ts +2 -2
- package/dist/kanon/types/primitives.d.ts +1 -1
- package/dist/kanon/types/transforms.d.ts +1 -1
- package/dist/kanon/types/wrappers.d.ts +1 -1
- package/dist/kanon/validation.d.ts +1 -1
- package/dist/kanon/validation.js +1 -1
- package/dist/taphos/array/nth.js +1 -1
- package/dist/taphos/array/pull-all.js +1 -1
- package/dist/taphos/array/pullAllBy.js +1 -1
- package/dist/taphos/array/pullAllWith.js +1 -1
- package/dist/taphos/array/without.js +1 -1
- package/dist/taphos/object/at.js +1 -1
- package/dist/taphos/object/extend.js +1 -1
- package/dist/taphos/object/invoke.js +1 -1
- package/dist/taphos/object/unset.js +2 -2
- package/dist/taphos/object/update.js +2 -2
- package/dist/taphos/util/rangeRight.js +1 -1
- package/dist/zygos/either.d.ts +1 -1
- package/dist/zygos/either.js +1 -1
- package/dist/zygos/option.d.ts +1 -1
- package/dist/zygos/result/result-async.d.ts +5 -5
- package/dist/zygos/result/result-async.js +5 -5
- package/dist/zygos/result/result.d.ts +3 -3
- package/dist/zygos/result/result.js +4 -4
- package/dist/zygos/safe.d.ts +1 -1
- package/dist/zygos/safe.js +1 -1
- package/dist/zygos/task-either.d.ts +3 -3
- package/dist/zygos/task-either.js +3 -3
- package/package.json +1 -1
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* @since 2.0.0
|
|
14
14
|
* @experimental
|
|
15
15
|
*/
|
|
16
|
-
import type { GeneratorContext } from "../../context";
|
|
17
|
-
import type { GenericSchema } from "../../../types/base";
|
|
18
|
-
import { type CodeGenResult } from "../../utils/code";
|
|
16
|
+
import type { GeneratorContext } from "../../context.js";
|
|
17
|
+
import type { GenericSchema } from "../../../types/base.js";
|
|
18
|
+
import { type CodeGenResult } from "../../utils/code.js";
|
|
19
19
|
/**
|
|
20
20
|
* Property definition for object schema.
|
|
21
21
|
*
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* @since 2.0.0
|
|
14
14
|
* @experimental
|
|
15
15
|
*/
|
|
16
|
-
import { formatPath, getIndent, pushPath, nextVar, increaseIndent, } from "../../context";
|
|
17
|
-
import { escapeString, debugComment } from "../../utils/code";
|
|
16
|
+
import { formatPath, getIndent, pushPath, nextVar, increaseIndent, } from "../../context.js";
|
|
17
|
+
import { escapeString, debugComment } from "../../utils/code.js";
|
|
18
18
|
// ============================================================================
|
|
19
19
|
// Type check generators
|
|
20
20
|
// ============================================================================
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* @since 2.0.0
|
|
12
12
|
* @experimental
|
|
13
13
|
*/
|
|
14
|
-
import { formatPath, getIndent, nextVar, } from "../../context";
|
|
15
|
-
import { escapeString, debugComment } from "../../utils/code";
|
|
16
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages";
|
|
14
|
+
import { formatPath, getIndent, nextVar, } from "../../context.js";
|
|
15
|
+
import { escapeString, debugComment } from "../../utils/code.js";
|
|
16
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages.js";
|
|
17
17
|
// ============================================================================
|
|
18
18
|
// Primitive typeof optimization
|
|
19
19
|
// ============================================================================
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* @since 2.0.0
|
|
10
10
|
* @experimental
|
|
11
11
|
*/
|
|
12
|
-
import type { GeneratorContext } from "../../context";
|
|
13
|
-
import { type CodeGenResult } from "../../utils/code";
|
|
12
|
+
import type { GeneratorContext } from "../../context.js";
|
|
13
|
+
import { type CodeGenResult } from "../../utils/code.js";
|
|
14
14
|
/**
|
|
15
15
|
* Generates the type check code for a boolean value.
|
|
16
16
|
*
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* @since 2.0.0
|
|
10
10
|
* @experimental
|
|
11
11
|
*/
|
|
12
|
-
import { formatPath, getIndent } from "../../context";
|
|
13
|
-
import { escapeString, debugComment } from "../../utils/code";
|
|
14
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages";
|
|
12
|
+
import { formatPath, getIndent } from "../../context.js";
|
|
13
|
+
import { escapeString, debugComment } from "../../utils/code.js";
|
|
14
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages.js";
|
|
15
15
|
/**
|
|
16
16
|
* Generates the type check code for a boolean value.
|
|
17
17
|
*
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* @since 2.0.0
|
|
13
13
|
* @experimental
|
|
14
14
|
*/
|
|
15
|
-
import type { GeneratorContext } from "../../context";
|
|
16
|
-
import { type CodeGenResult } from "../../utils/code";
|
|
15
|
+
import type { GeneratorContext } from "../../context.js";
|
|
16
|
+
import { type CodeGenResult } from "../../utils/code.js";
|
|
17
17
|
/**
|
|
18
18
|
* Number constraint metadata for JIT compilation.
|
|
19
19
|
* These are extracted from the schema's refinements for inline code generation.
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* @since 2.0.0
|
|
13
13
|
* @experimental
|
|
14
14
|
*/
|
|
15
|
-
import { formatPath, getIndent } from "../../context";
|
|
16
|
-
import { escapeString, debugComment } from "../../utils/code";
|
|
17
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages";
|
|
15
|
+
import { formatPath, getIndent } from "../../context.js";
|
|
16
|
+
import { escapeString, debugComment } from "../../utils/code.js";
|
|
17
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages.js";
|
|
18
18
|
// ============================================================================
|
|
19
19
|
// Base constraint generators (from number-base.ts)
|
|
20
20
|
// ============================================================================
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* @since 2.0.0
|
|
10
10
|
* @experimental
|
|
11
11
|
*/
|
|
12
|
-
import type { GeneratorContext } from "../../context";
|
|
13
|
-
import { type CodeGenResult } from "../../utils/code";
|
|
12
|
+
import type { GeneratorContext } from "../../context.js";
|
|
13
|
+
import { type CodeGenResult } from "../../utils/code.js";
|
|
14
14
|
/**
|
|
15
15
|
* Generates the type check code for a null value.
|
|
16
16
|
*
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* @since 2.0.0
|
|
10
10
|
* @experimental
|
|
11
11
|
*/
|
|
12
|
-
import { formatPath, getIndent } from "../../context";
|
|
13
|
-
import { escapeString } from "../../utils/code";
|
|
14
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages";
|
|
12
|
+
import { formatPath, getIndent } from "../../context.js";
|
|
13
|
+
import { escapeString } from "../../utils/code.js";
|
|
14
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages.js";
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// Null type
|
|
17
17
|
// ============================================================================
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* @since 2.0.0
|
|
11
11
|
* @experimental
|
|
12
12
|
*/
|
|
13
|
-
import type { GeneratorContext } from "../../context";
|
|
14
|
-
import { type CodeGenResult } from "../../utils/code";
|
|
13
|
+
import type { GeneratorContext } from "../../context.js";
|
|
14
|
+
import { type CodeGenResult } from "../../utils/code.js";
|
|
15
15
|
/**
|
|
16
16
|
* String constraint metadata for JIT compilation.
|
|
17
17
|
* These are extracted from the schema's refinements for inline code generation.
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* @since 2.0.0
|
|
11
11
|
* @experimental
|
|
12
12
|
*/
|
|
13
|
-
import { formatPath, getIndent, addExternal } from "../../context";
|
|
14
|
-
import { escapeString, debugComment } from "../../utils/code";
|
|
15
|
-
import { EMAIL_REGEX, URL_REGEX, UUID_REGEX } from "../../../core/consts/patterns";
|
|
16
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages";
|
|
13
|
+
import { formatPath, getIndent, addExternal } from "../../context.js";
|
|
14
|
+
import { escapeString, debugComment } from "../../utils/code.js";
|
|
15
|
+
import { EMAIL_REGEX, URL_REGEX, UUID_REGEX } from "../../../core/consts/patterns.js";
|
|
16
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../../core/consts/messages.js";
|
|
17
17
|
// ============================================================================
|
|
18
18
|
// Base constraint generators
|
|
19
19
|
// ============================================================================
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* @since 2.0.0
|
|
12
12
|
* @experimental
|
|
13
13
|
*/
|
|
14
|
-
import type { GeneratorContext } from "../context";
|
|
15
|
-
import { type CodeGenResult } from "../utils/code";
|
|
14
|
+
import type { GeneratorContext } from "../context.js";
|
|
15
|
+
import { type CodeGenResult } from "../utils/code.js";
|
|
16
16
|
/**
|
|
17
17
|
* Refinement function type.
|
|
18
18
|
* Returns true for valid values, or an error message string for invalid values.
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* @since 2.0.0
|
|
12
12
|
* @experimental
|
|
13
13
|
*/
|
|
14
|
-
import { formatPath, getIndent, addExternal } from "../context";
|
|
15
|
-
import { escapeString } from "../utils/code";
|
|
14
|
+
import { formatPath, getIndent, addExternal } from "../context.js";
|
|
15
|
+
import { escapeString } from "../utils/code.js";
|
|
16
16
|
/**
|
|
17
17
|
* Generates code to call a single refinement function.
|
|
18
18
|
*
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* They are stored as external functions and called via the externals map.
|
|
33
33
|
* This introduces function call overhead but preserves correctness.
|
|
34
34
|
*/
|
|
35
|
-
import type { Schema, ValidatorResult } from "../types/base";
|
|
35
|
+
import type { Schema, ValidatorResult } from "../types/base.js";
|
|
36
36
|
/**
|
|
37
37
|
* Compiled validator function with metadata.
|
|
38
38
|
*
|
|
@@ -161,7 +161,7 @@ export interface CompileOptions {
|
|
|
161
161
|
*
|
|
162
162
|
* @example Basic usage
|
|
163
163
|
* ```typescript
|
|
164
|
-
* import { object, string, number, compile } from "../index";
|
|
164
|
+
* import { object, string, number, compile } from "../index.js";
|
|
165
165
|
*
|
|
166
166
|
* const userSchema = object({ name: string(), age: number() });
|
|
167
167
|
* const validate = compile(userSchema);
|
|
@@ -229,7 +229,7 @@ export declare function compile<T>(schema: Schema<T>, options?: CompileOptions):
|
|
|
229
229
|
*
|
|
230
230
|
* @example
|
|
231
231
|
* ```typescript
|
|
232
|
-
* import { isJITAvailable, compile } from "../index";
|
|
232
|
+
* import { isJITAvailable, compile } from "../index.js";
|
|
233
233
|
*
|
|
234
234
|
* if (isJITAvailable()) {
|
|
235
235
|
* const validate = compile(schema);
|
|
@@ -257,7 +257,7 @@ export declare function isJITAvailable(): boolean;
|
|
|
257
257
|
*
|
|
258
258
|
* @example
|
|
259
259
|
* ```typescript
|
|
260
|
-
* import { compile, clearCache } from "../index";
|
|
260
|
+
* import { compile, clearCache } from "../index.js";
|
|
261
261
|
*
|
|
262
262
|
* const validate1 = compile(schema);
|
|
263
263
|
* const validate2 = compile(schema);
|
|
@@ -32,21 +32,21 @@
|
|
|
32
32
|
* They are stored as external functions and called via the externals map.
|
|
33
33
|
* This introduces function call overhead but preserves correctness.
|
|
34
34
|
*/
|
|
35
|
-
import { createGeneratorContext } from "./context";
|
|
36
|
-
import { globalValidatorCache } from "./cache";
|
|
37
|
-
import { hasRefinements, getRefinements, generateRefinementsValidation, } from "./builders/refinements";
|
|
35
|
+
import { createGeneratorContext } from "./context.js";
|
|
36
|
+
import { globalValidatorCache } from "./cache.js";
|
|
37
|
+
import { hasRefinements, getRefinements, generateRefinementsValidation, } from "./builders/refinements.js";
|
|
38
38
|
// Import primitive builders
|
|
39
|
-
import { generateStringValidation } from "./builders/primitives/string";
|
|
40
|
-
import { generateNumberValidation } from "./builders/primitives/number";
|
|
41
|
-
import { generateBooleanValidation } from "./builders/primitives/boolean";
|
|
42
|
-
import { generateNullValidation, generateUndefinedValidation, generateAnyValidation, generateUnknownValidation, generateNeverValidation, generateVoidValidation, generateSymbolValidation, } from "./builders/primitives/others";
|
|
39
|
+
import { generateStringValidation } from "./builders/primitives/string.js";
|
|
40
|
+
import { generateNumberValidation } from "./builders/primitives/number.js";
|
|
41
|
+
import { generateBooleanValidation } from "./builders/primitives/boolean.js";
|
|
42
|
+
import { generateNullValidation, generateUndefinedValidation, generateAnyValidation, generateUnknownValidation, generateNeverValidation, generateVoidValidation, generateSymbolValidation, } from "./builders/primitives/others.js";
|
|
43
43
|
// Import composite builders
|
|
44
|
-
import { generateObjectValidation } from "./builders/composites/object";
|
|
45
|
-
import { generateArrayValidation } from "./builders/composites/array";
|
|
44
|
+
import { generateObjectValidation } from "./builders/composites/object.js";
|
|
45
|
+
import { generateArrayValidation } from "./builders/composites/array.js";
|
|
46
46
|
// Import operator builders
|
|
47
|
-
import { generateUnionValidation } from "./builders/operators/union";
|
|
47
|
+
import { generateUnionValidation } from "./builders/operators/union.js";
|
|
48
48
|
// Import coercion builders
|
|
49
|
-
import { generateCoerceStringValidation, generateCoerceNumberValidation, generateCoerceBooleanValidation, generateCoerceDateValidation, isCoerceType, } from "./builders/coerce";
|
|
49
|
+
import { generateCoerceStringValidation, generateCoerceNumberValidation, generateCoerceBooleanValidation, generateCoerceDateValidation, isCoerceType, } from "./builders/coerce.js";
|
|
50
50
|
// ============================================================================
|
|
51
51
|
// Schema Type Detection
|
|
52
52
|
// ============================================================================
|
|
@@ -380,7 +380,7 @@ function generateValidatorCode(schema, options) {
|
|
|
380
380
|
*
|
|
381
381
|
* @example Basic usage
|
|
382
382
|
* ```typescript
|
|
383
|
-
* import { object, string, number, compile } from "../index";
|
|
383
|
+
* import { object, string, number, compile } from "../index.js";
|
|
384
384
|
*
|
|
385
385
|
* const userSchema = object({ name: string(), age: number() });
|
|
386
386
|
* const validate = compile(userSchema);
|
|
@@ -502,7 +502,7 @@ export function compile(schema, options) {
|
|
|
502
502
|
*
|
|
503
503
|
* @example
|
|
504
504
|
* ```typescript
|
|
505
|
-
* import { isJITAvailable, compile } from "../index";
|
|
505
|
+
* import { isJITAvailable, compile } from "../index.js";
|
|
506
506
|
*
|
|
507
507
|
* if (isJITAvailable()) {
|
|
508
508
|
* const validate = compile(schema);
|
|
@@ -541,7 +541,7 @@ export function isJITAvailable() {
|
|
|
541
541
|
*
|
|
542
542
|
* @example
|
|
543
543
|
* ```typescript
|
|
544
|
-
* import { compile, clearCache } from "../index";
|
|
544
|
+
* import { compile, clearCache } from "../index.js";
|
|
545
545
|
*
|
|
546
546
|
* const validate1 = compile(schema);
|
|
547
547
|
* const validate2 = compile(schema);
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @since 2.0.0
|
|
14
14
|
* @experimental
|
|
15
15
|
*/
|
|
16
|
-
import type { GenericSchema } from "../types/base";
|
|
16
|
+
import type { GenericSchema } from "../types/base.js";
|
|
17
17
|
/**
|
|
18
18
|
* Type for external values that can be stored in the context.
|
|
19
19
|
* Can be either a refinement function or a RegExp pattern.
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* @experimental
|
|
11
11
|
*/
|
|
12
12
|
import * as fc from "fast-check";
|
|
13
|
-
import { string } from "../../schemas/primitives/string";
|
|
14
|
-
import { number } from "../../schemas/primitives/number";
|
|
15
|
-
import { boolean } from "../../schemas/primitives/boolean";
|
|
16
|
-
import { object } from "../../schemas/composites/object";
|
|
17
|
-
import { array } from "../../schemas/composites/array";
|
|
18
|
-
import { unionOf, unionOf3 } from "../../schemas/operators/union";
|
|
13
|
+
import { string } from "../../schemas/primitives/string.js";
|
|
14
|
+
import { number } from "../../schemas/primitives/number.js";
|
|
15
|
+
import { boolean } from "../../schemas/primitives/boolean.js";
|
|
16
|
+
import { object } from "../../schemas/composites/object.js";
|
|
17
|
+
import { array } from "../../schemas/composites/array.js";
|
|
18
|
+
import { unionOf, unionOf3 } from "../../schemas/operators/union.js";
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Primitive Schema Arbitraries
|
|
21
21
|
// ============================================================================
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
2
|
-
import { addBigIntConstraints } from "../../schemas/constraints/bigint";
|
|
1
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
2
|
+
import { addBigIntConstraints } from "../../schemas/constraints/bigint.js";
|
|
3
3
|
/**
|
|
4
4
|
* Coerce BigInt schema - converts values to bigint with constraints.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
2
|
-
import { addDateConstraints } from "../../schemas/constraints/date";
|
|
1
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
2
|
+
import { addDateConstraints } from "../../schemas/constraints/date.js";
|
|
3
3
|
/**
|
|
4
4
|
* Coerce Date schema - converts to Date with constraints.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
2
|
-
import { addNumberConstraints } from "../../schemas/constraints/number";
|
|
1
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
2
|
+
import { addNumberConstraints } from "../../schemas/constraints/number.js";
|
|
3
3
|
/**
|
|
4
4
|
* Coerce Number schema - converts to number with constraints.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
2
|
-
import { addStringConstraints } from "../../schemas/constraints/string";
|
|
1
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
2
|
+
import { addStringConstraints } from "../../schemas/constraints/string.js";
|
|
3
3
|
/**
|
|
4
4
|
* Coerce String schema - converts anything to string with constraints.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericSchema } from "../../types/base";
|
|
2
|
-
import { ArrayConstraint } from "../../types/constraints";
|
|
1
|
+
import { GenericSchema } from "../../types/base.js";
|
|
2
|
+
import { ArrayConstraint } from "../../types/constraints.js";
|
|
3
3
|
/**
|
|
4
4
|
* Array schema with composition and constraints.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isCoerced } from "../../types/base";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
3
|
-
import { addArrayConstraints } from "../../schemas/constraints/array";
|
|
1
|
+
import { isCoerced } from "../../types/base.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
|
+
import { addArrayConstraints } from "../../schemas/constraints/array.js";
|
|
4
4
|
/**
|
|
5
5
|
* Array schema with composition and constraints.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericSchema } from "../../types/base";
|
|
2
|
-
import { MapConstraint } from "../../types/constraints";
|
|
1
|
+
import { GenericSchema } from "../../types/base.js";
|
|
2
|
+
import { MapConstraint } from "../../types/constraints.js";
|
|
3
3
|
/**
|
|
4
4
|
* Map schema - validates a Map with typed keys and values.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isCoerced } from "../../types/base";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
3
|
-
import { addMapConstraints } from "../../schemas/constraints/map";
|
|
1
|
+
import { isCoerced } from "../../types/base.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
|
+
import { addMapConstraints } from "../../schemas/constraints/map.js";
|
|
4
4
|
/**
|
|
5
5
|
* Map schema - validates a Map with typed keys and values.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Schema } from "../../types/base";
|
|
2
|
-
import { ObjectConstraint } from "../../types/constraints";
|
|
1
|
+
import { Schema } from "../../types/base.js";
|
|
2
|
+
import { ObjectConstraint } from "../../types/constraints.js";
|
|
3
3
|
type AnySchema = Schema<any>;
|
|
4
4
|
/**
|
|
5
5
|
* Object schema with composition and constraints.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isCoerced } from "../../types/base";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
3
|
-
import { addObjectConstraints } from "../../schemas/constraints/object";
|
|
1
|
+
import { isCoerced } from "../../types/base.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
|
+
import { addObjectConstraints } from "../../schemas/constraints/object.js";
|
|
4
4
|
/**
|
|
5
5
|
* Object schema with composition and constraints.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericSchema } from "../../types/base";
|
|
2
|
-
import { RecordSchema } from "../../types/composites";
|
|
1
|
+
import { GenericSchema } from "../../types/base.js";
|
|
2
|
+
import { RecordSchema } from "../../types/composites.js";
|
|
3
3
|
/**
|
|
4
4
|
* Record schema - validates an object with typed keys and values.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isCoerced } from "../../types/base";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
1
|
+
import { isCoerced } from "../../types/base.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* Record schema - validates an object with typed keys and values.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericSchema } from "../../types/base";
|
|
2
|
-
import { SetConstraint } from "../../types/constraints";
|
|
1
|
+
import { GenericSchema } from "../../types/base.js";
|
|
2
|
+
import { SetConstraint } from "../../types/constraints.js";
|
|
3
3
|
/**
|
|
4
4
|
* Set schema - validates a Set with typed elements.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isCoerced } from "../../types/base";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
3
|
-
import { addSetConstraints } from "../../schemas/constraints/set";
|
|
1
|
+
import { isCoerced } from "../../types/base.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
|
+
import { addSetConstraints } from "../../schemas/constraints/set.js";
|
|
4
4
|
/**
|
|
5
5
|
* Set schema - validates a Set with typed elements.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericSchema } from "../../types/base";
|
|
2
|
-
import { TupleSchema, TupleWithRestSchema } from "../../types/composites";
|
|
1
|
+
import { GenericSchema } from "../../types/base.js";
|
|
2
|
+
import { TupleSchema, TupleWithRestSchema } from "../../types/composites.js";
|
|
3
3
|
/**
|
|
4
4
|
* Tuple schema - validates an array with specific types at each position.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isCoerced } from "../../types/base";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
1
|
+
import { isCoerced } from "../../types/base.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* Tuple schema - validates an array with specific types at each position.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArrayConstraint } from "../../types/constraints";
|
|
2
|
-
import { ArraySchema } from "../../types/composites";
|
|
3
|
-
import { GenericSchema } from "../../types/base";
|
|
1
|
+
import { ArrayConstraint } from "../../types/constraints.js";
|
|
2
|
+
import { ArraySchema } from "../../types/composites.js";
|
|
3
|
+
import { GenericSchema } from "../../types/base.js";
|
|
4
4
|
/**
|
|
5
5
|
* Adds array constraints to a base schema.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { refineArray } from "../../schemas/constraints/refine/array";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
1
|
+
import { refineArray } from "../../schemas/constraints/refine/array.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* Adds array constraints to a base schema.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BigIntConstraint } from "../../types/constraints";
|
|
2
|
-
import { BigIntSchema } from "../../types/primitives";
|
|
1
|
+
import { BigIntConstraint } from "../../types/constraints.js";
|
|
2
|
+
import { BigIntSchema } from "../../types/primitives.js";
|
|
3
3
|
/**
|
|
4
4
|
* Adds bigint constraints to a base schema.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { refineBigInt } from "../../schemas/constraints/refine/bigint";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
1
|
+
import { refineBigInt } from "../../schemas/constraints/refine/bigint.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* Adds bigint constraints to a base schema.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DateConstraint } from "../../types/constraints";
|
|
2
|
-
import { DateSchema } from "../../types/primitives";
|
|
1
|
+
import { DateConstraint } from "../../types/constraints.js";
|
|
2
|
+
import { DateSchema } from "../../types/primitives.js";
|
|
3
3
|
/**
|
|
4
4
|
* Adds date constraints to a base schema.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { refineDate } from "../../schemas/constraints/refine/date";
|
|
2
|
-
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages";
|
|
1
|
+
import { refineDate } from "../../schemas/constraints/refine/date.js";
|
|
2
|
+
import { ERROR_MESSAGES_COMPOSITION } from "../../core/consts/messages.js";
|
|
3
3
|
/**
|
|
4
4
|
* Adds date constraints to a base schema.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MapConstraint } from "../../types/constraints";
|
|
2
|
-
import { MapSchema } from "../../types/composites";
|
|
3
|
-
import { GenericSchema } from "../../types/base";
|
|
1
|
+
import { MapConstraint } from "../../types/constraints.js";
|
|
2
|
+
import { MapSchema } from "../../types/composites.js";
|
|
3
|
+
import { GenericSchema } from "../../types/base.js";
|
|
4
4
|
/**
|
|
5
5
|
* Adds map constraints to a base schema.
|
|
6
6
|
*
|