arktype 2.0.0-dev.4 → 2.0.0-dev.6

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 (479) hide show
  1. package/__tests__/array.test.ts +176 -236
  2. package/__tests__/badDefinitionType.test.ts +10 -3
  3. package/__tests__/basis.test.ts +6 -2
  4. package/__tests__/bounds.test.ts +282 -352
  5. package/__tests__/cast.test.ts +7 -2
  6. package/__tests__/completions.test.ts +8 -3
  7. package/__tests__/config.test.ts +16 -8
  8. package/__tests__/cyclic.test.ts +141 -137
  9. package/__tests__/dateLiteral.test.ts +8 -4
  10. package/__tests__/declared.test.ts +2 -2
  11. package/__tests__/discrimination.test.ts +1 -1
  12. package/__tests__/divisor.test.ts +45 -25
  13. package/__tests__/enclosed.test.ts +39 -25
  14. package/__tests__/examples.test.ts +56 -56
  15. package/__tests__/expressions.test.ts +184 -112
  16. package/__tests__/generic.test.ts +307 -288
  17. package/__tests__/group.test.ts +67 -54
  18. package/__tests__/imports.test.ts +44 -37
  19. package/__tests__/instanceof.test.ts +17 -15
  20. package/__tests__/intersection.test.ts +50 -46
  21. package/__tests__/keyTraversal.test.ts +6 -3
  22. package/__tests__/keyof.test.ts +68 -52
  23. package/__tests__/keywords.test.ts +149 -136
  24. package/__tests__/literal.test.ts +38 -15
  25. package/__tests__/match.test.ts +234 -224
  26. package/__tests__/morph.test.ts +300 -269
  27. package/__tests__/narrow.test.ts +46 -42
  28. package/__tests__/objectLiteral.test.ts +228 -210
  29. package/__tests__/realWorld.test.ts +63 -0
  30. package/__tests__/regex.test.ts +17 -7
  31. package/__tests__/scope.bench.ts +1 -1
  32. package/__tests__/scope.test.ts +65 -18
  33. package/__tests__/serialization.test.ts +19 -0
  34. package/__tests__/string.test.ts +11 -7
  35. package/__tests__/submodule.test.ts +26 -39
  36. package/__tests__/this.test.ts +83 -57
  37. package/__tests__/thunk.test.ts +13 -7
  38. package/__tests__/traverse.test.ts +50 -37
  39. package/__tests__/tsGenerics.test.ts +12 -12
  40. package/__tests__/type.test.ts +38 -0
  41. package/__tests__/typeReference.test.ts +7 -7
  42. package/__tests__/unenclosed.test.ts +116 -100
  43. package/__tests__/union.test.ts +171 -104
  44. package/ark.ts +18 -65
  45. package/generic.ts +67 -0
  46. package/main.ts +6 -18
  47. package/match.ts +53 -67
  48. package/module.ts +15 -0
  49. package/out/ark.d.ts +12 -36
  50. package/out/ark.d.ts.map +1 -1
  51. package/out/ark.js +9 -17
  52. package/out/ark.js.map +1 -1
  53. package/out/base.d.ts +205 -0
  54. package/out/base.d.ts.map +1 -0
  55. package/out/base.js +320 -0
  56. package/out/base.js.map +1 -0
  57. package/out/builtins/builtins.d.ts +23 -0
  58. package/out/builtins/builtins.d.ts.map +1 -0
  59. package/out/builtins/builtins.js +15 -0
  60. package/out/builtins/builtins.js.map +1 -0
  61. package/out/builtins/jsObjects.d.ts +19 -0
  62. package/out/builtins/jsObjects.d.ts.map +1 -0
  63. package/out/builtins/jsObjects.js +18 -0
  64. package/out/builtins/jsObjects.js.map +1 -0
  65. package/out/builtins/parsing.d.ts +16 -0
  66. package/out/builtins/parsing.d.ts.map +1 -0
  67. package/out/builtins/parsing.js +62 -0
  68. package/out/builtins/parsing.js.map +1 -0
  69. package/out/builtins/tsGenerics.d.ts +2 -0
  70. package/out/builtins/tsGenerics.d.ts.map +1 -0
  71. package/out/builtins/tsGenerics.js +26 -0
  72. package/out/builtins/tsGenerics.js.map +1 -0
  73. package/out/builtins/tsKeywords.d.ts +23 -0
  74. package/out/builtins/tsKeywords.d.ts.map +1 -0
  75. package/out/builtins/tsKeywords.js +23 -0
  76. package/out/builtins/tsKeywords.js.map +1 -0
  77. package/out/builtins/utils/creditCard.d.ts +3 -0
  78. package/out/builtins/utils/creditCard.d.ts.map +1 -0
  79. package/out/builtins/utils/creditCard.js +35 -0
  80. package/out/builtins/utils/creditCard.js.map +1 -0
  81. package/out/builtins/utils/date.d.ts +41 -0
  82. package/out/builtins/utils/date.d.ts.map +1 -0
  83. package/out/builtins/utils/date.js +56 -0
  84. package/out/builtins/utils/date.js.map +1 -0
  85. package/out/builtins/validation.d.ts +19 -0
  86. package/out/builtins/validation.d.ts.map +1 -0
  87. package/out/builtins/validation.js +74 -0
  88. package/out/builtins/validation.js.map +1 -0
  89. package/out/config.d.ts +9 -0
  90. package/out/config.d.ts.map +1 -0
  91. package/out/config.js +18 -0
  92. package/out/config.js.map +1 -0
  93. package/out/constraints/ast.d.ts +287 -0
  94. package/out/constraints/ast.d.ts.map +1 -0
  95. package/out/constraints/ast.js +2 -0
  96. package/out/constraints/ast.js.map +1 -0
  97. package/out/constraints/constraint.d.ts +200 -0
  98. package/out/constraints/constraint.d.ts.map +1 -0
  99. package/out/constraints/constraint.js +25 -0
  100. package/out/constraints/constraint.js.map +1 -0
  101. package/out/constraints/predicate.d.ts +64 -0
  102. package/out/constraints/predicate.d.ts.map +1 -0
  103. package/out/constraints/predicate.js +52 -0
  104. package/out/constraints/predicate.js.map +1 -0
  105. package/out/constraints/props/index.d.ts +42 -0
  106. package/out/constraints/props/index.d.ts.map +1 -0
  107. package/out/constraints/props/index.js +56 -0
  108. package/out/constraints/props/index.js.map +1 -0
  109. package/out/constraints/props/optional.d.ts +37 -0
  110. package/out/constraints/props/optional.d.ts.map +1 -0
  111. package/out/constraints/props/optional.js +56 -0
  112. package/out/constraints/props/optional.js.map +1 -0
  113. package/out/constraints/props/prop.d.ts +49 -0
  114. package/out/constraints/props/prop.d.ts.map +1 -0
  115. package/out/constraints/props/prop.js +106 -0
  116. package/out/constraints/props/prop.js.map +1 -0
  117. package/out/constraints/props/props.d.ts +37 -0
  118. package/out/constraints/props/props.d.ts.map +1 -0
  119. package/out/constraints/props/props.js +121 -0
  120. package/out/constraints/props/props.js.map +1 -0
  121. package/out/constraints/props/required.d.ts +46 -0
  122. package/out/constraints/props/required.d.ts.map +1 -0
  123. package/out/constraints/props/required.js +81 -0
  124. package/out/constraints/props/required.js.map +1 -0
  125. package/out/constraints/props/sequence.d.ts +82 -0
  126. package/out/constraints/props/sequence.d.ts.map +1 -0
  127. package/out/constraints/props/sequence.js +376 -0
  128. package/out/constraints/props/sequence.js.map +1 -0
  129. package/out/constraints/props/shared.d.ts +3 -0
  130. package/out/constraints/props/shared.d.ts.map +1 -0
  131. package/out/constraints/props/shared.js +4 -0
  132. package/out/constraints/props/shared.js.map +1 -0
  133. package/out/constraints/refinements/after.d.ts +33 -0
  134. package/out/constraints/refinements/after.d.ts.map +1 -0
  135. package/out/constraints/refinements/after.js +36 -0
  136. package/out/constraints/refinements/after.js.map +1 -0
  137. package/out/constraints/refinements/before.d.ts +33 -0
  138. package/out/constraints/refinements/before.d.ts.map +1 -0
  139. package/out/constraints/refinements/before.js +43 -0
  140. package/out/constraints/refinements/before.js.map +1 -0
  141. package/out/constraints/refinements/divisor.d.ts +52 -0
  142. package/out/constraints/refinements/divisor.d.ts.map +1 -0
  143. package/out/constraints/refinements/divisor.js +52 -0
  144. package/out/constraints/refinements/divisor.js.map +1 -0
  145. package/out/constraints/refinements/exactLength.d.ts +45 -0
  146. package/out/constraints/refinements/exactLength.d.ts.map +1 -0
  147. package/out/constraints/refinements/exactLength.js +52 -0
  148. package/out/constraints/refinements/exactLength.js.map +1 -0
  149. package/out/constraints/refinements/kinds.d.ts +29 -0
  150. package/out/constraints/refinements/kinds.d.ts.map +1 -0
  151. package/out/constraints/refinements/kinds.js +17 -0
  152. package/out/constraints/refinements/kinds.js.map +1 -0
  153. package/out/constraints/refinements/length.d.ts +48 -0
  154. package/out/constraints/refinements/length.d.ts.map +1 -0
  155. package/out/constraints/refinements/length.js +53 -0
  156. package/out/constraints/refinements/length.js.map +1 -0
  157. package/out/constraints/refinements/max.d.ts +31 -0
  158. package/out/constraints/refinements/max.d.ts.map +1 -0
  159. package/out/constraints/refinements/max.js +35 -0
  160. package/out/constraints/refinements/max.js.map +1 -0
  161. package/out/constraints/refinements/maxLength.d.ts +32 -0
  162. package/out/constraints/refinements/maxLength.d.ts.map +1 -0
  163. package/out/constraints/refinements/maxLength.js +36 -0
  164. package/out/constraints/refinements/maxLength.js.map +1 -0
  165. package/out/constraints/refinements/min.d.ts +31 -0
  166. package/out/constraints/refinements/min.d.ts.map +1 -0
  167. package/out/constraints/refinements/min.js +28 -0
  168. package/out/constraints/refinements/min.js.map +1 -0
  169. package/out/constraints/refinements/minLength.d.ts +32 -0
  170. package/out/constraints/refinements/minLength.d.ts.map +1 -0
  171. package/out/constraints/refinements/minLength.js +33 -0
  172. package/out/constraints/refinements/minLength.js.map +1 -0
  173. package/out/constraints/refinements/range.d.ts +119 -0
  174. package/out/constraints/refinements/range.d.ts.map +1 -0
  175. package/out/constraints/refinements/range.js +89 -0
  176. package/out/constraints/refinements/range.js.map +1 -0
  177. package/out/constraints/refinements/regex.d.ts +47 -0
  178. package/out/constraints/refinements/regex.d.ts.map +1 -0
  179. package/out/constraints/refinements/regex.js +37 -0
  180. package/out/constraints/refinements/regex.js.map +1 -0
  181. package/out/constraints/refinements/shared.d.ts +20 -0
  182. package/out/constraints/refinements/shared.d.ts.map +1 -0
  183. package/out/constraints/refinements/shared.js +10 -0
  184. package/out/constraints/refinements/shared.js.map +1 -0
  185. package/out/generic.d.ts +22 -0
  186. package/out/generic.d.ts.map +1 -0
  187. package/out/generic.js +23 -0
  188. package/out/generic.js.map +1 -0
  189. package/out/inference.d.ts +137 -0
  190. package/out/inference.d.ts.map +1 -0
  191. package/out/inference.js +73 -0
  192. package/out/inference.js.map +1 -0
  193. package/out/keywords/ark.d.ts +70 -0
  194. package/out/keywords/ark.d.ts.map +1 -0
  195. package/out/keywords/ark.js +29 -0
  196. package/out/keywords/ark.js.map +1 -0
  197. package/out/keywords/internal.d.ts +13 -0
  198. package/out/keywords/internal.d.ts.map +1 -0
  199. package/out/keywords/internal.js +13 -0
  200. package/out/keywords/internal.js.map +1 -0
  201. package/out/keywords/jsObject.d.ts +20 -0
  202. package/out/keywords/jsObject.d.ts.map +1 -0
  203. package/out/keywords/jsObject.js +18 -0
  204. package/out/keywords/jsObject.js.map +1 -0
  205. package/out/keywords/parsing.d.ts +17 -0
  206. package/out/keywords/parsing.d.ts.map +1 -0
  207. package/out/keywords/parsing.js +64 -0
  208. package/out/keywords/parsing.js.map +1 -0
  209. package/out/keywords/root.d.ts +7 -0
  210. package/out/keywords/root.d.ts.map +1 -0
  211. package/out/keywords/root.js +4 -0
  212. package/out/keywords/root.js.map +1 -0
  213. package/out/keywords/tsGenerics.d.ts +2 -0
  214. package/out/keywords/tsGenerics.d.ts.map +1 -0
  215. package/out/keywords/tsGenerics.js +26 -0
  216. package/out/keywords/tsGenerics.js.map +1 -0
  217. package/out/keywords/tsPrimitive.d.ts +24 -0
  218. package/out/keywords/tsPrimitive.d.ts.map +1 -0
  219. package/out/keywords/tsPrimitive.js +25 -0
  220. package/out/keywords/tsPrimitive.js.map +1 -0
  221. package/out/keywords/utils/creditCard.d.ts +11 -0
  222. package/out/keywords/utils/creditCard.d.ts.map +1 -0
  223. package/out/keywords/utils/creditCard.js +35 -0
  224. package/out/keywords/utils/creditCard.js.map +1 -0
  225. package/out/keywords/utils/date.d.ts +45 -0
  226. package/out/keywords/utils/date.d.ts.map +1 -0
  227. package/out/keywords/utils/date.js +56 -0
  228. package/out/keywords/utils/date.js.map +1 -0
  229. package/out/keywords/validation.d.ts +20 -0
  230. package/out/keywords/validation.d.ts.map +1 -0
  231. package/out/keywords/validation.js +80 -0
  232. package/out/keywords/validation.js.map +1 -0
  233. package/out/kinds.d.ts +102 -0
  234. package/out/kinds.d.ts.map +1 -0
  235. package/out/kinds.js +29 -0
  236. package/out/kinds.js.map +1 -0
  237. package/out/main.d.ts +6 -6
  238. package/out/main.d.ts.map +1 -1
  239. package/out/main.js +4 -3
  240. package/out/main.js.map +1 -1
  241. package/out/match.d.ts +18 -23
  242. package/out/match.d.ts.map +1 -1
  243. package/out/match.js +3 -4
  244. package/out/match.js.map +1 -1
  245. package/out/module.d.ts +11 -0
  246. package/out/module.d.ts.map +1 -0
  247. package/out/module.js +4 -0
  248. package/out/module.js.map +1 -0
  249. package/out/parse.d.ts +29 -0
  250. package/out/parse.d.ts.map +1 -0
  251. package/out/parse.js +161 -0
  252. package/out/parse.js.map +1 -0
  253. package/out/parser/definition.d.ts +9 -12
  254. package/out/parser/definition.d.ts.map +1 -1
  255. package/out/parser/definition.js +10 -12
  256. package/out/parser/definition.js.map +1 -1
  257. package/out/parser/generic.d.ts +3 -4
  258. package/out/parser/generic.d.ts.map +1 -1
  259. package/out/parser/generic.js +6 -8
  260. package/out/parser/generic.js.map +1 -1
  261. package/out/parser/objectLiteral.d.ts +44 -12
  262. package/out/parser/objectLiteral.d.ts.map +1 -1
  263. package/out/parser/objectLiteral.js +43 -36
  264. package/out/parser/objectLiteral.js.map +1 -1
  265. package/out/parser/semantic/bounds.d.ts +9 -6
  266. package/out/parser/semantic/bounds.d.ts.map +1 -1
  267. package/out/parser/semantic/bounds.js.map +1 -1
  268. package/out/parser/semantic/divisor.d.ts +5 -6
  269. package/out/parser/semantic/divisor.d.ts.map +1 -1
  270. package/out/parser/semantic/infer.d.ts +25 -0
  271. package/out/parser/semantic/infer.d.ts.map +1 -0
  272. package/out/parser/semantic/infer.js +2 -0
  273. package/out/parser/semantic/infer.js.map +1 -0
  274. package/out/parser/semantic/utils.d.ts +3 -6
  275. package/out/parser/semantic/utils.d.ts.map +1 -1
  276. package/out/parser/semantic/validate.d.ts +14 -12
  277. package/out/parser/semantic/validate.d.ts.map +1 -1
  278. package/out/parser/semantic/validate.js +1 -0
  279. package/out/parser/semantic/validate.js.map +1 -1
  280. package/out/parser/string/reduce/dynamic.d.ts +13 -12
  281. package/out/parser/string/reduce/dynamic.d.ts.map +1 -1
  282. package/out/parser/string/reduce/dynamic.js +27 -17
  283. package/out/parser/string/reduce/dynamic.js.map +1 -1
  284. package/out/parser/string/reduce/shared.d.ts +1 -2
  285. package/out/parser/string/reduce/shared.d.ts.map +1 -1
  286. package/out/parser/string/reduce/shared.js.map +1 -1
  287. package/out/parser/string/reduce/static.d.ts +26 -22
  288. package/out/parser/string/reduce/static.d.ts.map +1 -1
  289. package/out/parser/string/shift/operand/date.d.ts +2 -1
  290. package/out/parser/string/shift/operand/date.d.ts.map +1 -1
  291. package/out/parser/string/shift/operand/date.js +2 -2
  292. package/out/parser/string/shift/operand/date.js.map +1 -1
  293. package/out/parser/string/shift/operand/enclosed.d.ts +2 -2
  294. package/out/parser/string/shift/operand/enclosed.d.ts.map +1 -1
  295. package/out/parser/string/shift/operand/enclosed.js +6 -4
  296. package/out/parser/string/shift/operand/enclosed.js.map +1 -1
  297. package/out/parser/string/shift/operand/genericArgs.d.ts +9 -9
  298. package/out/parser/string/shift/operand/genericArgs.d.ts.map +1 -1
  299. package/out/parser/string/shift/operand/genericArgs.js +6 -8
  300. package/out/parser/string/shift/operand/genericArgs.js.map +1 -1
  301. package/out/parser/string/shift/operand/operand.d.ts +3 -3
  302. package/out/parser/string/shift/operand/operand.d.ts.map +1 -1
  303. package/out/parser/string/shift/operand/operand.js +8 -11
  304. package/out/parser/string/shift/operand/operand.js.map +1 -1
  305. package/out/parser/string/shift/operand/unenclosed.d.ts +13 -20
  306. package/out/parser/string/shift/operand/unenclosed.d.ts.map +1 -1
  307. package/out/parser/string/shift/operand/unenclosed.js +21 -26
  308. package/out/parser/string/shift/operand/unenclosed.js.map +1 -1
  309. package/out/parser/string/shift/operator/bounds.d.ts +15 -12
  310. package/out/parser/string/shift/operator/bounds.d.ts.map +1 -1
  311. package/out/parser/string/shift/operator/bounds.js +42 -48
  312. package/out/parser/string/shift/operator/bounds.js.map +1 -1
  313. package/out/parser/string/shift/operator/divisor.d.ts +1 -2
  314. package/out/parser/string/shift/operator/divisor.d.ts.map +1 -1
  315. package/out/parser/string/shift/operator/divisor.js.map +1 -1
  316. package/out/parser/string/shift/operator/operator.d.ts +1 -1
  317. package/out/parser/string/shift/operator/operator.d.ts.map +1 -1
  318. package/out/parser/string/shift/operator/operator.js +12 -18
  319. package/out/parser/string/shift/operator/operator.js.map +1 -1
  320. package/out/parser/string/shift/scanner.d.ts +2 -1
  321. package/out/parser/string/shift/scanner.d.ts.map +1 -1
  322. package/out/parser/string/shift/scanner.js +12 -11
  323. package/out/parser/string/shift/scanner.js.map +1 -1
  324. package/out/parser/string/string.d.ts +8 -5
  325. package/out/parser/string/string.d.ts.map +1 -1
  326. package/out/parser/string/string.js.map +1 -1
  327. package/out/parser/tuple.d.ts +96 -37
  328. package/out/parser/tuple.d.ts.map +1 -1
  329. package/out/parser/tuple.js +61 -66
  330. package/out/parser/tuple.js.map +1 -1
  331. package/out/schema.d.ts +175 -0
  332. package/out/schema.d.ts.map +1 -0
  333. package/out/schema.js +73 -0
  334. package/out/schema.js.map +1 -0
  335. package/out/schemaScope.d.ts +180 -0
  336. package/out/schemaScope.d.ts.map +1 -0
  337. package/out/schemaScope.js +235 -0
  338. package/out/schemaScope.js.map +1 -0
  339. package/out/scope.d.ts +42 -114
  340. package/out/scope.d.ts.map +1 -1
  341. package/out/scope.js +51 -181
  342. package/out/scope.js.map +1 -1
  343. package/out/shared/compile.d.ts +22 -0
  344. package/out/shared/compile.d.ts.map +1 -0
  345. package/out/shared/compile.js +79 -0
  346. package/out/shared/compile.js.map +1 -0
  347. package/out/shared/context.d.ts +54 -0
  348. package/out/shared/context.d.ts.map +1 -0
  349. package/out/shared/context.js +53 -0
  350. package/out/shared/context.js.map +1 -0
  351. package/out/shared/declare.d.ts +69 -0
  352. package/out/shared/declare.d.ts.map +1 -0
  353. package/out/shared/declare.js +2 -0
  354. package/out/shared/declare.js.map +1 -0
  355. package/out/shared/disjoint.d.ts +91 -0
  356. package/out/shared/disjoint.d.ts.map +1 -0
  357. package/out/shared/disjoint.js +110 -0
  358. package/out/shared/disjoint.js.map +1 -0
  359. package/out/shared/errors.d.ts +99 -0
  360. package/out/shared/errors.d.ts.map +1 -0
  361. package/out/shared/errors.js +108 -0
  362. package/out/shared/errors.js.map +1 -0
  363. package/out/shared/implement.d.ts +363 -0
  364. package/out/shared/implement.d.ts.map +1 -0
  365. package/out/shared/implement.js +68 -0
  366. package/out/shared/implement.js.map +1 -0
  367. package/out/shared/inference.d.ts +6 -0
  368. package/out/shared/inference.d.ts.map +1 -0
  369. package/out/shared/inference.js +5 -0
  370. package/out/shared/inference.js.map +1 -0
  371. package/out/shared/intersections.d.ts +60 -0
  372. package/out/shared/intersections.d.ts.map +1 -0
  373. package/out/shared/intersections.js +2 -0
  374. package/out/shared/intersections.js.map +1 -0
  375. package/out/shared/traversal.d.ts +62 -0
  376. package/out/shared/traversal.d.ts.map +1 -0
  377. package/out/shared/traversal.js +97 -0
  378. package/out/shared/traversal.js.map +1 -0
  379. package/out/shared/utils.d.ts +24 -0
  380. package/out/shared/utils.d.ts.map +1 -0
  381. package/out/shared/utils.js +15 -0
  382. package/out/shared/utils.js.map +1 -0
  383. package/out/type.d.ts +23 -59
  384. package/out/type.d.ts.map +1 -1
  385. package/out/type.js +2 -137
  386. package/out/type.js.map +1 -1
  387. package/out/types/basis.d.ts +47 -0
  388. package/out/types/basis.d.ts.map +1 -0
  389. package/out/types/basis.js +15 -0
  390. package/out/types/basis.js.map +1 -0
  391. package/out/types/discriminate.d.ts +34 -0
  392. package/out/types/discriminate.d.ts.map +1 -0
  393. package/out/types/discriminate.js +120 -0
  394. package/out/types/discriminate.js.map +1 -0
  395. package/out/types/domain.d.ts +57 -0
  396. package/out/types/domain.d.ts.map +1 -0
  397. package/out/types/domain.js +41 -0
  398. package/out/types/domain.js.map +1 -0
  399. package/out/types/intersection.d.ts +127 -0
  400. package/out/types/intersection.d.ts.map +1 -0
  401. package/out/types/intersection.js +379 -0
  402. package/out/types/intersection.js.map +1 -0
  403. package/out/types/morph.d.ts +157 -0
  404. package/out/types/morph.d.ts.map +1 -0
  405. package/out/types/morph.js +99 -0
  406. package/out/types/morph.js.map +1 -0
  407. package/out/types/proto.d.ts +51 -0
  408. package/out/types/proto.d.ts.map +1 -0
  409. package/out/types/proto.js +60 -0
  410. package/out/types/proto.js.map +1 -0
  411. package/out/types/type.d.ts +143 -0
  412. package/out/types/type.d.ts.map +1 -0
  413. package/out/types/type.js +123 -0
  414. package/out/types/type.js.map +1 -0
  415. package/out/types/union.d.ts +71 -0
  416. package/out/types/union.d.ts.map +1 -0
  417. package/out/types/union.js +379 -0
  418. package/out/types/union.js.map +1 -0
  419. package/out/types/unit.d.ts +45 -0
  420. package/out/types/unit.d.ts.map +1 -0
  421. package/out/types/unit.js +56 -0
  422. package/out/types/unit.js.map +1 -0
  423. package/out/util.d.ts +30 -18
  424. package/out/util.d.ts.map +1 -1
  425. package/out/util.js +8 -7
  426. package/out/util.js.map +1 -1
  427. package/package.json +7 -3
  428. package/parser/definition.ts +73 -89
  429. package/parser/generic.ts +35 -36
  430. package/parser/objectLiteral.ts +143 -117
  431. package/parser/semantic/bounds.ts +33 -32
  432. package/parser/semantic/divisor.ts +8 -10
  433. package/parser/semantic/infer.ts +141 -0
  434. package/parser/semantic/utils.ts +12 -23
  435. package/parser/semantic/validate.ts +82 -73
  436. package/parser/string/reduce/dynamic.ts +61 -46
  437. package/parser/string/reduce/shared.ts +1 -3
  438. package/parser/string/reduce/static.ts +65 -67
  439. package/parser/string/shift/operand/date.ts +12 -8
  440. package/parser/string/shift/operand/enclosed.ts +22 -17
  441. package/parser/string/shift/operand/genericArgs.ts +46 -45
  442. package/parser/string/shift/operand/operand.ts +32 -38
  443. package/parser/string/shift/operand/unenclosed.ts +106 -147
  444. package/parser/string/shift/operator/bounds.ts +114 -106
  445. package/parser/string/shift/operator/divisor.ts +12 -14
  446. package/parser/string/shift/operator/operator.ts +35 -46
  447. package/parser/string/shift/scanner.ts +49 -46
  448. package/parser/string/string.ts +28 -32
  449. package/parser/tuple.ts +288 -308
  450. package/scope.ts +183 -425
  451. package/type.ts +82 -281
  452. package/__tests__/astUtils.test.ts +0 -17
  453. package/__tests__/jsdoc.test.ts +0 -64
  454. package/__tests__/nodeDefinitions.test.ts +0 -190
  455. package/__tests__/typeMethods.test.ts +0 -69
  456. package/out/arkConfig.d.ts +0 -2
  457. package/out/arkConfig.d.ts.map +0 -1
  458. package/out/arkConfig.js +0 -10
  459. package/out/arkConfig.js.map +0 -1
  460. package/out/parser/semantic/intersections.d.ts +0 -14
  461. package/out/parser/semantic/intersections.d.ts.map +0 -1
  462. package/out/parser/semantic/intersections.js +0 -2
  463. package/out/parser/semantic/intersections.js.map +0 -1
  464. package/out/parser/semantic/semantic.d.ts +0 -32
  465. package/out/parser/semantic/semantic.d.ts.map +0 -1
  466. package/out/parser/semantic/semantic.js +0 -2
  467. package/out/parser/semantic/semantic.js.map +0 -1
  468. package/out/parser/shared.d.ts +0 -62
  469. package/out/parser/shared.d.ts.map +0 -1
  470. package/out/parser/shared.js +0 -56
  471. package/out/parser/shared.js.map +0 -1
  472. package/out/test.d.ts +0 -2
  473. package/out/test.d.ts.map +0 -1
  474. package/out/test.js +0 -7
  475. package/out/test.js.map +0 -1
  476. package/out/tsconfig.build.tsbuildinfo +0 -1
  477. package/parser/semantic/semantic.ts +0 -143
  478. package/parser/shared.ts +0 -170
  479. package/util.ts +0 -36
