arktype 2.0.3 → 2.1.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/README.md +124 -93
- package/out/attributes.d.ts +3 -5
- package/out/config.d.ts +17 -5
- package/out/config.js +3 -1
- package/out/index.d.ts +2 -2
- package/out/index.js +1 -1
- package/out/keywords/Array.js +2 -0
- package/out/keywords/FormData.js +2 -0
- package/out/keywords/TypedArray.js +2 -0
- package/out/keywords/keywords.d.ts +9 -4
- package/out/keywords/keywords.js +27 -10
- package/out/keywords/number.js +2 -0
- package/out/keywords/string.d.ts +19 -16
- package/out/keywords/string.js +43 -1
- package/out/keywords/ts.js +8 -2
- package/out/match.d.ts +119 -0
- package/out/match.js +77 -0
- package/out/methods/base.d.ts +75 -54
- package/out/methods/instantiate.d.ts +3 -8
- package/out/methods/object.d.ts +5 -5
- package/out/parser/ast/bounds.d.ts +4 -4
- package/out/parser/ast/divisor.d.ts +5 -3
- package/out/parser/ast/utils.d.ts +5 -1
- package/out/parser/definition.js +1 -1
- package/out/parser/property.d.ts +1 -3
- package/out/parser/shift/scanner.d.ts +1 -1
- package/out/parser/tupleExpressions.d.ts +50 -14
- package/out/parser/tupleExpressions.js +20 -9
- package/out/scope.d.ts +15 -5
- package/out/scope.js +20 -9
- package/out/type.d.ts +7 -4
- package/out/type.js +1 -0
- package/package.json +9 -5
- package/out/methods/morph.d.ts +0 -12
- package/out/methods/morph.js +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<h1 align="center">ArkType</h1>
|
|
2
|
+
<h3 align="center"><i>Optimized runtime validation for TypeScript syntax</i></h1>
|
|
2
3
|
|
|
3
4
|
ArkType is a runtime validation library that parses optimized validators from familiar, type-safe syntax.
|
|
4
5
|
|
|
@@ -11,7 +12,7 @@ controls
|
|
|
11
12
|
playsInline
|
|
12
13
|
muted
|
|
13
14
|
disablePictureInPicture
|
|
14
|
-
src="https://github.com/user-attachments/assets/
|
|
15
|
+
src="https://github.com/user-attachments/assets/69fdded6-50a9-402d-a28c-afa58db63c90"
|
|
15
16
|
/>
|
|
16
17
|
|
|
17
18
|
## Docs
|
|
@@ -48,114 +49,144 @@ Otherwise, consider sending me an email (david@arktype.io) or [message me on Dis
|
|
|
48
49
|
### ArkSponsors ⛵
|
|
49
50
|
|
|
50
51
|
<table>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
52
|
+
<tr>
|
|
53
|
+
<th>sam-goodwin</th>
|
|
54
|
+
<th>inspatiallabs</th>
|
|
55
|
+
</tr>
|
|
56
|
+
<tr>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="https://github.com/sam-goodwin"
|
|
59
|
+
><img
|
|
60
|
+
height="64px"
|
|
61
|
+
src="https://avatars.githubusercontent.com/sam-goodwin"
|
|
62
|
+
/></a>
|
|
63
|
+
</td>
|
|
64
|
+
<td>
|
|
65
|
+
<a href="https://github.com/inspatiallabs"
|
|
66
|
+
><img
|
|
67
|
+
height="64px"
|
|
68
|
+
src="https://avatars.githubusercontent.com/inspatiallabs"
|
|
69
|
+
/></a>
|
|
70
|
+
</td>
|
|
70
71
|
</tr>
|
|
71
72
|
</table>
|
|
72
73
|
|
|
73
74
|
### Sponsors 🥰
|
|
74
75
|
|
|
75
76
|
<table>
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
<tr>
|
|
78
|
+
<th>fubhy</th>
|
|
79
|
+
<th>tmm</th>
|
|
78
80
|
<th>mishushakov</th>
|
|
79
81
|
<th>mewhhaha</th>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<tr>
|
|
84
|
-
<td>
|
|
85
|
-
<a href="https://github.com/tmm"
|
|
86
|
-
><img
|
|
87
|
-
height="64px"
|
|
88
|
-
src="https://avatars.githubusercontent.com/u/6759464"
|
|
89
|
-
/></a>
|
|
90
|
-
</td>
|
|
82
|
+
<th>codeandcats</th>
|
|
83
|
+
</tr>
|
|
84
|
+
<tr>
|
|
91
85
|
<td>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
<a href="https://github.com/fubhy"
|
|
87
|
+
><img
|
|
88
|
+
height="64px"
|
|
89
|
+
src="https://avatars.githubusercontent.com/fubhy"
|
|
90
|
+
/></a>
|
|
91
|
+
</td>
|
|
96
92
|
<td>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
<th>JameEnder</th>
|
|
93
|
+
<a href="https://github.com/tmm"
|
|
94
|
+
><img
|
|
95
|
+
height="64px"
|
|
96
|
+
src="https://avatars.githubusercontent.com/tmm"
|
|
97
|
+
/></a>
|
|
98
|
+
</td>
|
|
99
|
+
<td>
|
|
100
|
+
<a href="https://github.com/mishushakov"
|
|
101
|
+
><img height="64px" src="https://avatars.githubusercontent.com/mishushakov"
|
|
102
|
+
/></a>
|
|
103
|
+
</td>
|
|
104
|
+
<td>
|
|
105
|
+
<a href="https://github.com/mewhhaha"
|
|
106
|
+
><img
|
|
107
|
+
height="64px"
|
|
108
|
+
src="https://avatars.githubusercontent.com/mewhhaha"
|
|
109
|
+
/></a>
|
|
110
|
+
</td>
|
|
111
|
+
<td>
|
|
112
|
+
<a href="https://github.com/codeandcats"
|
|
113
|
+
><img
|
|
114
|
+
height="64px"
|
|
115
|
+
src="https://avatars.githubusercontent.com/codeandcats"
|
|
116
|
+
/></a>
|
|
117
|
+
</td>
|
|
123
118
|
</tr>
|
|
124
119
|
<tr>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
120
|
+
<th>drwpwrs</th>
|
|
121
|
+
<th>Timeraa</th>
|
|
122
|
+
<th>Phalangers</th>
|
|
123
|
+
<th>WilliamConnatser</th>
|
|
124
|
+
<th>JameEnder</th>
|
|
125
|
+
</tr>
|
|
126
|
+
<tr>
|
|
127
|
+
<td>
|
|
128
|
+
<a href="https://github.com/drwpwrs"
|
|
129
|
+
><img
|
|
130
|
+
height="64px"
|
|
131
|
+
src="https://avatars.githubusercontent.com/drwpwrs"
|
|
132
|
+
/></a>
|
|
133
|
+
</td>
|
|
134
|
+
<td>
|
|
135
|
+
<a href="https://github.com/Timeraa"
|
|
136
|
+
><img
|
|
137
|
+
height="64px"
|
|
138
|
+
src="https://avatars.githubusercontent.com/Timeraa"
|
|
139
|
+
/></a>
|
|
140
|
+
</td>
|
|
141
|
+
<td>
|
|
142
|
+
<a href="https://github.com/Phalangers"
|
|
143
|
+
><img
|
|
144
|
+
height="64px"
|
|
145
|
+
src="https://avatars.githubusercontent.com/Phalangers"
|
|
146
|
+
/></a>
|
|
147
|
+
</td>
|
|
148
|
+
<td>
|
|
149
|
+
<a href="https://github.com/WilliamConnatser"
|
|
150
|
+
><img
|
|
151
|
+
height="64px"
|
|
152
|
+
src="https://avatars.githubusercontent.com/WilliamConnatser"
|
|
153
|
+
/></a>
|
|
154
|
+
</td>
|
|
155
|
+
<td>
|
|
156
|
+
<a href="https://github.com/JameEnder"
|
|
157
|
+
><img
|
|
158
|
+
height="64px"
|
|
159
|
+
src="https://avatars.githubusercontent.com/JameEnder"
|
|
160
|
+
/></a>
|
|
161
|
+
</td>
|
|
162
|
+
</tr>
|
|
163
|
+
<tr>
|
|
164
|
+
<th>tylim88</th>
|
|
165
|
+
<th>jahands</th>
|
|
166
|
+
<th></th>
|
|
167
|
+
<th></th>
|
|
168
|
+
<th></th>
|
|
169
|
+
</tr>
|
|
170
|
+
<tr>
|
|
171
|
+
<td>
|
|
172
|
+
<a href="https://github.com/tylim88"
|
|
173
|
+
><img
|
|
174
|
+
height="64px"
|
|
175
|
+
src="https://avatars.githubusercontent.com/tylim88"
|
|
176
|
+
/></a>
|
|
177
|
+
</td>
|
|
178
|
+
<td>
|
|
179
|
+
<a href="https://github.com/jahands"
|
|
180
|
+
><img
|
|
181
|
+
height="64px"
|
|
182
|
+
src="https://avatars.githubusercontent.com/jahands"
|
|
183
|
+
/></a>
|
|
184
|
+
</td>
|
|
139
185
|
<td>
|
|
140
|
-
|
|
141
|
-
><img
|
|
142
|
-
height="64px"
|
|
143
|
-
src="https://avatars.githubusercontent.com/u/43946230"
|
|
144
|
-
/></a>
|
|
145
|
-
</td>
|
|
186
|
+
</td>
|
|
146
187
|
<td>
|
|
147
|
-
<a href="https://github.com/JameEnder"
|
|
148
|
-
><img
|
|
149
|
-
height="64px"
|
|
150
|
-
src="https://avatars.githubusercontent.com/u/47925045"
|
|
151
|
-
/></a>
|
|
152
188
|
</td>
|
|
153
189
|
<td>
|
|
154
|
-
<a href="https://github.com/tylim88"
|
|
155
|
-
><img
|
|
156
|
-
height="64px"
|
|
157
|
-
src="https://avatars.githubusercontent.com/u/5227509"
|
|
158
|
-
/></a>
|
|
159
190
|
</td>
|
|
160
191
|
</tr>
|
|
161
192
|
</table>
|
package/out/attributes.d.ts
CHANGED
|
@@ -19,9 +19,7 @@ export declare namespace distill {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
type finalizeDistillation<t, distilled> = equals<t, distilled> extends true ? t : distilled;
|
|
22
|
-
type _distill<t, endpoint extends distill.Endpoint, seen> = t extends undefined ? t : [t] extends [anyOrNever | seen] ? t : unknown extends t ? unknown : t extends Brand<infer base> ? endpoint extends "in" ? base : t : t extends TerminallyInferredObject | Primitive ? t : t extends Function ? t extends InferredMorph<infer i, infer o> ?
|
|
23
|
-
ReturnType<t>
|
|
24
|
-
] extends [anyOrNever] ? t : distillIo<i, o, endpoint, seen> : t : t extends Default<infer constraint> ? _distill<constraint, endpoint, seen> : t extends array ? distillArray<t, endpoint, seen | t> : isSafelyMappable<t> extends true ? distillMappable<t, endpoint, seen | t> : t;
|
|
22
|
+
type _distill<t, endpoint extends distill.Endpoint, seen> = t extends undefined ? t : [t] extends [anyOrNever | seen] ? t : unknown extends t ? unknown : t extends Brand<infer base> ? endpoint extends "in" ? base : t : t extends TerminallyInferredObject | Primitive ? t : t extends Function ? t extends (...args: never) => anyOrNever ? t : t extends InferredMorph<infer i, infer o> ? distillIo<i, o, endpoint, seen> : t : t extends Default<infer constraint> ? _distill<constraint, endpoint, seen> : t extends array ? distillArray<t, endpoint, seen | t> : isSafelyMappable<t> extends true ? distillMappable<t, endpoint, seen | t> : t;
|
|
25
23
|
type distillMappable<o, endpoint extends distill.Endpoint, seen> = endpoint extends "in" ? show<{
|
|
26
24
|
[k in keyof o as k extends inferredDefaultKeyOf<o> ? never : k]: _distill<o[k], endpoint, seen>;
|
|
27
25
|
} & {
|
|
@@ -73,11 +71,11 @@ export type withDefault<t, v, undistributed = t> = t extends InferredMorph ? add
|
|
|
73
71
|
type addDefaultToMorph<t extends InferredMorph, v> = [
|
|
74
72
|
normalizeMorphDistribution<t>
|
|
75
73
|
] extends [InferredMorph<infer i, infer o>] ? (In: Default<i, v>) => o : never;
|
|
76
|
-
type normalizeMorphDistribution<t, undistributedIn = t extends InferredMorph<infer i> ? i : never, undistributedOut extends Out =
|
|
74
|
+
type normalizeMorphDistribution<t, undistributedIn = t extends InferredMorph<infer i> ? i : never, undistributedOut extends Out = t extends InferredMorph<any, infer o> ? [
|
|
77
75
|
o
|
|
78
76
|
] extends [To<infer unwrappedOut>] ? To<unwrappedOut> : o : never> = (Extract<t, InferredMorph> extends anyOrNever ? never : Extract<t, InferredMorph> extends InferredMorph<infer i, infer o> ? [
|
|
79
77
|
undistributedOut
|
|
80
|
-
] extends [o] ? (In: undistributedIn) => undistributedOut : [undistributedIn] extends [i] ? (In: undistributedIn) => undistributedOut : t : never) | Exclude<t, InferredMorph
|
|
78
|
+
] extends [o] ? (In: undistributedIn) => undistributedOut : [undistributedIn] extends [i] ? (In: undistributedIn) => undistributedOut : t : never) | Exclude<t, InferredMorph> extends infer _ ? _ : never;
|
|
81
79
|
export type defaultFor<t = unknown> = (Primitive extends t ? Primitive : t extends Primitive ? t : never) | (() => t);
|
|
82
80
|
export type termOrType<t> = t | Type<t, any>;
|
|
83
81
|
export type inferIntersection<l, r> = normalizeMorphDistribution<_inferIntersection<l, r, false>>;
|
package/out/config.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { arkKind } from "@ark/schema";
|
|
2
2
|
import type { Ark } from "./keywords/keywords.ts";
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
3
|
+
import { type ArkSchemaConfig } from "@ark/schema/config";
|
|
4
|
+
import type { anyOrNever } from "@ark/util";
|
|
5
|
+
export type TypeMeta = Omit<ArkEnv.meta, "onFail">;
|
|
6
|
+
export type TypeMetaInput = string | TypeMeta;
|
|
7
|
+
export type KeywordConfig = {
|
|
8
|
+
[k in keyof Ark.flat as parseConfigurableFlatAlias<k, Ark.flat[k]>]?: TypeMetaInput;
|
|
9
|
+
};
|
|
10
|
+
type parseConfigurableFlatAlias<k extends string, v> = [
|
|
11
|
+
v
|
|
12
|
+
] extends [anyOrNever] ? k : v extends {
|
|
13
|
+
[arkKind]: "generic" | "module";
|
|
14
|
+
} ? never : k extends `${infer prefix}.root` ? prefix : k;
|
|
15
|
+
export interface ArkConfig extends ArkSchemaConfig {
|
|
16
|
+
keywords?: KeywordConfig;
|
|
7
17
|
}
|
|
18
|
+
export declare const configure: <config extends ArkConfig>(config: config) => config;
|
|
8
19
|
declare global {
|
|
9
20
|
export interface ArkEnv {
|
|
10
21
|
$(): Ark;
|
|
@@ -23,3 +34,4 @@ export declare namespace ArkAmbient {
|
|
|
23
34
|
type meta = ArkEnv.meta;
|
|
24
35
|
type prototypes = ArkEnv.prototypes;
|
|
25
36
|
}
|
|
37
|
+
export {};
|
package/out/config.js
CHANGED
package/out/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { ArkError, ArkErrors, type
|
|
1
|
+
export { ArkError, ArkErrors, type ArkSchemaConfig, type ArkSchemaScopeConfig, type JsonSchema } from "@ark/schema";
|
|
2
2
|
export { Hkt, inferred } from "@ark/util";
|
|
3
3
|
export type { distill } from "./attributes.ts";
|
|
4
4
|
export * from "./config.ts";
|
|
5
5
|
export { Generic } from "./generic.ts";
|
|
6
|
-
export { ark, declare, define, generic, keywords, type, type Ark } from "./keywords/keywords.ts";
|
|
6
|
+
export { ark, declare, define, generic, keywords, match, type, type Ark } from "./keywords/keywords.ts";
|
|
7
7
|
export { Module, type BoundModule, type Submodule } from "./module.ts";
|
|
8
8
|
export { scope, type Scope } from "./scope.ts";
|
|
9
9
|
export { Type } from "./type.ts";
|
package/out/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { ArkError, ArkErrors } from "@ark/schema";
|
|
|
2
2
|
export { Hkt, inferred } from "@ark/util";
|
|
3
3
|
export * from "./config.js";
|
|
4
4
|
export { Generic } from "./generic.js";
|
|
5
|
-
export { ark, declare, define, generic, keywords, type } from "./keywords/keywords.js";
|
|
5
|
+
export { ark, declare, define, generic, keywords, match, type } from "./keywords/keywords.js";
|
|
6
6
|
export { Module } from "./module.js";
|
|
7
7
|
export { scope } from "./scope.js";
|
|
8
8
|
export { Type } from "./type.js";
|
package/out/keywords/Array.js
CHANGED
package/out/keywords/FormData.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { ArkErrors, arkKind } from "@ark/schema";
|
|
1
|
+
import type { ArkErrors, arkKind, flatResolutionsOf } from "@ark/schema";
|
|
2
2
|
import type { Brand, inferred } from "@ark/util";
|
|
3
3
|
import type { distill, InferredMorph, Out, To } from "../attributes.ts";
|
|
4
4
|
import type { GenericParser } from "../generic.ts";
|
|
5
|
+
import type { MatchParser } from "../match.ts";
|
|
5
6
|
import type { BaseType } from "../methods/base.ts";
|
|
7
|
+
import type { instantiateType } from "../methods/instantiate.ts";
|
|
6
8
|
import type { BoundModule, Module } from "../module.ts";
|
|
7
9
|
import type { inferDefinition, validateDefinition } from "../parser/definition.ts";
|
|
8
10
|
import { type bindThis, type Scope } from "../scope.ts";
|
|
@@ -23,6 +25,7 @@ export declare namespace Ark {
|
|
|
23
25
|
object: object.submodule;
|
|
24
26
|
unknown: unknown.submodule;
|
|
25
27
|
}
|
|
28
|
+
type flat = flatResolutionsOf<Ark>;
|
|
26
29
|
interface typeAttachments extends arkTsKeywords.$ {
|
|
27
30
|
arrayIndex: arkPrototypes.$["Array"]["index"];
|
|
28
31
|
Key: arkBuiltins.$["Key"];
|
|
@@ -41,9 +44,6 @@ export declare namespace type {
|
|
|
41
44
|
[inferred]?: to;
|
|
42
45
|
}
|
|
43
46
|
type errors = ArkErrors;
|
|
44
|
-
/** @ts-ignore cast variance */
|
|
45
|
-
interface Any<out t = any> extends BaseType<t, any> {
|
|
46
|
-
}
|
|
47
47
|
type infer<def, $ = {}, args = bindThis<def>> = inferDefinition<def, $, args>;
|
|
48
48
|
namespace infer {
|
|
49
49
|
type In<def, $ = {}, args = {}> = distill.In<inferDefinition<def, $, args>>;
|
|
@@ -53,9 +53,14 @@ export declare namespace type {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
type validate<def, $ = {}, args = bindThis<def>> = validateDefinition<def, $, args>;
|
|
56
|
+
type instantiate<def, $ = {}, args = bindThis<def>> = instantiateType<inferDefinition<def, $, args>, $>;
|
|
56
57
|
type brand<t, id> = t extends InferredMorph<infer i, infer o> ? o["introspectable"] extends true ? (In: i) => To<Brand<o["t"], id>> : (In: i) => Out<Brand<o["t"], id>> : Brand<t, id>;
|
|
58
|
+
/** @ts-ignore cast variance */
|
|
59
|
+
interface Any<out t = any> extends BaseType<t, any> {
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
62
|
export type type<t = unknown, $ = {}> = Type<t, $>;
|
|
63
|
+
export declare const match: MatchParser<{}>;
|
|
59
64
|
export declare const generic: GenericParser<{}>;
|
|
60
65
|
export declare const schema: SchemaParser<{}>;
|
|
61
66
|
export declare const define: DefinitionParser<{}>;
|
package/out/keywords/keywords.js
CHANGED
|
@@ -4,14 +4,6 @@ import { arkPrototypes } from "./constructors.js";
|
|
|
4
4
|
import { number } from "./number.js";
|
|
5
5
|
import { string } from "./string.js";
|
|
6
6
|
import { arkTsGenerics, arkTsKeywords, object, unknown } from "./ts.js";
|
|
7
|
-
$arkTypeRegistry.typeAttachments = {
|
|
8
|
-
...arkTsKeywords,
|
|
9
|
-
arrayIndex: arkPrototypes.Array.index,
|
|
10
|
-
Key: arkBuiltins.Key,
|
|
11
|
-
Record: arkTsGenerics.Record,
|
|
12
|
-
Array: arkPrototypes.Array.root,
|
|
13
|
-
Date: arkPrototypes.Date
|
|
14
|
-
};
|
|
15
7
|
export const ark = scope({
|
|
16
8
|
...arkTsKeywords,
|
|
17
9
|
...arkTsGenerics,
|
|
@@ -21,9 +13,34 @@ export const ark = scope({
|
|
|
21
13
|
number,
|
|
22
14
|
object,
|
|
23
15
|
unknown
|
|
24
|
-
}, { prereducedAliases: true,
|
|
16
|
+
}, { prereducedAliases: true, name: "ark" });
|
|
25
17
|
export const keywords = ark.export();
|
|
26
|
-
|
|
18
|
+
Object.assign($arkTypeRegistry.ambient, keywords);
|
|
19
|
+
$arkTypeRegistry.typeAttachments = {
|
|
20
|
+
string: keywords.string.root,
|
|
21
|
+
number: keywords.number.root,
|
|
22
|
+
bigint: keywords.bigint,
|
|
23
|
+
boolean: keywords.boolean,
|
|
24
|
+
symbol: keywords.symbol,
|
|
25
|
+
undefined: keywords.undefined,
|
|
26
|
+
null: keywords.null,
|
|
27
|
+
object: keywords.object.root,
|
|
28
|
+
unknown: keywords.unknown.root,
|
|
29
|
+
false: keywords.false,
|
|
30
|
+
true: keywords.true,
|
|
31
|
+
never: keywords.never,
|
|
32
|
+
arrayIndex: keywords.Array.index,
|
|
33
|
+
Key: keywords.Key,
|
|
34
|
+
Record: keywords.Record,
|
|
35
|
+
Array: keywords.Array.root,
|
|
36
|
+
Date: keywords.Date
|
|
37
|
+
};
|
|
38
|
+
export const type = Object.assign(ark.type,
|
|
39
|
+
// assign attachments newly parsed in keywords
|
|
40
|
+
// future scopes add these directly from the
|
|
41
|
+
// registry when their TypeParsers are instantiated
|
|
42
|
+
$arkTypeRegistry.typeAttachments);
|
|
43
|
+
export const match = ark.match;
|
|
27
44
|
export const generic = ark.generic;
|
|
28
45
|
export const schema = ark.schema;
|
|
29
46
|
export const define = ark.define;
|
package/out/keywords/number.js
CHANGED
package/out/keywords/string.d.ts
CHANGED
|
@@ -244,10 +244,27 @@ export declare namespace uuid {
|
|
|
244
244
|
v7: string;
|
|
245
245
|
v8: string;
|
|
246
246
|
};
|
|
247
|
+
namespace $ {
|
|
248
|
+
type flat = {};
|
|
249
|
+
}
|
|
247
250
|
}
|
|
248
251
|
export declare const string: Module<{
|
|
249
252
|
root: unknown;
|
|
250
|
-
|
|
253
|
+
alpha: unknown;
|
|
254
|
+
alphanumeric: unknown;
|
|
255
|
+
base64: Submodule<{
|
|
256
|
+
root: unknown;
|
|
257
|
+
url: unknown;
|
|
258
|
+
}>;
|
|
259
|
+
capitalize: Submodule<capitalize.submodule>;
|
|
260
|
+
creditCard: unknown;
|
|
261
|
+
date: Submodule<stringDate.submodule>;
|
|
262
|
+
digits: unknown;
|
|
263
|
+
email: unknown;
|
|
264
|
+
integer: Submodule<stringInteger.submodule>;
|
|
265
|
+
ip: Submodule<ip.submodule>;
|
|
266
|
+
json: Submodule<stringJson.submodule>;
|
|
267
|
+
lower: Submodule<lower.submodule>;
|
|
251
268
|
normalize: Submodule<{
|
|
252
269
|
root: unknown;
|
|
253
270
|
NFC: Submodule<{
|
|
@@ -267,23 +284,9 @@ export declare const string: Module<{
|
|
|
267
284
|
preformatted: unknown;
|
|
268
285
|
}>;
|
|
269
286
|
}>;
|
|
270
|
-
integer: Submodule<stringInteger.submodule>;
|
|
271
|
-
json: Submodule<stringJson.submodule>;
|
|
272
|
-
alpha: unknown;
|
|
273
|
-
alphanumeric: unknown;
|
|
274
|
-
base64: Submodule<{
|
|
275
|
-
root: unknown;
|
|
276
|
-
url: unknown;
|
|
277
|
-
}>;
|
|
278
|
-
capitalize: Submodule<capitalize.submodule>;
|
|
279
|
-
creditCard: unknown;
|
|
280
|
-
date: Submodule<stringDate.submodule>;
|
|
281
|
-
digits: unknown;
|
|
282
|
-
email: unknown;
|
|
283
|
-
ip: Submodule<ip.submodule>;
|
|
284
|
-
lower: Submodule<lower.submodule>;
|
|
285
287
|
numeric: Submodule<stringNumeric.submodule>;
|
|
286
288
|
semver: unknown;
|
|
289
|
+
trim: Submodule<trim.submodule>;
|
|
287
290
|
upper: Submodule<upper.submodule>;
|
|
288
291
|
url: Submodule<url.submodule>;
|
|
289
292
|
uuid: Submodule<{
|