@pithos/core 2.0.1 → 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 +719 -699
- package/dist/bridges/ensure.d.ts +28 -0
- package/dist/bridges/ensure.d.ts.map +1 -0
- package/dist/bridges/ensure.js +31 -0
- package/dist/bridges/ensure.js.map +1 -0
- package/dist/bridges/ensureAsync.d.ts +27 -0
- package/dist/bridges/ensureAsync.d.ts.map +1 -0
- package/dist/bridges/ensureAsync.js +30 -0
- package/dist/bridges/ensureAsync.js.map +1 -0
- package/dist/bridges/ensurePromise.d.ts +28 -0
- package/dist/bridges/ensurePromise.d.ts.map +1 -0
- package/dist/bridges/ensurePromise.js +33 -0
- package/dist/bridges/ensurePromise.js.map +1 -0
- 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 +7 -2
package/dist/kanon/index.js
CHANGED
|
@@ -4,59 +4,59 @@
|
|
|
4
4
|
* @since 2.0.0
|
|
5
5
|
*/
|
|
6
6
|
// Core parser
|
|
7
|
-
export { parse, parseBulk } from "./core/parser";
|
|
7
|
+
export { parse, parseBulk } from "./core/parser.js";
|
|
8
8
|
// Primitives
|
|
9
|
-
export { any } from "./schemas/primitives/any";
|
|
10
|
-
export { bigint } from "./schemas/primitives/bigint";
|
|
11
|
-
export { boolean } from "./schemas/primitives/boolean";
|
|
12
|
-
export { date } from "./schemas/primitives/date";
|
|
13
|
-
export { int } from "./schemas/primitives/int";
|
|
14
|
-
export { never } from "./schemas/primitives/never";
|
|
15
|
-
export { null_ } from "./schemas/primitives/null";
|
|
16
|
-
export { number } from "./schemas/primitives/number";
|
|
17
|
-
export { string } from "./schemas/primitives/string";
|
|
18
|
-
export { symbol } from "./schemas/primitives/symbol";
|
|
19
|
-
export { undefined_ } from "./schemas/primitives/undefined";
|
|
20
|
-
export { unknown } from "./schemas/primitives/unknown";
|
|
21
|
-
export { void_ } from "./schemas/primitives/void";
|
|
22
|
-
export { literal } from "./schemas/primitives/literal";
|
|
9
|
+
export { any } from "./schemas/primitives/any.js";
|
|
10
|
+
export { bigint } from "./schemas/primitives/bigint.js";
|
|
11
|
+
export { boolean } from "./schemas/primitives/boolean.js";
|
|
12
|
+
export { date } from "./schemas/primitives/date.js";
|
|
13
|
+
export { int } from "./schemas/primitives/int.js";
|
|
14
|
+
export { never } from "./schemas/primitives/never.js";
|
|
15
|
+
export { null_ } from "./schemas/primitives/null.js";
|
|
16
|
+
export { number } from "./schemas/primitives/number.js";
|
|
17
|
+
export { string } from "./schemas/primitives/string.js";
|
|
18
|
+
export { symbol } from "./schemas/primitives/symbol.js";
|
|
19
|
+
export { undefined_ } from "./schemas/primitives/undefined.js";
|
|
20
|
+
export { unknown } from "./schemas/primitives/unknown.js";
|
|
21
|
+
export { void_ } from "./schemas/primitives/void.js";
|
|
22
|
+
export { literal } from "./schemas/primitives/literal.js";
|
|
23
23
|
// Enums
|
|
24
|
-
export { enum_, numberEnum, booleanEnum, mixedEnum, } from "./schemas/primitives/enum";
|
|
25
|
-
export { nativeEnum } from "./schemas/primitives/nativeEnum";
|
|
24
|
+
export { enum_, numberEnum, booleanEnum, mixedEnum, } from "./schemas/primitives/enum.js";
|
|
25
|
+
export { nativeEnum } from "./schemas/primitives/nativeEnum.js";
|
|
26
26
|
// Composites
|
|
27
|
-
export { object, strictObject, looseObject } from "./schemas/composites/object";
|
|
28
|
-
export { array } from "./schemas/composites/array";
|
|
29
|
-
export { record } from "./schemas/composites/record";
|
|
30
|
-
export { tuple, tupleOf, tupleOf3, tupleOf4, tupleWithRest, } from "./schemas/composites/tuple";
|
|
31
|
-
export { map } from "./schemas/composites/map";
|
|
32
|
-
export { set } from "./schemas/composites/set";
|
|
27
|
+
export { object, strictObject, looseObject } from "./schemas/composites/object.js";
|
|
28
|
+
export { array } from "./schemas/composites/array.js";
|
|
29
|
+
export { record } from "./schemas/composites/record.js";
|
|
30
|
+
export { tuple, tupleOf, tupleOf3, tupleOf4, tupleWithRest, } from "./schemas/composites/tuple.js";
|
|
31
|
+
export { map } from "./schemas/composites/map.js";
|
|
32
|
+
export { set } from "./schemas/composites/set.js";
|
|
33
33
|
// Operators
|
|
34
|
-
export { unionOf, unionOf3, unionOf4, discriminatedUnion, } from "./schemas/operators/union";
|
|
35
|
-
export { intersection, intersection3 } from "./schemas/operators/intersection";
|
|
34
|
+
export { unionOf, unionOf3, unionOf4, discriminatedUnion, } from "./schemas/operators/union.js";
|
|
35
|
+
export { intersection, intersection3 } from "./schemas/operators/intersection.js";
|
|
36
36
|
// Wrappers
|
|
37
|
-
export { optional } from "./schemas/wrappers/optional";
|
|
38
|
-
export { nullable } from "./schemas/wrappers/nullable";
|
|
39
|
-
export { nullish } from "./schemas/wrappers/nullish";
|
|
40
|
-
export { default_, DefaultValues } from "./schemas/wrappers/default";
|
|
41
|
-
export { readonly } from "./schemas/wrappers/readonly";
|
|
42
|
-
export { lazy } from "./schemas/wrappers/lazy";
|
|
37
|
+
export { optional } from "./schemas/wrappers/optional.js";
|
|
38
|
+
export { nullable } from "./schemas/wrappers/nullable.js";
|
|
39
|
+
export { nullish } from "./schemas/wrappers/nullish.js";
|
|
40
|
+
export { default_, DefaultValues } from "./schemas/wrappers/default.js";
|
|
41
|
+
export { readonly } from "./schemas/wrappers/readonly.js";
|
|
42
|
+
export { lazy } from "./schemas/wrappers/lazy.js";
|
|
43
43
|
// Transforms
|
|
44
|
-
export { partial } from "./schemas/transforms/partial";
|
|
45
|
-
export { required } from "./schemas/transforms/required";
|
|
46
|
-
export { pick } from "./schemas/transforms/pick";
|
|
47
|
-
export { omit } from "./schemas/transforms/omit";
|
|
48
|
-
export { keyof } from "./schemas/transforms/keyof";
|
|
44
|
+
export { partial } from "./schemas/transforms/partial.js";
|
|
45
|
+
export { required } from "./schemas/transforms/required.js";
|
|
46
|
+
export { pick } from "./schemas/transforms/pick.js";
|
|
47
|
+
export { omit } from "./schemas/transforms/omit.js";
|
|
48
|
+
export { keyof } from "./schemas/transforms/keyof.js";
|
|
49
49
|
// Coercion
|
|
50
|
-
export { coerceString } from "./schemas/coerce/string";
|
|
51
|
-
export { coerceNumber } from "./schemas/coerce/number";
|
|
52
|
-
export { coerceBoolean } from "./schemas/coerce/boolean";
|
|
53
|
-
export { coerceBigInt } from "./schemas/coerce/bigint";
|
|
54
|
-
export { coerceDate } from "./schemas/coerce/date";
|
|
55
|
-
export { hasTupleRest } from "./types/composites";
|
|
56
|
-
export { isSchemaType, schemaGuards, isStringConstraint, isNumberConstraint, isArrayConstraint, isObjectConstraint, isDateConstraint, isBigIntConstraint, isSetConstraint, isMapConstraint } from "./types/guards";
|
|
50
|
+
export { coerceString } from "./schemas/coerce/string.js";
|
|
51
|
+
export { coerceNumber } from "./schemas/coerce/number.js";
|
|
52
|
+
export { coerceBoolean } from "./schemas/coerce/boolean.js";
|
|
53
|
+
export { coerceBigInt } from "./schemas/coerce/bigint.js";
|
|
54
|
+
export { coerceDate } from "./schemas/coerce/date.js";
|
|
55
|
+
export { hasTupleRest } from "./types/composites.js";
|
|
56
|
+
export { isSchemaType, schemaGuards, isStringConstraint, isNumberConstraint, isArrayConstraint, isObjectConstraint, isDateConstraint, isBigIntConstraint, isSetConstraint, isMapConstraint } from "./types/guards.js";
|
|
57
57
|
// Helpers
|
|
58
|
-
export { k } from "./helpers/k";
|
|
59
|
-
export { validation } from "./validation";
|
|
58
|
+
export { k } from "./helpers/k.js";
|
|
59
|
+
export { validation } from "./validation.js";
|
|
60
60
|
// JIT Compiler
|
|
61
|
-
export { compile, isJITAvailable, clearCache } from "./jit/compiler";
|
|
61
|
+
export { compile, isJITAvailable, clearCache } from "./jit/compiler.js";
|
|
62
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -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
|
* Generates inline code for coerce.string().
|
|
19
19
|
*
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* @since 2.0.0
|
|
13
13
|
* @experimental
|
|
14
14
|
*/
|
|
15
|
-
import { formatPath, getIndent } from "../context";
|
|
16
|
-
import { escapeString } from "../utils/code";
|
|
15
|
+
import { formatPath, getIndent } from "../context.js";
|
|
16
|
+
import { escapeString } from "../utils/code.js";
|
|
17
17
|
// ============================================================================
|
|
18
18
|
// Error messages (matching core/consts/messages.ts)
|
|
19
19
|
// ============================================================================
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* @since 2.0.0
|
|
14
14
|
* @experimental
|
|
15
15
|
*/
|
|
16
|
-
import type { GeneratorContext } from "../../context";
|
|
17
|
-
import { type CodeGenResult } from "../../utils/code";
|
|
16
|
+
import type { GeneratorContext } from "../../context.js";
|
|
17
|
+
import { type CodeGenResult } from "../../utils/code.js";
|
|
18
18
|
/**
|
|
19
19
|
* Array constraint metadata for JIT compilation.
|
|
20
20
|
*
|
|
@@ -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
|
// ============================================================================
|
|
@@ -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
|
*
|