arktype 2.0.0-rc.2 → 2.0.0-rc.22

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.
Files changed (155) hide show
  1. package/out/attributes.d.ts +274 -0
  2. package/out/attributes.js +2 -0
  3. package/out/config.d.ts +1 -1
  4. package/out/generic.d.ts +52 -55
  5. package/out/generic.js +6 -8
  6. package/out/index.d.ts +4 -4
  7. package/out/index.js +2 -2
  8. package/out/keywords/builtins.js +2 -2
  9. package/out/keywords/constructors/Array.d.ts +2 -2
  10. package/out/keywords/constructors/Array.js +7 -7
  11. package/out/keywords/constructors/Date.d.ts +37 -0
  12. package/out/keywords/constructors/FormData.d.ts +2 -2
  13. package/out/keywords/constructors/FormData.js +8 -8
  14. package/out/keywords/constructors/TypedArray.js +2 -2
  15. package/out/keywords/constructors/constructors.d.ts +0 -1
  16. package/out/keywords/constructors/constructors.js +2 -2
  17. package/out/keywords/keywords.d.ts +64 -0
  18. package/out/keywords/{ark.js → keywords.js} +14 -9
  19. package/out/keywords/number/epoch.d.ts +1 -1
  20. package/out/keywords/number/epoch.js +2 -2
  21. package/out/keywords/number/integer.js +2 -2
  22. package/out/keywords/number/number.d.ts +44 -14
  23. package/out/keywords/number/number.js +17 -5
  24. package/out/keywords/string/alpha.d.ts +2 -2
  25. package/out/keywords/string/alphanumeric.d.ts +2 -2
  26. package/out/keywords/string/base64.d.ts +21 -0
  27. package/out/keywords/string/base64.js +6 -0
  28. package/out/keywords/string/capitalize.d.ts +3 -3
  29. package/out/keywords/string/capitalize.js +4 -4
  30. package/out/keywords/string/creditCard.d.ts +2 -2
  31. package/out/keywords/string/creditCard.js +2 -2
  32. package/out/keywords/string/date.d.ts +7 -11
  33. package/out/keywords/string/date.js +16 -16
  34. package/out/keywords/string/digits.d.ts +2 -2
  35. package/out/keywords/string/email.d.ts +2 -2
  36. package/out/keywords/string/integer.d.ts +3 -3
  37. package/out/keywords/string/integer.js +7 -7
  38. package/out/keywords/string/ip.d.ts +5 -5
  39. package/out/keywords/string/ip.js +5 -5
  40. package/out/keywords/string/json.d.ts +4 -3
  41. package/out/keywords/string/json.js +39 -30
  42. package/out/keywords/string/lower.d.ts +3 -3
  43. package/out/keywords/string/lower.js +4 -4
  44. package/out/keywords/string/normalize.d.ts +27 -31
  45. package/out/keywords/string/normalize.js +14 -14
  46. package/out/keywords/string/numeric.d.ts +3 -3
  47. package/out/keywords/string/numeric.js +7 -7
  48. package/out/keywords/string/semver.d.ts +2 -2
  49. package/out/keywords/string/string.d.ts +74 -51
  50. package/out/keywords/string/string.js +5 -3
  51. package/out/keywords/string/trim.d.ts +3 -3
  52. package/out/keywords/string/trim.js +4 -4
  53. package/out/keywords/string/upper.d.ts +3 -3
  54. package/out/keywords/string/upper.js +4 -4
  55. package/out/keywords/string/url.d.ts +3 -3
  56. package/out/keywords/string/url.js +8 -8
  57. package/out/keywords/string/uuid.d.ts +20 -20
  58. package/out/keywords/string/uuid.js +3 -3
  59. package/out/keywords/ts.d.ts +38 -1
  60. package/out/keywords/ts.js +20 -4
  61. package/out/keywords/utils.d.ts +1 -1
  62. package/out/keywords/utils.js +1 -1
  63. package/out/{subtypes → methods}/array.d.ts +6 -6
  64. package/out/methods/base.d.ts +183 -0
  65. package/out/{subtypes → methods}/date.d.ts +5 -5
  66. package/out/methods/instantiate.d.ts +17 -0
  67. package/out/methods/morph.d.ts +12 -0
  68. package/out/methods/number.d.ts +12 -0
  69. package/out/methods/object.d.ts +106 -0
  70. package/out/methods/string.d.ts +13 -0
  71. package/out/module.d.ts +2 -2
  72. package/out/parser/{semantic → ast}/bounds.d.ts +3 -3
  73. package/out/parser/ast/default.d.ts +8 -0
  74. package/out/parser/ast/infer.d.ts +39 -0
  75. package/out/parser/{semantic → ast}/utils.d.ts +1 -1
  76. package/out/parser/{semantic → ast}/validate.d.ts +10 -10
  77. package/out/parser/ast/validate.js +1 -0
  78. package/out/parser/definition.d.ts +8 -9
  79. package/out/parser/objectLiteral.d.ts +14 -40
  80. package/out/parser/objectLiteral.js +8 -26
  81. package/out/parser/{string/reduce → reduce}/dynamic.d.ts +9 -12
  82. package/out/parser/{string/reduce → reduce}/dynamic.js +5 -6
  83. package/out/parser/{string/reduce → reduce}/shared.d.ts +1 -1
  84. package/out/parser/{string/reduce → reduce}/static.d.ts +4 -4
  85. package/out/parser/{string/shift → shift}/operand/date.d.ts +3 -1
  86. package/out/parser/{string/shift → shift}/operand/enclosed.d.ts +6 -4
  87. package/out/parser/{string/shift → shift}/operand/enclosed.js +7 -3
  88. package/out/parser/shift/operand/operand.d.ts +9 -0
  89. package/out/parser/{string/shift → shift}/operand/operand.js +2 -2
  90. package/out/parser/{string/shift → shift}/operand/unenclosed.d.ts +14 -7
  91. package/out/parser/{string/shift → shift}/operand/unenclosed.js +12 -7
  92. package/out/parser/{string/shift → shift}/operator/bounds.d.ts +7 -7
  93. package/out/parser/shift/operator/brand.d.ts +6 -0
  94. package/out/parser/shift/operator/brand.js +5 -0
  95. package/out/parser/{string/shift → shift}/operator/default.d.ts +3 -6
  96. package/out/parser/{string/shift → shift}/operator/default.js +4 -6
  97. package/out/parser/{string/shift → shift}/operator/divisor.d.ts +2 -2
  98. package/out/parser/shift/operator/operator.d.ts +14 -0
  99. package/out/parser/{string/shift → shift}/operator/operator.js +7 -5
  100. package/out/parser/shift/scanner.d.ts +47 -0
  101. package/out/parser/shift/scanner.js +42 -0
  102. package/out/parser/{string/string.d.ts → string.d.ts} +6 -7
  103. package/out/parser/{string/string.js → string.js} +2 -0
  104. package/out/parser/tuple.d.ts +60 -44
  105. package/out/parser/tuple.js +36 -30
  106. package/out/scope.d.ts +38 -39
  107. package/out/scope.js +47 -36
  108. package/out/type.d.ts +45 -21
  109. package/out/type.js +14 -10
  110. package/package.json +3 -3
  111. package/out/intersect.d.ts +0 -28
  112. package/out/keys.d.ts +0 -16
  113. package/out/keywords/ark.d.ts +0 -39
  114. package/out/keywords/ast.d.ts +0 -193
  115. package/out/keywords/ast.js +0 -2
  116. package/out/parser/semantic/default.d.ts +0 -9
  117. package/out/parser/semantic/default.js +0 -1
  118. package/out/parser/semantic/infer.d.ts +0 -39
  119. package/out/parser/semantic/validate.js +0 -1
  120. package/out/parser/string/shift/operand/operand.d.ts +0 -9
  121. package/out/parser/string/shift/operator/operator.d.ts +0 -13
  122. package/out/parser/string/shift/scanner.d.ts +0 -69
  123. package/out/parser/string/shift/scanner.js +0 -100
  124. package/out/subtypes/base.d.ts +0 -85
  125. package/out/subtypes/instantiate.d.ts +0 -16
  126. package/out/subtypes/morph.d.ts +0 -13
  127. package/out/subtypes/number.d.ts +0 -12
  128. package/out/subtypes/object.d.ts +0 -33
  129. package/out/subtypes/string.d.ts +0 -13
  130. package/out/subtypes/validator.d.ts +0 -11
  131. package/out/subtypes/validator.js +0 -1
  132. /package/out/{intersect.js → keywords/constructors/Date.js} +0 -0
  133. /package/out/{subtypes → methods}/array.js +0 -0
  134. /package/out/{subtypes → methods}/base.js +0 -0
  135. /package/out/{subtypes → methods}/date.js +0 -0
  136. /package/out/{subtypes → methods}/instantiate.js +0 -0
  137. /package/out/{subtypes → methods}/morph.js +0 -0
  138. /package/out/{subtypes → methods}/number.js +0 -0
  139. /package/out/{subtypes → methods}/object.js +0 -0
  140. /package/out/{subtypes → methods}/string.js +0 -0
  141. /package/out/parser/{semantic → ast}/bounds.js +0 -0
  142. /package/out/{keys.js → parser/ast/default.js} +0 -0
  143. /package/out/parser/{semantic → ast}/divisor.d.ts +0 -0
  144. /package/out/parser/{semantic → ast}/divisor.js +0 -0
  145. /package/out/parser/{semantic → ast}/infer.js +0 -0
  146. /package/out/parser/{semantic → ast}/keyof.d.ts +0 -0
  147. /package/out/parser/{semantic → ast}/keyof.js +0 -0
  148. /package/out/parser/{semantic → ast}/utils.js +0 -0
  149. /package/out/parser/{string/reduce → reduce}/shared.js +0 -0
  150. /package/out/parser/{string/reduce → reduce}/static.js +0 -0
  151. /package/out/parser/{string/shift → shift}/operand/date.js +0 -0
  152. /package/out/parser/{string/shift → shift}/operand/genericArgs.d.ts +0 -0
  153. /package/out/parser/{string/shift → shift}/operand/genericArgs.js +0 -0
  154. /package/out/parser/{string/shift → shift}/operator/bounds.js +0 -0
  155. /package/out/parser/{string/shift → shift}/operator/divisor.js +0 -0
