arktype 2.2.2 → 2.2.3
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/declare.d.ts +2 -2
- package/out/fn.js +10 -6
- package/out/keywords/string.js +1 -1
- package/package.json +4 -4
package/out/declare.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { anyOrNever, array, equals, ErrorMessage, ErrorType, optionalKeyOf, requiredKeyOf, show, unset } from "@ark/util";
|
|
2
|
-
import type { distill } from "./attributes.ts";
|
|
2
|
+
import type { distill, Out } from "./attributes.ts";
|
|
3
3
|
import type { type } from "./keywords/keywords.ts";
|
|
4
4
|
import type { inferDefinition, TerminalObjectDefinition, ThunkCast } from "./parser/definition.ts";
|
|
5
5
|
import type { OptionalPropertyDefinition } from "./parser/property.ts";
|
|
@@ -11,7 +11,7 @@ export type DeclarationParser<$> = <preinferred = unset, ctx extends DeclareCont
|
|
|
11
11
|
preinferred
|
|
12
12
|
] extends [anyOrNever] ? validateDeclared<preinferred, def, $, ctx> : ErrorMessage<`declare<ExternalType>() requires a generic argument`> : validateDeclared<preinferred, def, $, ctx>) => Type<finalizePreinferred<preinferred, def, $, ctx>, $>;
|
|
13
13
|
};
|
|
14
|
-
type finalizePreinferred<preinferred, def, $, ctx extends DeclareContext> = ctx["side"] extends distill.Side ? ctx["side"] extends "in" ? (In: preinferred) => type.infer.Out<def, $> : (In: type.infer.In<def, $>) => preinferred : preinferred;
|
|
14
|
+
type finalizePreinferred<preinferred, def, $, ctx extends DeclareContext> = ctx["side"] extends distill.Side ? ctx["side"] extends "in" ? (In: preinferred) => type.infer.Out<def, $> : (In: type.infer.In<def, $>) => Out<preinferred> : preinferred;
|
|
15
15
|
export type DeclareContext = {
|
|
16
16
|
side?: "in" | "out";
|
|
17
17
|
};
|
package/out/fn.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Callable, throwParseError } from "@ark/util";
|
|
2
2
|
export class InternalFnParser extends Callable {
|
|
3
3
|
constructor($) {
|
|
4
|
-
const
|
|
5
|
-
$: $,
|
|
6
|
-
raw: $.fn
|
|
7
|
-
};
|
|
8
|
-
super((...signature) => {
|
|
4
|
+
const parse = (...signature) => {
|
|
9
5
|
const returnOperatorIndex = signature.indexOf(":");
|
|
10
6
|
const lastParamIndex = returnOperatorIndex === -1 ?
|
|
11
7
|
signature.length - 1
|
|
@@ -19,7 +15,15 @@ export class InternalFnParser extends Callable {
|
|
|
19
15
|
returnType = $.parse(signature[returnOperatorIndex + 1]);
|
|
20
16
|
}
|
|
21
17
|
return (impl) => new InternalTypedFn(impl, paramTuple, returnType);
|
|
22
|
-
}
|
|
18
|
+
};
|
|
19
|
+
// `raw` is an alias of `fn` itself with no type-level validation. It must
|
|
20
|
+
// reference `parse` directly rather than `$.fn`, which is still being
|
|
21
|
+
// constructed (and thus `undefined`) at this point.
|
|
22
|
+
const attach = {
|
|
23
|
+
$: $,
|
|
24
|
+
raw: parse
|
|
25
|
+
};
|
|
26
|
+
super(parse, { attach });
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
export class InternalTypedFn extends Callable {
|
package/out/keywords/string.js
CHANGED
|
@@ -423,7 +423,7 @@ export const uuid = Scope.module({
|
|
|
423
423
|
],
|
|
424
424
|
"#nil": "'00000000-0000-0000-0000-000000000000'",
|
|
425
425
|
"#max": "'ffffffff-ffff-ffff-ffff-ffffffffffff'",
|
|
426
|
-
"#versioned":
|
|
426
|
+
"#versioned": /^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,
|
|
427
427
|
v1: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv1"),
|
|
428
428
|
v2: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv2"),
|
|
429
429
|
v3: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv3"),
|
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.2.
|
|
4
|
+
"version": "2.2.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"out"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ark/util": "0.56.
|
|
42
|
-
"arkregex": "0.0.
|
|
43
|
-
"@ark/schema": "0.56.
|
|
41
|
+
"@ark/util": "0.56.2",
|
|
42
|
+
"arkregex": "0.0.8",
|
|
43
|
+
"@ark/schema": "0.56.2"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|