@@ -0,0 +1,69 @@
1
+ import type { evaluate, merge } from "@arktype/util"
2
+ import type { NarrowedAttachments, Node } from "../base.js"
3
+ import type { reducibleKindOf } from "../kinds.js"
4
+ import type { Disjoint } from "./disjoint.js"
5
+ import type { NodeKind } from "./implement.js"
6
+ export interface BaseMeta {
7
+ readonly description?: string
8
+ }
9
+ export declare const metaKeys: {
10
+ [k in keyof BaseMeta]: 1
11
+ }
12
+ interface DeclarationInput {
13
+ kind: NodeKind
14
+ schema: unknown
15
+ normalizedSchema: BaseMeta
16
+ inner: BaseMeta
17
+ reducibleTo?: NodeKind
18
+ intersectionIsOpen?: true
19
+ errorContext?: object
20
+ prerequisite?: unknown
21
+ childKind?: NodeKind
22
+ }
23
+ export interface BaseErrorContext<kind extends NodeKind = NodeKind> {
24
+ code: kind
25
+ }
26
+ export type defaultErrorContext<d extends DeclarationInput> = evaluate<
27
+ BaseErrorContext<d["kind"]> & d["inner"]
28
+ >
29
+ export type declareNode<
30
+ d extends {
31
+ [k in keyof d]: k extends keyof DeclarationInput
32
+ ? DeclarationInput[k]
33
+ : never
34
+ } & DeclarationInput
35
+ > = merge<
36
+ {
37
+ intersectionIsOpen: false
38
+ prerequisite: prerequisiteOf<d>
39
+ childKind: never
40
+ reducibleTo: d["kind"]
41
+ errorContext: null
42
+ },
43
+ d & {
44
+ errorContext: d["errorContext"] extends {}
45
+ ? BaseErrorContext<d["kind"]>
46
+ : null
47
+ }
48
+ >
49
+ type prerequisiteOf<d extends DeclarationInput> = "prerequisite" extends keyof d
50
+ ? d["prerequisite"]
51
+ : unknown
52
+ export type BaseAttachmentsOf<d extends BaseNodeDeclaration> =
53
+ NarrowedAttachments<d> & d["inner"]
54
+ export type BaseNodeDeclaration = {
55
+ kind: NodeKind
56
+ schema: unknown
57
+ normalizedSchema: BaseMeta
58
+ inner: BaseMeta
59
+ reducibleTo: NodeKind
60
+ prerequisite: any
61
+ intersectionIsOpen: boolean
62
+ childKind: NodeKind
63
+ errorContext: BaseErrorContext | null
64
+ }
65
+ export type ownIntersectionResult<d extends BaseNodeDeclaration> =
66
+ | Node<reducibleKindOf<d["kind"]>>
67
+ | Disjoint
68
+ export {}
69
+ //# sourceMappingURL=declare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../shared/declare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,MAAM,WAAW,QAAQ;IACxB,QA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,IAAI,CAAA;CACP,CACD,CAAA;AAED,KAAK,cAAc,CAAC,CAAC,SAAS,gBAAgB,IAAI,cAAc,SAAS,MAAM,CAAC,GAC7E,CAAC,CAAC,cAAc,CAAC,GACjB,OAAO,CAAA;AAEV,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,IAC1D,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,KAAK,EAAE,QAAQ,CAAA;IACf,WAAW,EAAE,QAAQ,CAAA;IACrB,YAAY,EAAE,GAAG,CAAA;IACjB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,mBAAmB,IAC5D,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAChC,QAAQ,CAAA"}
@@ -0,0 +1,2 @@
1
+ export const metaKeys = { description: 1 }
2
+ //# sourceMappingURL=declare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declare.js","sourceRoot":"","sources":["../../shared/declare.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,QAAQ,GAAiC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAA"}
@@ -0,0 +1,91 @@
1
+ import { type entryOf } from "@arktype/util"
2
+ import type { Node } from "../base.js"
3
+ import type {
4
+ BoundKind,
5
+ IntersectionChildKind,
6
+ kindRightOf
7
+ } from "./implement.js"
8
+ type DisjointKinds = {
9
+ domain?: {
10
+ l: Node<"domain">
11
+ r: Node<"domain">
12
+ }
13
+ unit?: {
14
+ l: Node<"unit">
15
+ r: Node<"unit">
16
+ }
17
+ proto?: {
18
+ l: Node<"proto">
19
+ r: Node<"proto">
20
+ }
21
+ presence?:
22
+ | {
23
+ l: true
24
+ r: false
25
+ }
26
+ | {
27
+ l: false
28
+ r: true
29
+ }
30
+ range?: {
31
+ l: Node<BoundKind>
32
+ r: Node<BoundKind>
33
+ }
34
+ assignability?:
35
+ | {
36
+ l: unknown
37
+ r: Node<IntersectionChildKind>
38
+ }
39
+ | {
40
+ l: Node<IntersectionChildKind>
41
+ r: unknown
42
+ }
43
+ union?: {
44
+ l: readonly Node<kindRightOf<"union">>[]
45
+ r: readonly Node<kindRightOf<"union">>[]
46
+ }
47
+ indiscriminableMorphs?: {
48
+ l: Node<"union">
49
+ r: Node<"union">
50
+ }
51
+ interesectedMorphs?: {
52
+ l: Node<"morph">
53
+ r: Node<"morph">
54
+ }
55
+ }
56
+ export type DisjointKindEntries = entryOf<DisjointKinds>[]
57
+ export type SerializedPath = `[${string}]`
58
+ export type DisjointsSources = {
59
+ [k in `${SerializedPath}`]: DisjointsAtPath
60
+ }
61
+ export type DisjointsAtPath = {
62
+ [kind in DisjointKind]?: DisjointKinds[kind]
63
+ }
64
+ export type DisjointSourceEntry = entryOf<DisjointsSources>
65
+ export type FlatDisjointEntry = {
66
+ path: SerializedPath
67
+ kind: DisjointKind
68
+ disjoint: Required<DisjointKinds>[DisjointKind]
69
+ }
70
+ export type DisjointKind = keyof DisjointKinds
71
+ export declare class Disjoint {
72
+ sources: DisjointsSources
73
+ constructor(sources: DisjointsSources)
74
+ clone(): Disjoint
75
+ static from<kind extends DisjointKind>(
76
+ kind: kind,
77
+ l: Required<DisjointKinds>[kind]["l"],
78
+ r: Required<DisjointKinds>[kind]["r"]
79
+ ): Disjoint
80
+ static fromEntries(entries: DisjointKindEntries): Disjoint
81
+ get flat(): FlatDisjointEntry[]
82
+ describeReasons(): string
83
+ isEmpty(): boolean
84
+ throw(): never
85
+ invert(): Disjoint
86
+ add(input: Disjoint): void
87
+ withPrefixKey(key: string): Disjoint
88
+ toString(): string
89
+ }
90
+ export {}
91
+ //# sourceMappingURL=disjoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disjoint.d.ts","sourceRoot":"","sources":["../../shared/disjoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,KAAK,EACX,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,MAAM,gBAAgB,CAAA;AAEvB,KAAK,aAAa,GAAG;IACpB,MAAM,CAAC,EAAE;QACR,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjB,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;KACjB,CAAA;IACD,IAAI,CAAC,EAAE;QACN,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACf,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;KACf,CAAA;IACD,KAAK,CAAC,EAAE;QACP,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAChB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;KAChB,CAAA;IAED,QAAQ,CAAC,EACN;QACA,CAAC,EAAE,IAAI,CAAA;QACP,CAAC,EAAE,KAAK,CAAA;KACP,GACD;QACA,CAAC,EAAE,KAAK,CAAA;QACR,CAAC,EAAE,IAAI,CAAA;KACN,CAAA;IACJ,KAAK,CAAC,EAAE;QACP,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAClB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;KAClB,CAAA;IACD,aAAa,CAAC,EACX;QACA,CAAC,EAAE,OAAO,CAAA;QACV,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;KAC7B,GACD;QACA,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;QAC9B,CAA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CAAC,IAAI,CAAC,IAAI,SAAS,YAAY,EACpC,IAAI,EAAE,IAAI,EACV,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EACrC,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GACnC,QAAQ;IAWX,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,QAAQ;IAS1D,IAAI,IAAI,IAAI,iBAAiB,EAAE,CAQ9B;IAED,eAAe,IAAI,MAAM;IAqBzB,OAAO,IAAI,OAAO;IAIlB,KAAK,IAAI,KAAK;IAId,MAAM,IAAI,QAAQ;IAclB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAM1B,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;IAYpC,QAAQ,IAAI,MAAM;CAGlB"}
@@ -0,0 +1,110 @@
1
+ import {
2
+ entriesOf,
3
+ flatMorph,
4
+ fromEntries,
5
+ isArray,
6
+ printable,
7
+ throwInternalError,
8
+ throwParseError
9
+ } from "@arktype/util"
10
+ import { hasArkKind } from "../util.js"
11
+ export class Disjoint {
12
+ sources
13
+ constructor(sources) {
14
+ this.sources = sources
15
+ }
16
+ clone() {
17
+ return new Disjoint(this.sources)
18
+ }
19
+ static from(kind, l, r) {
20
+ return new Disjoint({
21
+ "[]": {
22
+ [kind]: {
23
+ l,
24
+ r
25
+ }
26
+ }
27
+ })
28
+ }
29
+ static fromEntries(entries) {
30
+ if (!entries.length) {
31
+ return throwInternalError(
32
+ `Unexpected attempt to create a disjoint from no entries`
33
+ )
34
+ }
35
+ return new Disjoint({ "[]": fromEntries(entries) })
36
+ }
37
+ get flat() {
38
+ return entriesOf(this.sources).flatMap(([path, disjointKinds]) =>
39
+ entriesOf(disjointKinds).map(([kind, disjoint]) => ({
40
+ path,
41
+ kind,
42
+ disjoint
43
+ }))
44
+ )
45
+ }
46
+ describeReasons() {
47
+ const reasons = this.flat
48
+ if (reasons.length === 1) {
49
+ const { path, disjoint } = reasons[0]
50
+ const pathString = JSON.parse(path).join(".")
51
+ return `Intersection${
52
+ pathString && ` at ${pathString}`
53
+ } of ${describeReason(disjoint.l)} and ${describeReason(
54
+ disjoint.r
55
+ )} results in an unsatisfiable type`
56
+ }
57
+ return `The following intersections result in unsatisfiable types:\n• ${reasons
58
+ .map(
59
+ ({ path, disjoint }) =>
60
+ `${path}: ${describeReason(
61
+ disjoint.l
62
+ )} and ${describeReason(disjoint.r)}`
63
+ )
64
+ .join("\n• ")}`
65
+ }
66
+ isEmpty() {
67
+ return this.flat.length === 0
68
+ }
69
+ throw() {
70
+ return throwParseError(this.describeReasons())
71
+ }
72
+ invert() {
73
+ const invertedEntries = entriesOf(this.sources).map(
74
+ ([path, disjoints]) => [
75
+ path,
76
+ flatMorph(disjoints, (kind, disjoint) => [
77
+ kind,
78
+ { l: disjoint.r, r: disjoint.l }
79
+ ])
80
+ ]
81
+ )
82
+ return new Disjoint(fromEntries(invertedEntries))
83
+ }
84
+ add(input) {
85
+ entriesOf(input.sources).forEach(([path, disjoints]) =>
86
+ Object.assign(this.sources[path] ?? {}, disjoints)
87
+ )
88
+ }
89
+ withPrefixKey(key) {
90
+ const entriesWithPrefix = entriesOf(this.sources).map(
91
+ ([path, disjoints]) => {
92
+ const segments = JSON.parse(path)
93
+ segments.unshift(key)
94
+ const pathWithPrefix = JSON.stringify(segments)
95
+ return [pathWithPrefix, disjoints]
96
+ }
97
+ )
98
+ return new Disjoint(fromEntries(entriesWithPrefix))
99
+ }
100
+ toString() {
101
+ return printable(this.sources)
102
+ }
103
+ }
104
+ const describeReason = (value) =>
105
+ hasArkKind(value, "node")
106
+ ? value.expression
107
+ : isArray(value)
108
+ ? value.map(describeReason).join(" | ")
109
+ : String(value)
110
+ //# sourceMappingURL=disjoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disjoint.js","sourceRoot":"","sources":["../../shared/disj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erequisite, errorContext } from "../kinds.js"
8
+ import type { NodeKind } from "./implement.js"
9
+ import type { TraversalContext } from "./traversal.js"
10
+ import { type TraversalPath } from "./utils.js"
11
+ export declare const throwArkError: (
12
+ message?: string | undefined,
13
+ options?: ErrorOptions | undefined
14
+ ) => never
15
+ export declare class ArkError extends TypeError {
16
+ toString(): string
17
+ throw(): never
18
+ }
19
+ export type ArkTypeError<code extends ArkErrorCode = ArkErrorCode> = ArkError &
20
+ ArkErrorContext<code>
21
+ export declare const ArkTypeError: new <
22
+ code extends ArkErrorCode = ArkErrorCode
23
+ >(
24
+ context: ArkErrorContext<code>
25
+ ) => ArkTypeError<code>
26
+ export declare class ArkErrors extends ReadonlyArray<ArkTypeError> {
27
+ protected ctx: TraversalContext
28
+ constructor(ctx: TraversalContext)
29
+ byPath: Record<string, ArkTypeError>
30
+ count: number
31
+ private mutable
32
+ add(error: ArkTypeError): void
33
+ get summary(): string
34
+ toString(): string
35
+ throw(): never
36
+ }
37
+ export declare const createError: (
38
+ ctx: TraversalContext,
39
+ input: ArkErrorInput
40
+ ) => ArkTypeError
41
+ export interface DerivableErrorContext<data = unknown> {
42
+ expected: string
43
+ actual: string | null
44
+ problem: string
45
+ message: string
46
+ data: data
47
+ path: TraversalPath
48
+ propString: string
49
+ }
50
+ export type ArkErrorCode = {
51
+ [kind in NodeKind]: errorContext<kind> extends null ? never : kind
52
+ }[NodeKind]
53
+ export type ArkErrorContext<code extends ArkErrorCode = ArkErrorCode> =
54
+ errorContext<code> & DerivableErrorContext<Prerequisite<code>>
55
+ export type MessageContext<code extends ArkErrorCode = ArkErrorCode> = Omit<
56
+ ArkErrorContext<code>,
57
+ "message"
58
+ >
59
+ export type ProblemContext<code extends ArkErrorCode = ArkErrorCode> = Omit<
60
+ MessageContext<code>,
61
+ "problem"
62
+ >
63
+ type ErrorInputByCode = {
64
+ [code in ArkErrorCode]: optionalizeKeys<
65
+ ArkErrorContext<code>,
66
+ keyof DerivableErrorContext
67
+ >
68
+ }
69
+ export type CustomErrorInput = evaluate<
70
+ {
71
+ code?: undefined
72
+ } & Partial<DerivableErrorContext>
73
+ >
74
+ export type ArkErrorInput =
75
+ | string
76
+ | ErrorInputByCode[ArkErrorCode]
77
+ | CustomErrorInput
78
+ export type ProblemWriter<code extends ArkErrorCode = ArkErrorCode> = (
79
+ context: ProblemContext<code>
80
+ ) => string
81
+ export type MessageWriter<code extends ArkErrorCode = ArkErrorCode> = (
82
+ context: MessageContext<code>
83
+ ) => string
84
+ export type getAssociatedDataForError<code extends ArkErrorCode> =
85
+ code extends NodeKind ? Prerequisite<code> : unknown
86
+ export type ExpectedWriter<code extends ArkErrorCode = ArkErrorCode> = (
87
+ source: errorContext<code>
88
+ ) => string
89
+ export type ActualWriter<code extends ArkErrorCode = ArkErrorCode> = (
90
+ data: getAssociatedDataForError<code>
91
+ ) => string | null
92
+ export type ArkResult<data = unknown, out = data> = propwiseXor<{
93
+ data: data;
94
+ out: out;
95
+ }, {
96
+ errors: ArkErrors;
97
+ }>;
98
+ export {}
99
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../shared/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EAEb,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAEjE,eAAO,MAAM,aAAa,wEAEvB,KAEF,CAAA;AAED,qBAAa,QAAS,SAAQ,SAAS;IACtC,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,KAAK;CAGd;AAED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yB,CAAC,IAAI,CAAC,KACjC,MAAM,GAAG,IAAI,CAAA;AAElB,MAAM,MAAM,SAAS,CAAC,IAAI,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI,IAAI,WAAW,CAC9D;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,EACxB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CACrB,CAAA"}
@@ -0,0 +1,108 @@
1
+ import { ReadonlyArray, hasDefinedKey } from "@arktype/util"
2
+ import { arkKind } from "../util.js"
3
+ import { pathToPropString } from "./utils.js"
4
+ export const throwArkError = (...args) => {
5
+ throw new ArkError(...args)
6
+ }
7
+ export class ArkError extends TypeError {
8
+ toString() {
9
+ return this.message
10
+ }
11
+ throw() {
12
+ throw this
13
+ }
14
+ }
15
+ export const ArkTypeError = class extends ArkError {
16
+ [arkKind] = "error"
17
+ constructor(context) {
18
+ super(context.message)
19
+ Object.assign(this, context)
20
+ }
21
+ }
22
+ export class ArkErrors extends ReadonlyArray {
23
+ ctx
24
+ constructor(ctx) {
25
+ super()
26
+ this.ctx = ctx
27
+ }
28
+ byPath = {}
29
+ count = 0
30
+ mutable = this
31
+ add(error) {
32
+ const pathKey = error.path.join(".")
33
+ const existing = this.byPath[pathKey]
34
+ if (existing) {
35
+ const errorIntersection = createError(this.ctx, {
36
+ code: "intersection",
37
+ errors:
38
+ existing.code === "intersection"
39
+ ? [...existing.errors, error]
40
+ : [existing, error]
41
+ })
42
+ const existingIndex = this.indexOf(existing)
43
+ // If existing is found (which it always should be unless this was externally mutated),
44
+ // replace it with the new problem intersection. In case it isn't for whatever reason,
45
+ // just append the intersection.
46
+ this.mutable[existingIndex === -1 ? this.length : existingIndex] =
47
+ errorIntersection
48
+ this.byPath[pathKey] = errorIntersection
49
+ } else {
50
+ this.byPath[pathKey] = error
51
+ this.mutable.push(error)
52
+ }
53
+ this.count++
54
+ }
55
+ get summary() {
56
+ return this.toString()
57
+ }
58
+ toString() {
59
+ return this.join("\n")
60
+ }
61
+ throw() {
62
+ throw new ArkError(`${this}`, { cause: this })
63
+ }
64
+ }
65
+ export const createError = (ctx, input) => {
66
+ let errCtx
67
+ const data = ctx.data
68
+ const nodeConfig = ctx.config.predicate
69
+ if (typeof input === "string") {
70
+ errCtx = {
71
+ code: "predicate",
72
+ path: [...ctx.path],
73
+ propString: pathToPropString(ctx.path),
74
+ data,
75
+ actual: nodeConfig.actual(data),
76
+ expected: input
77
+ }
78
+ errCtx.problem = nodeConfig.problem(errCtx)
79
+ errCtx.message = nodeConfig.message(errCtx)
80
+ } else {
81
+ const code = input.code ?? "predicate"
82
+ const nodeConfig = ctx.config[code]
83
+ const expected = input.expected ?? nodeConfig.expected?.(input)
84
+ const path = input.path ?? [...ctx.path]
85
+ errCtx = {
86
+ ...input,
87
+ // prioritize these over the raw user provided values so we can
88
+ // check for keys with values like undefined
89
+ code,
90
+ path,
91
+ propString: pathToPropString(path),
92
+ data: "data" in input ? input.data : data,
93
+ actual:
94
+ input.actual !== undefined
95
+ ? input.actual
96
+ : nodeConfig.actual?.(data),
97
+ expected
98
+ }
99
+ errCtx.problem = hasDefinedKey(input, "problem")
100
+ ? input.problem
101
+ : nodeConfig.problem(errCtx)
102
+ errCtx.message = hasDefinedKey(input, "message")
103
+ ? input.message
104
+ : nodeConfig.message(errCtx)
105
+ }
106
+ return new ArkTypeError(errCtx)
107
+ }
108
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../shared/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,aAAa,EAIb,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGpC,OAAO,EAAE,gBAAgB,EAAsB,MAAM,YAAY,CAAA;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,GAAG,IAA4C,EACvC,EAAE;IACV,MAAM,IAAI,QAA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