@@ -1,33 +0,0 @@
1
- import type { array, ErrorType, merge } from "@ark/util";
2
- import type { arkKeyOf, getArkKey, toArkKey } from "../keys.ts";
3
- import type { type } from "../keywords/ark.ts";
4
- import type { inferTypeRoot, validateTypeRoot } from "../type.ts";
5
- import type { ArrayType } from "./array.ts";
6
- import type { instantiateType } from "./instantiate.ts";
7
- import type { ValidatorType } from "./validator.ts";
8
- /** @ts-ignore cast variance */
9
- interface Type<out t extends object = object, $ = {}> extends ValidatorType<t, $> {
10
- readonly(): t extends array ? ArrayType<{
11
- readonly [i in keyof t]: t[i];
12
- }, $> : Type<{
13
- readonly [k in keyof t]: t[k];
14
- }, $>;
15
- keyof(): instantiateType<keyof t, $>;
16
- get<k1 extends arkKeyOf<t>, r = instantiateType<getArkKey<t, k1>, $>>(k1: k1 | type.cast<k1>): r;
17
- get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>, r = instantiateType<getArkKey<getArkKey<t, k1>, k2>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>): r;
18
- get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>, k3 extends arkKeyOf<getArkKey<getArkKey<t, k1>, k2>>, r = instantiateType<getArkKey<getArkKey<getArkKey<t, k1>, k2>, k3>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>, k3: k3 | type.cast<k3>): r;
19
- pick<const key extends arkKeyOf<t> = never>(...keys: (key | type.cast<key>)[]): Type<{
20
- [k in keyof t as Extract<toArkKey<t, k>, key>]: t[k];
21
- }, $>;
22
- omit<const key extends arkKeyOf<t> = never>(...keys: (key | type.cast<key>)[]): Type<{
23
- [k in keyof t as Exclude<toArkKey<t, k>, key>]: t[k];
24
- }, $>;
25
- merge<const def, r = inferTypeRoot<def, $>>(def: validateTypeRoot<def, $> & (r extends object ? unknown : ErrorType<"Merged type must be an object", [actual: r]>)): Type<merge<t, r & object>, $>;
26
- required(): Type<{
27
- [k in keyof t]-?: t[k];
28
- }, $>;
29
- partial(): Type<{
30
- [k in keyof t]?: t[k];
31
- }, $>;
32
- }
33
- export type { Type as ObjectType };
@@ -1,13 +0,0 @@
1
- import type { ExactLength, ExclusiveNumericRangeSchema, exclusivizeRangeSchema, InclusiveNumericRangeSchema, Pattern } from "@ark/schema";
2
- import type { applyConstraint } from "../keywords/ast.ts";
3
- import type { ValidatorType } from "./validator.ts";
4
- /** @ts-ignore cast variance */
5
- interface Type<out t extends string = string, $ = {}> extends ValidatorType<t, $> {
6
- matching<const schema extends Pattern.Schema>(schema: schema): Type<applyConstraint<t, "pattern", schema>, $>;
7
- atLeastLength<const schema extends InclusiveNumericRangeSchema>(schema: schema): Type<applyConstraint<t, "minLength", schema>, $>;
8
- atMostLength<const schema extends InclusiveNumericRangeSchema>(schema: schema): Type<applyConstraint<t, "maxLength", schema>, $>;
9
- moreThanLength<const schema extends ExclusiveNumericRangeSchema>(schema: schema): Type<applyConstraint<t, "minLength", exclusivizeRangeSchema<schema>>, $>;
10
- lessThanLength<const schema extends ExclusiveNumericRangeSchema>(schema: schema): Type<applyConstraint<t, "maxLength", exclusivizeRangeSchema<schema>>, $>;
11
- exactlyLength<const schema extends ExactLength.Schema>(schema: schema): Type<applyConstraint<t, "exactLength", schema>, $>;
12
- }
13
- export type { Type as StringType };
@@ -1,11 +0,0 @@
1
- import type { Predicate, PredicateCast } from "@ark/schema";
2
- import type { applyConstraint } from "../keywords/ast.ts";
3
- import type { BaseType } from "./base.ts";
4
- import type { instantiateType } from "./instantiate.ts";
5
- /** @ts-ignore cast variance */
6
- interface Type<out t = unknown, $ = {}> extends BaseType<t, $> {
7
- narrow<narrowed extends this["infer"] = never>(predicate: Predicate<this["infer"]> | PredicateCast<this["infer"], narrowed>): instantiateType<[
8
- narrowed
9
- ] extends [never] ? applyConstraint<t, "predicate", Predicate> : narrowed, $>;
10
- }
11
- export type { Type as ValidatorType };
@@ -1 +0,0 @@
1
- export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes