arktype 2.0.0-rc.24 → 2.0.0-rc.26
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/out/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ArkError, ArkErrors, type ArkConfig, type ArkScopeConfig, type JsonSchema } from "@ark/schema";
|
|
2
2
|
export { Hkt, inferred } from "@ark/util";
|
|
3
3
|
export type { distill } from "./attributes.ts";
|
|
4
|
+
export * from "./config.ts";
|
|
4
5
|
export { Generic } from "./generic.ts";
|
|
5
6
|
export { ark, declare, define, generic, keywords, type, type Ark } from "./keywords/keywords.ts";
|
|
6
7
|
export { Module, type BoundModule, type Submodule } from "./module.ts";
|
package/out/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ArkError, ArkErrors } from "@ark/schema";
|
|
2
2
|
export { Hkt, inferred } from "@ark/util";
|
|
3
|
+
export * from "./config.js";
|
|
3
4
|
export { Generic } from "./generic.js";
|
|
4
5
|
export { ark, declare, define, generic, keywords, type } from "./keywords/keywords.js";
|
|
5
6
|
export { Module } from "./module.js";
|
|
@@ -36,9 +36,9 @@ export declare const ark: Scope<Ark>;
|
|
|
36
36
|
export declare const keywords: Module<Ark>;
|
|
37
37
|
export declare const type: TypeParser<{}>;
|
|
38
38
|
export declare namespace type {
|
|
39
|
-
|
|
40
|
-
[inferred]?:
|
|
41
|
-
}
|
|
39
|
+
interface cast<to> {
|
|
40
|
+
[inferred]?: to;
|
|
41
|
+
}
|
|
42
42
|
type errors = ArkErrors;
|
|
43
43
|
/** @ts-ignore cast variance */
|
|
44
44
|
interface Any<out t = any> extends BaseType<t, any> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { intrinsic, rootSchema } from "@ark/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { numericStringMatcher } from "@ark/util";
|
|
3
3
|
import { arkModule } from "../utils.js";
|
|
4
4
|
import { regexStringNode } from "./utils.js";
|
|
5
|
-
const root = regexStringNode(
|
|
5
|
+
const root = regexStringNode(numericStringMatcher, "a well-formed numeric string");
|
|
6
6
|
export const numeric = arkModule({
|
|
7
7
|
root,
|
|
8
8
|
parse: rootSchema({
|
|
@@ -41,7 +41,7 @@ export const getBoundKinds = (comparator, limit, root, boundKind) => {
|
|
|
41
41
|
if (typeof limit !== "number") {
|
|
42
42
|
return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));
|
|
43
43
|
}
|
|
44
|
-
return (comparator === "==" ? ["
|
|
44
|
+
return (comparator === "==" ? ["exactLength"]
|
|
45
45
|
: comparator[0] === ">" ? ["minLength"]
|
|
46
46
|
: ["maxLength"]);
|
|
47
47
|
}
|
|
@@ -75,9 +75,10 @@ export const parseRightBound = (s, comparator) => {
|
|
|
75
75
|
const limit = limitNode.unit;
|
|
76
76
|
// apply the newly-parsed right bound
|
|
77
77
|
const exclusive = comparator.length === 1;
|
|
78
|
-
|
|
79
|
-
for (const kind of
|
|
80
|
-
s.constrainRoot(kind, { rule: limit, exclusive });
|
|
78
|
+
const boundKinds = getBoundKinds(comparator, typeof limit === "number" ? limit : limitToken, previousRoot, "right");
|
|
79
|
+
for (const kind of boundKinds) {
|
|
80
|
+
s.constrainRoot(kind, comparator === "==" ? { rule: limit } : { rule: limit, exclusive });
|
|
81
|
+
}
|
|
81
82
|
if (!s.branches.leftBound)
|
|
82
83
|
return;
|
|
83
84
|
// if there's an open left bound, perform additional validation and apply it
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arktype",
|
|
3
3
|
"description": "TypeScript's 1:1 validator, optimized from editor to runtime",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.26",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "David Blass",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"out"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@ark/
|
|
38
|
-
"@ark/
|
|
37
|
+
"@ark/schema": "0.26.0",
|
|
38
|
+
"@ark/util": "0.26.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|