arktype 2.1.25 → 2.1.27
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 +8 -0
- package/out/fn.js +2 -1
- package/out/keywords/string.js +1 -1
- package/out/parser/objectLiteral.js +4 -4
- package/out/parser/reduce/dynamic.js +1 -1
- package/out/parser/shift/operand/date.js +1 -1
- package/out/scope.js +1 -1
- package/out/type.js +1 -1
- package/out/variants/base.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -53,6 +53,7 @@ Otherwise, consider sending me an email (david@arktype.io) or [message me on Dis
|
|
|
53
53
|
<th>get-convex</th>
|
|
54
54
|
<th>inspatiallabs</th>
|
|
55
55
|
<th>sam-goodwin</th>
|
|
56
|
+
<th>mintlify</th>
|
|
56
57
|
</tr>
|
|
57
58
|
<tr>
|
|
58
59
|
<td>
|
|
@@ -76,6 +77,13 @@ Otherwise, consider sending me an email (david@arktype.io) or [message me on Dis
|
|
|
76
77
|
src="https://avatars.githubusercontent.com/sam-goodwin"
|
|
77
78
|
/></a>
|
|
78
79
|
</td>
|
|
80
|
+
<td>
|
|
81
|
+
<a href="https://github.com/mintlify"
|
|
82
|
+
><img
|
|
83
|
+
height="64px"
|
|
84
|
+
src="https://avatars.githubusercontent.com/mintlify"
|
|
85
|
+
/></a>
|
|
86
|
+
</td>
|
|
79
87
|
</tr>
|
|
80
88
|
</table>
|
|
81
89
|
|
package/out/fn.js
CHANGED
|
@@ -42,7 +42,8 @@ export class InternalTypedFn extends Callable {
|
|
|
42
42
|
this.params = params;
|
|
43
43
|
this.returns = returns;
|
|
44
44
|
let argsExpression = params.expression;
|
|
45
|
-
if (argsExpression[0] === "[" &&
|
|
45
|
+
if (argsExpression[0] === "[" &&
|
|
46
|
+
argsExpression[argsExpression.length - 1] === "]")
|
|
46
47
|
argsExpression = argsExpression.slice(1, -1);
|
|
47
48
|
else if (argsExpression.endsWith("[]"))
|
|
48
49
|
argsExpression = `...${argsExpression}`;
|
package/out/keywords/string.js
CHANGED
|
@@ -50,7 +50,7 @@ export const capitalize = Scope.module({
|
|
|
50
50
|
});
|
|
51
51
|
// https://github.com/validatorjs/validator.js/blob/master/src/lib/isLuhnNumber.js
|
|
52
52
|
export const isLuhnValid = (creditCardInput) => {
|
|
53
|
-
const sanitized = creditCardInput.
|
|
53
|
+
const sanitized = creditCardInput.replace(/[ -]+/g, "");
|
|
54
54
|
let sum = 0;
|
|
55
55
|
let digit;
|
|
56
56
|
let tmpNum;
|
|
@@ -91,16 +91,16 @@ const appendNamedProp = (structure, kind, inner, ctx) => {
|
|
|
91
91
|
export const writeInvalidUndeclaredBehaviorMessage = (actual) => `Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${printable(actual)})`;
|
|
92
92
|
export const nonLeadingSpreadError = "Spread operator may only be used as the first key in an object";
|
|
93
93
|
export const preparseKey = (key) => typeof key === "symbol" ? { kind: "required", normalized: key }
|
|
94
|
-
: key.
|
|
95
|
-
key.
|
|
94
|
+
: key[key.length - 1] === "?" ?
|
|
95
|
+
key[key.length - 2] === Backslash ?
|
|
96
96
|
{ kind: "required", normalized: `${key.slice(0, -2)}?` }
|
|
97
97
|
: {
|
|
98
98
|
kind: "optional",
|
|
99
99
|
normalized: key.slice(0, -1)
|
|
100
100
|
}
|
|
101
|
-
: key[0] === "[" && key.
|
|
101
|
+
: key[0] === "[" && key[key.length - 1] === "]" ?
|
|
102
102
|
{ kind: "index", normalized: key.slice(1, -1) }
|
|
103
|
-
: key[0] === Backslash && key[1] === "[" && key.
|
|
103
|
+
: key[0] === Backslash && key[1] === "[" && key[key.length - 1] === "]" ?
|
|
104
104
|
{ kind: "required", normalized: key.slice(1) }
|
|
105
105
|
: key === "..." ? { kind: "spread" }
|
|
106
106
|
: key === "+" ? { kind: "undeclared" }
|
|
@@ -140,7 +140,7 @@ export class RuntimeState {
|
|
|
140
140
|
}
|
|
141
141
|
previousOperator() {
|
|
142
142
|
return (this.branches.leftBound?.comparator ??
|
|
143
|
-
this.branches.prefixes.
|
|
143
|
+
this.branches.prefixes[this.branches.prefixes.length - 1] ??
|
|
144
144
|
(this.branches.intersection ? "&"
|
|
145
145
|
: this.branches.union ? "|"
|
|
146
146
|
: this.branches.pipe ? "|>"
|
|
@@ -2,7 +2,7 @@ import { throwParseError, tryParseNumber } from "@ark/util";
|
|
|
2
2
|
export const isDateLiteral = (value) => typeof value === "string" &&
|
|
3
3
|
value[0] === "d" &&
|
|
4
4
|
(value[1] === "'" || value[1] === '"') &&
|
|
5
|
-
value.
|
|
5
|
+
value[value.length - 1] === value[1];
|
|
6
6
|
export const isValidDate = (d) => d.toString() !== "Invalid Date";
|
|
7
7
|
export const extractDateLiteralSource = (literal) => literal.slice(2, -1);
|
|
8
8
|
export const writeInvalidDateMessage = (source) => `'${source}' could not be parsed by the Date constructor`;
|
package/out/scope.js
CHANGED
|
@@ -29,7 +29,7 @@ export class InternalScope extends BaseScope {
|
|
|
29
29
|
def = [def, "@", config];
|
|
30
30
|
return [alias, def];
|
|
31
31
|
}
|
|
32
|
-
if (alias.
|
|
32
|
+
if (alias[alias.length - 1] !== ">") {
|
|
33
33
|
throwParseError(`'>' must be the last character of a generic declaration in a scope`);
|
|
34
34
|
}
|
|
35
35
|
const name = alias.slice(0, firstParamIndex);
|
package/out/type.js
CHANGED
|
@@ -36,7 +36,7 @@ export class InternalTypeParser extends Callable {
|
|
|
36
36
|
if (args.length === 2 &&
|
|
37
37
|
typeof args[0] === "string" &&
|
|
38
38
|
args[0][0] === "<" &&
|
|
39
|
-
args[0].
|
|
39
|
+
args[0][args[0].length - 1] === ">") {
|
|
40
40
|
// if there are exactly two args, the first of which looks like <${string}>,
|
|
41
41
|
// treat as a generic
|
|
42
42
|
const paramString = args[0].slice(1, -1);
|
package/out/variants/base.d.ts
CHANGED
|
@@ -508,7 +508,7 @@ interface Type<out t = unknown, $ = {}> extends Callable<(data: unknown) => dist
|
|
|
508
508
|
*/
|
|
509
509
|
distribute<mapOut, reduceOut = mapOut[]>(mapBranch: (branch: Type, i: number, branches: array<Type>) => mapOut, reduceMapped?: (mappedBranches: mapOut[]) => reduceOut): reduceOut;
|
|
510
510
|
/** The Type's [StandardSchema](https://github.com/standard-schema/standard-schema) properties */
|
|
511
|
-
"~standard": StandardSchemaV1.ArkTypeProps<this["inferIn"], this["inferOut"]>;
|
|
511
|
+
"~standard": StandardSchemaV1.ArkTypeProps<this["inferIn"] extends infer _ ? _ : never, this["inferOut"] extends infer _ ? _ : never>;
|
|
512
512
|
/** @deprecated */
|
|
513
513
|
apply: Function["apply"];
|
|
514
514
|
/** @deprecated */
|
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.1.
|
|
4
|
+
"version": "2.1.27",
|
|
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.
|
|
42
|
-
"arkregex": "0.0.
|
|
43
|
-
"@ark/schema": "0.
|
|
41
|
+
"@ark/util": "0.55.0",
|
|
42
|
+
"arkregex": "0.0.3",
|
|
43
|
+
"@ark/schema": "0.55.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|