arktype 3.0.0-beta.1 → 3.0.0-rc.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.
Files changed (312) hide show
  1. package/README.md +48 -144
  2. package/out/_internal/regex/charset.d.ts +24 -0
  3. package/out/_internal/regex/escape.d.ts +29 -0
  4. package/out/_internal/regex/execArray.d.ts +24 -0
  5. package/out/_internal/regex/group.d.ts +34 -0
  6. package/out/_internal/regex/index.d.ts +2 -0
  7. package/out/_internal/regex/internal.d.ts +9 -0
  8. package/out/_internal/regex/parse.d.ts +10 -0
  9. package/out/_internal/regex/quantify.d.ts +59 -0
  10. package/out/_internal/regex/regex.d.ts +38 -0
  11. package/out/_internal/regex/state.d.ts +383 -0
  12. package/out/_internal/schema/codecs.d.ts +2 -0
  13. package/out/_internal/schema/config.d.ts +103 -0
  14. package/out/_internal/schema/constraint.d.ts +78 -0
  15. package/out/_internal/schema/errors.d.ts +1 -0
  16. package/out/_internal/schema/generic.d.ts +85 -0
  17. package/out/_internal/schema/i18n.d.ts +3 -0
  18. package/out/_internal/schema/index.d.ts +54 -0
  19. package/out/_internal/schema/internal.d.ts +15 -0
  20. package/out/_internal/schema/intrinsic.d.ts +28 -0
  21. package/out/_internal/schema/kinds.d.ts +76 -0
  22. package/out/_internal/schema/module.d.ts +23 -0
  23. package/out/_internal/schema/mutatesInput.d.ts +2 -0
  24. package/out/_internal/schema/node.d.ts +349 -0
  25. package/out/_internal/schema/parse.d.ts +77 -0
  26. package/out/_internal/schema/parseSchema.d.ts +116 -0
  27. package/out/_internal/schema/predicate.d.ts +46 -0
  28. package/out/_internal/schema/refinements/after.d.ts +32 -0
  29. package/out/_internal/schema/refinements/before.d.ts +32 -0
  30. package/out/_internal/schema/refinements/divisor.d.ts +41 -0
  31. package/out/_internal/schema/refinements/exactLength.d.ts +43 -0
  32. package/out/_internal/schema/refinements/kinds.d.ts +40 -0
  33. package/out/_internal/schema/refinements/max.d.ts +33 -0
  34. package/out/_internal/schema/refinements/maxLength.d.ts +32 -0
  35. package/out/_internal/schema/refinements/min.d.ts +33 -0
  36. package/out/_internal/schema/refinements/minLength.d.ts +32 -0
  37. package/out/_internal/schema/refinements/notEqual.d.ts +38 -0
  38. package/out/_internal/schema/refinements/notEqualLength.d.ts +38 -0
  39. package/out/_internal/schema/refinements/pattern.d.ts +43 -0
  40. package/out/_internal/schema/refinements/range.d.ts +101 -0
  41. package/out/_internal/schema/roots/alias.d.ts +49 -0
  42. package/out/_internal/schema/roots/basis.d.ts +12 -0
  43. package/out/_internal/schema/roots/domain.d.ts +45 -0
  44. package/out/_internal/schema/roots/intersection.d.ts +72 -0
  45. package/out/_internal/schema/roots/morph.d.ts +59 -0
  46. package/out/_internal/schema/roots/proto.d.ts +42 -0
  47. package/out/_internal/schema/roots/root.d.ts +163 -0
  48. package/out/_internal/schema/roots/union.d.ts +146 -0
  49. package/out/_internal/schema/roots/unit.d.ts +36 -0
  50. package/out/_internal/schema/runtime.d.ts +29 -0
  51. package/out/_internal/schema/runtimeLean.d.ts +2 -0
  52. package/out/_internal/schema/runtimeNone.d.ts +2 -0
  53. package/out/_internal/schema/runtimeNoneLean.d.ts +2 -0
  54. package/out/_internal/schema/scope.d.ts +203 -0
  55. package/out/_internal/schema/shared/codecs.d.ts +5 -0
  56. package/out/_internal/schema/shared/compile.d.ts +144 -0
  57. package/out/_internal/schema/shared/configured.d.ts +14 -0
  58. package/out/_internal/schema/shared/declare.d.ts +100 -0
  59. package/out/_internal/schema/shared/disjoint.d.ts +45 -0
  60. package/out/_internal/schema/shared/enWriters.d.ts +30 -0
  61. package/out/_internal/schema/shared/errorModes.d.ts +25 -0
  62. package/out/_internal/schema/shared/errorWriters.d.ts +34 -0
  63. package/out/_internal/schema/shared/errors.d.ts +264 -0
  64. package/out/_internal/schema/shared/implement.d.ts +154 -0
  65. package/out/_internal/schema/shared/inPlace.d.ts +8 -0
  66. package/out/_internal/schema/shared/issueFeatures.d.ts +38 -0
  67. package/out/_internal/schema/shared/issues.d.ts +261 -0
  68. package/out/_internal/schema/shared/issuesLean.d.ts +80 -0
  69. package/out/_internal/schema/shared/issuesNone.d.ts +22 -0
  70. package/out/_internal/schema/shared/issuesNoneLean.d.ts +20 -0
  71. package/out/_internal/schema/shared/issuesUndetailed.d.ts +25 -0
  72. package/out/_internal/schema/shared/jsonSchema.d.ts +153 -0
  73. package/out/_internal/schema/shared/listed.d.ts +15 -0
  74. package/out/_internal/schema/shared/locale.d.ts +149 -0
  75. package/out/_internal/schema/shared/registry.d.ts +16 -0
  76. package/out/_internal/schema/shared/render.d.ts +3 -0
  77. package/out/_internal/schema/shared/rootApply.d.ts +19 -0
  78. package/out/_internal/schema/shared/sets.d.ts +26 -0
  79. package/out/_internal/schema/shared/standardFailure.d.ts +22 -0
  80. package/out/_internal/schema/shared/standardSchema.d.ts +124 -0
  81. package/out/_internal/schema/shared/toJsonSchema.d.ts +229 -0
  82. package/out/_internal/schema/shared/transform.d.ts +35 -0
  83. package/out/_internal/schema/shared/traversal.d.ts +288 -0
  84. package/out/_internal/schema/shared/utils.d.ts +59 -0
  85. package/out/_internal/schema/structure/index.d.ts +43 -0
  86. package/out/_internal/schema/structure/optional.d.ts +61 -0
  87. package/out/_internal/schema/structure/prop.d.ts +45 -0
  88. package/out/_internal/schema/structure/required.d.ts +49 -0
  89. package/out/_internal/schema/structure/sequence.d.ts +127 -0
  90. package/out/_internal/schema/structure/shared.d.ts +3 -0
  91. package/out/_internal/schema/structure/structure.d.ts +178 -0
  92. package/out/_internal/schema/units.d.ts +123 -0
  93. package/out/_internal/sets/algebra.d.ts +26 -0
  94. package/out/_internal/sets/constraint.d.ts +19 -0
  95. package/out/_internal/sets/engine.d.ts +2 -0
  96. package/out/_internal/sets/formats.d.ts +23 -0
  97. package/out/_internal/sets/fromJsonSchema.d.ts +15 -0
  98. package/out/_internal/sets/implement.d.ts +16 -0
  99. package/out/_internal/sets/index.d.ts +2 -0
  100. package/out/_internal/sets/internal.d.ts +20 -0
  101. package/out/_internal/sets/intersections.d.ts +5 -0
  102. package/out/_internal/sets/kinds.d.ts +3 -0
  103. package/out/_internal/sets/refinements.d.ts +14 -0
  104. package/out/_internal/sets/roots/alias.d.ts +3 -0
  105. package/out/_internal/sets/roots/domain.d.ts +3 -0
  106. package/out/_internal/sets/roots/intersection.d.ts +4 -0
  107. package/out/_internal/sets/roots/morph.d.ts +4 -0
  108. package/out/_internal/sets/roots/proto.d.ts +3 -0
  109. package/out/_internal/sets/roots/union.d.ts +16 -0
  110. package/out/_internal/sets/roots/unit.d.ts +3 -0
  111. package/out/_internal/sets/structure/index.d.ts +3 -0
  112. package/out/_internal/sets/structure/prop.d.ts +8 -0
  113. package/out/_internal/sets/structure/sequence.d.ts +3 -0
  114. package/out/_internal/sets/structure/structure.d.ts +3 -0
  115. package/out/_internal/sets/toJsonSchema.d.ts +25 -0
  116. package/out/_internal/util/arrays.d.ts +130 -0
  117. package/out/_internal/util/clone.d.ts +4 -0
  118. package/out/_internal/util/describe.d.ts +25 -0
  119. package/out/_internal/util/domain.d.ts +49 -0
  120. package/out/_internal/util/errors.d.ts +29 -0
  121. package/out/_internal/util/facts.d.ts +22 -0
  122. package/out/_internal/util/flatMorph.d.ts +41 -0
  123. package/out/_internal/util/formats.d.ts +8 -0
  124. package/out/_internal/util/functions.d.ts +33 -0
  125. package/out/_internal/util/generics.d.ts +65 -0
  126. package/out/_internal/util/get.d.ts +9 -0
  127. package/out/_internal/util/hkt.d.ts +27 -0
  128. package/out/_internal/util/i18n.d.ts +12 -0
  129. package/out/_internal/util/index.d.ts +28 -0
  130. package/out/_internal/util/internal.d.ts +2 -0
  131. package/out/_internal/util/intersections.d.ts +50 -0
  132. package/out/_internal/util/isomorphic.d.ts +8 -0
  133. package/out/_internal/util/keys.d.ts +18 -0
  134. package/out/_internal/util/lazily.d.ts +7 -0
  135. package/out/_internal/util/numbers.d.ts +82 -0
  136. package/out/_internal/util/objectKinds.d.ts +157 -0
  137. package/out/_internal/util/path.d.ts +16 -0
  138. package/out/_internal/util/primitive.d.ts +16 -0
  139. package/out/_internal/util/records.d.ts +173 -0
  140. package/out/_internal/util/registry.d.ts +13 -0
  141. package/out/_internal/util/scanner.d.ts +110 -0
  142. package/out/_internal/util/serialize.d.ts +40 -0
  143. package/out/_internal/util/strings.d.ts +35 -0
  144. package/out/_internal/util/traits.d.ts +89 -0
  145. package/out/_internal/util/unionToTuple.d.ts +14 -0
  146. package/out/_internal/util/weak.d.ts +8 -0
  147. package/out/attributes.d.ts +15 -11
  148. package/out/checkers.d.ts +1 -1
  149. package/out/chunk-22RQSVV3.js +0 -0
  150. package/out/chunk-3HZC67MT.js +965 -0
  151. package/out/chunk-3KBOPH3J.js +1564 -0
  152. package/out/chunk-3SH2BQ4T.js +15 -0
  153. package/out/chunk-46PLKNON.js +126 -0
  154. package/out/{chunk-G45P2CLE.js → chunk-4FTHWK63.js} +6 -1
  155. package/out/{chunk-UK5UGFOX.js → chunk-4HREHNIV.js} +23 -11
  156. package/out/chunk-4NZCLVBD.js +14 -0
  157. package/out/chunk-6FMBO47M.js +7 -0
  158. package/out/chunk-7TALAWYX.js +10 -0
  159. package/out/{chunk-DLWCO4RV.js → chunk-BCYKO54Z.js} +11 -2
  160. package/out/chunk-BDJVONP7.js +168 -0
  161. package/out/{chunk-E3DZXEZK.js → chunk-C2JOL5M2.js} +4 -2
  162. package/out/{chunk-2U2AWCI3.js → chunk-C2V6QPE3.js} +126 -97
  163. package/out/chunk-C3B4IFQL.js +6408 -0
  164. package/out/chunk-CWSF57VM.js +10 -0
  165. package/out/chunk-F5BACUJS.js +7 -0
  166. package/out/{chunk-EVCML554.js → chunk-FWRSDUJ2.js} +14 -5
  167. package/out/chunk-GID3FSQA.js +161 -0
  168. package/out/chunk-I2KLQ2HA.js +22 -0
  169. package/out/chunk-K7SLP5D2.js +84 -0
  170. package/out/chunk-KQPSKGUI.js +9 -0
  171. package/out/chunk-KXOC3JEX.js +8234 -0
  172. package/out/chunk-KXOSUYRA.js +405 -0
  173. package/out/chunk-LHNEY6QW.js +0 -0
  174. package/out/chunk-MTWKGAGO.js +323 -0
  175. package/out/chunk-NU73GNCX.js +170 -0
  176. package/out/{chunk-RAZ3TXOE.js → chunk-P5W67FQH.js} +34 -19
  177. package/out/chunk-PDLTEX6Z.js +1118 -0
  178. package/out/{chunk-VV6YDN2D.js → chunk-QUS4IAXJ.js} +304 -263
  179. package/out/chunk-R7WXIH5P.js +94 -0
  180. package/out/chunk-TACLEIDM.js +95 -0
  181. package/out/chunk-UJJGG4VQ.js +71 -0
  182. package/out/chunk-US6BWOGJ.js +109 -0
  183. package/out/chunk-VMMMOO4R.js +945 -0
  184. package/out/chunk-VYMXHSFR.js +439 -0
  185. package/out/chunk-W2XOI5DY.js +141 -0
  186. package/out/chunk-WC5L5YRP.js +25 -0
  187. package/out/{chunk-NRIGTMPM.js → chunk-WKOSL2G6.js} +4 -1
  188. package/out/chunk-XLG66ZDF.js +0 -0
  189. package/out/{chunk-5U2ZMDNI.js → chunk-XNUAQSJ4.js} +52 -30
  190. package/out/chunk-ZRYEHGSG.js +79 -0
  191. package/out/cli.d.ts +28 -0
  192. package/out/cli.js +636 -0
  193. package/out/codecs.d.ts +6 -5
  194. package/out/codecs.js +23 -7
  195. package/out/config.d.ts +5 -17
  196. package/out/config.js +11 -2
  197. package/out/declare.d.ts +40 -12
  198. package/out/deferred.d.ts +2 -2
  199. package/out/errors.d.ts +1 -1
  200. package/out/errors.js +10 -2
  201. package/out/fn.d.ts +20 -13
  202. package/out/fromJsonSchema.d.ts +18 -0
  203. package/out/generic.d.ts +9 -6
  204. package/out/i18n.d.ts +2 -2
  205. package/out/i18n.js +9 -2
  206. package/out/index.d.ts +16 -7
  207. package/out/index.js +25 -8
  208. package/out/internal.d.ts +4 -0
  209. package/out/internal.js +41 -17
  210. package/out/island.js +22 -6
  211. package/out/islandDependency.js +42 -18
  212. package/out/jsonSchema/infer.d.ts +805 -0
  213. package/out/jsonSchema/validate.d.ts +416 -0
  214. package/out/keywords/Array.d.ts +2 -2
  215. package/out/keywords/builtins.d.ts +3 -3
  216. package/out/keywords/constructors.d.ts +1 -1
  217. package/out/keywords/functions.d.ts +5 -192
  218. package/out/keywords/keywords.d.ts +3 -3
  219. package/out/keywords/number.d.ts +2 -2
  220. package/out/keywords/phrases.d.ts +4 -191
  221. package/out/keywords/string.d.ts +3 -3
  222. package/out/keywords/ts.d.ts +18 -18
  223. package/out/keywords/ts.js +19 -4
  224. package/out/locale.d.ts +6 -2
  225. package/out/locales/de.js +9 -2
  226. package/out/locales/en.js +21 -5
  227. package/out/match.d.ts +13 -10
  228. package/out/module.d.ts +2 -2
  229. package/out/mutatesInput.js +18 -3
  230. package/out/nary.d.ts +220 -194
  231. package/out/parser/ast/bounds.d.ts +2 -2
  232. package/out/parser/ast/default.d.ts +2 -2
  233. package/out/parser/ast/divisor.d.ts +2 -2
  234. package/out/parser/ast/generic.d.ts +2 -2
  235. package/out/parser/ast/infer.d.ts +1 -1
  236. package/out/parser/ast/keyof.d.ts +2 -2
  237. package/out/parser/ast/utils.d.ts +1 -1
  238. package/out/parser/ast/validate.d.ts +2 -2
  239. package/out/parser/definition.d.ts +4 -4
  240. package/out/parser/objectLiteral.d.ts +2 -2
  241. package/out/parser/property.d.ts +2 -2
  242. package/out/parser/reduce/dynamic.d.ts +2 -2
  243. package/out/parser/reduce/shared.d.ts +1 -1
  244. package/out/parser/reduce/static.d.ts +1 -1
  245. package/out/parser/shift/operand/enclosed.d.ts +2 -2
  246. package/out/parser/shift/operand/genericArgs.d.ts +2 -2
  247. package/out/parser/shift/operand/operand.d.ts +1 -1
  248. package/out/parser/shift/operand/unenclosed.d.ts +2 -2
  249. package/out/parser/shift/operand/unresolvable.d.ts +2 -2
  250. package/out/parser/shift/operator/bounds.d.ts +2 -2
  251. package/out/parser/shift/operator/brand.d.ts +2 -2
  252. package/out/parser/shift/operator/default.d.ts +4 -4
  253. package/out/parser/shift/operator/divisor.d.ts +1 -1
  254. package/out/parser/shift/operator/operator.d.ts +1 -1
  255. package/out/parser/shift/tokens.d.ts +1 -1
  256. package/out/parser/string.d.ts +2 -2
  257. package/out/parser/tupleExpressions.d.ts +6 -8
  258. package/out/parser/tupleLiteral.d.ts +2 -2
  259. package/out/precompiled.d.ts +1 -1
  260. package/out/precompiled.js +16 -2
  261. package/out/regex.d.ts +1 -0
  262. package/out/regex.js +2 -0
  263. package/out/runtime.d.ts +10 -8
  264. package/out/runtime.js +6 -4
  265. package/out/runtimeDevelopment.js +70 -52
  266. package/out/schema.d.ts +1 -0
  267. package/out/schema.js +15 -0
  268. package/out/schemaInternal.d.ts +1 -0
  269. package/out/schemaInternal.js +1401 -0
  270. package/out/schemaIssueFeatures.d.ts +1 -0
  271. package/out/schemaRuntime.d.ts +1 -0
  272. package/out/schemaRuntime.js +7 -0
  273. package/out/schemaRuntimeLean.d.ts +1 -0
  274. package/out/schemaRuntimeLean.js +1870 -0
  275. package/out/schemaRuntimeNone.d.ts +1 -0
  276. package/out/schemaRuntimeNone.js +1774 -0
  277. package/out/schemaRuntimeNoneLean.d.ts +1 -0
  278. package/out/schemaRuntimeNoneLean.js +1767 -0
  279. package/out/scope.d.ts +3 -4
  280. package/out/shared/issueFeatures.d.ts +38 -0
  281. package/out/shared/issueFeatures.js +40 -0
  282. package/out/standalone/artifact.d.ts +6 -6
  283. package/out/standalone/baking.d.ts +2 -2
  284. package/out/standalone/combinators.d.ts +1 -1
  285. package/out/standalone/compilers.d.ts +1 -1
  286. package/out/standalone/fallbacks.d.ts +1 -1
  287. package/out/standalone/keys.d.ts +1 -1
  288. package/out/standalone/sites.d.ts +3 -3
  289. package/out/standalone/units.d.ts +1 -1
  290. package/out/standalone/values.d.ts +1 -1
  291. package/out/type.d.ts +6 -6
  292. package/out/util.d.ts +1 -0
  293. package/out/util.js +137 -0
  294. package/out/variants/array.d.ts +6 -6
  295. package/out/variants/base.d.ts +61 -10
  296. package/out/variants/date.d.ts +5 -5
  297. package/out/variants/instantiate.d.ts +1 -1
  298. package/out/variants/number.d.ts +6 -6
  299. package/out/variants/object.d.ts +25 -12
  300. package/out/variants/string.d.ts +8 -8
  301. package/package.json +183 -8
  302. package/skills/arktype/SKILL.md +93 -93
  303. package/skills/arktype/references/migrating.md +144 -158
  304. package/skills/arktype/references/precompile.md +7 -7
  305. package/out/chunk-4CUA5XIP.js +0 -7
  306. package/out/chunk-GPNK5353.js +0 -2529
  307. package/out/chunk-MLKGABMK.js +0 -9
  308. package/out/chunk-PRTMQCHS.js +0 -3
  309. package/out/chunk-R5G57XC7.js +0 -7
  310. package/out/chunk-SWOOCAHN.js +0 -4
  311. package/out/chunk-TAHPKDNM.js +0 -3
  312. package/out/chunk-UETB6YE2.js +0 -14
@@ -0,0 +1,127 @@
1
+ import { type array, type satisfy } from "../../util/index.js";
2
+ import { BaseConstraint } from "../constraint.ts";
3
+ import { type BaseNode, type DeepNodeTransformContext, type DeepNodeTransformation } from "../node.ts";
4
+ import type { ExactLengthNode } from "../refinements/exactLength.ts";
5
+ import type { MaxLengthNode } from "../refinements/maxLength.ts";
6
+ import type { MinLengthNode } from "../refinements/minLength.ts";
7
+ import type { Morph } from "../roots/morph.ts";
8
+ import type { BaseRoot } from "../roots/root.ts";
9
+ import type { NodeCompiler } from "../shared/compile.ts";
10
+ import type { declareNode } from "../shared/declare.ts";
11
+ import { type RootKind, type nodeImplementationOf } from "../shared/implement.ts";
12
+ import { type AliasDepth, type InternalTraversal } from "../shared/traversal.ts";
13
+ export declare namespace Sequence {
14
+ type DefaultableElement = [node: BaseRoot, defaultValue: unknown];
15
+ interface Inner {
16
+ readonly prefix?: array<BaseRoot>;
17
+ readonly defaultables?: array<DefaultableElement>;
18
+ readonly optionals?: array<BaseRoot>;
19
+ readonly variadic?: BaseRoot;
20
+ readonly minVariadicLength?: number;
21
+ readonly postfix?: array<BaseRoot>;
22
+ }
23
+ interface Declaration extends declareNode<{
24
+ kind: "sequence";
25
+ inner: Inner;
26
+ prerequisite: array;
27
+ reducibleTo: "sequence";
28
+ childKind: RootKind;
29
+ }> {
30
+ }
31
+ type Node = SequenceNode;
32
+ }
33
+ export declare class SequenceNode extends BaseConstraint<Sequence.Declaration> {
34
+ constructor(...args: ConstructorParameters<typeof BaseConstraint>);
35
+ get implied(): BaseRoot;
36
+ tuple: SequenceTuple;
37
+ /** how many prefix elements it has */
38
+ preLen: number;
39
+ /** how many defaultable elements it has */
40
+ defLen: number;
41
+ /** how many postfix elements it has */
42
+ postLen: number;
43
+ /** its defaultable and optional elements, in order */
44
+ maybes: BaseRoot[];
45
+ /** its elements before its variadic element, with their kinds */
46
+ leading: array<PrevariadicSequenceElement>;
47
+ /** its variadic element, if any, then its postfix elements */
48
+ trail: array<BaseRoot>;
49
+ protected initFlat(): void;
50
+ isVariadicOnly: boolean;
51
+ minVariadicLength: number;
52
+ minLength: number;
53
+ /** the minLength node its length implies, if any */
54
+ minNode: MinLengthNode | null;
55
+ maxLength: number | null;
56
+ /** the maxLength or exactLength node its length implies, if any */
57
+ maxNode: MaxLengthNode | ExactLengthNode | null;
58
+ impliedBy: array<MaxLengthNode | MinLengthNode | ExactLengthNode>;
59
+ /** whether its optional and defaultable elements allow undefined, without exactOptionalPropertyTypes */
60
+ get isLoose(): boolean;
61
+ /** whether its defaults replace undefined too, as they do without exactOptionalPropertyTypes */
62
+ get defaultsUndefined(): boolean;
63
+ /**
64
+ * an optional or defaultable element where it's required, which without
65
+ * exactOptionalPropertyTypes drops the undefined it allowed, as TS's `-?`
66
+ * does
67
+ */
68
+ requiredOf(element: BaseRoot): BaseRoot;
69
+ /** whether data has a value at `index`, a defaultable element's index, which its default leaves alone */
70
+ holdsElement(data: array, index: number): boolean;
71
+ /** writes whether data has a value at `index`, which its default leaves alone if it's `defaultable` */
72
+ jsHoldsElement(defaultable: boolean, index: string | number): string;
73
+ /** the morphs writing its elements' defaults */
74
+ defMorphs: Morph[];
75
+ optionalize(): SequenceNode;
76
+ require(): SequenceNode;
77
+ /** the element that checks `data[index]` */
78
+ protected atIndex(data: array, index: number): SequenceElement;
79
+ tAllows(data: array, ctx: InternalTraversal | AliasDepth): boolean;
80
+ tApply(data: array, ctx: InternalTraversal): void;
81
+ private _element;
82
+ get element(): BaseRoot;
83
+ tTransform(data: array, ctx: InternalTraversal): unknown;
84
+ /** transforms data's elements, into the copy before the first change or, without one, in place */
85
+ tfElems(data: array, ctx: InternalTraversal, copy: ((data: array) => object) | undefined): array;
86
+ compile(js: NodeCompiler): void;
87
+ private jsTf;
88
+ /** writes the transforms of data's elements, into `copy` before the first change or, without one, in place */
89
+ jsElemTfs(js: NodeCompiler, copy: string | undefined): NodeCompiler;
90
+ /** writes the checks of data's elements */
91
+ private jsElements;
92
+ protected _tf(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseNode | null;
93
+ get expression(): string;
94
+ }
95
+ export declare const Sequence: {
96
+ impl: nodeImplementationOf<Sequence.Declaration>;
97
+ Node: typeof SequenceNode;
98
+ };
99
+ export declare const postfixAfterOptionalOrDefaultableMessage = "A postfix required element cannot follow an optional or defaultable element";
100
+ export type postfixAfterOptionalOrDefaultableMessage = typeof postfixAfterOptionalOrDefaultableMessage;
101
+ export declare const postfixWithoutVariadicMessage = "A postfix element requires a variadic element";
102
+ export type postfixWithoutVariadicMessage = typeof postfixWithoutVariadicMessage;
103
+ export type SequenceElement = PrevariadicSequenceElement | VariadicSequenceElement | PostfixSequenceElement;
104
+ export type SequenceElementKind = satisfy<keyof Sequence.Inner, SequenceElement["kind"]>;
105
+ export type PrevariadicSequenceElement = PrefixSequenceElement | DefaultableSequenceElement | OptionalSequenceElement;
106
+ export type PrefixSequenceElement = {
107
+ kind: "prefix";
108
+ node: BaseRoot;
109
+ };
110
+ export type OptionalSequenceElement = {
111
+ kind: "optionals";
112
+ node: BaseRoot;
113
+ };
114
+ export type PostfixSequenceElement = {
115
+ kind: "postfix";
116
+ node: BaseRoot;
117
+ };
118
+ export type VariadicSequenceElement = {
119
+ kind: "variadic";
120
+ node: BaseRoot;
121
+ };
122
+ export type DefaultableSequenceElement = {
123
+ kind: "defaultables";
124
+ node: BaseRoot;
125
+ default: unknown;
126
+ };
127
+ export type SequenceTuple = array<SequenceElement>;
@@ -0,0 +1,3 @@
1
+ export declare const arrayIndexSource = "^(?:0|[1-9]\\d*)$";
2
+ export declare const arrayIndexMatcher: RegExp;
3
+ export declare const maxArrayLength = 4294967295;
@@ -0,0 +1,178 @@
1
+ import { type array, type describe, type Key, type listable, type mutable } from "../../util/index.js";
2
+ import { BaseConstraint } from "../constraint.ts";
3
+ import { type GettableKeyOrNode, type KeyOrKeyNode } from "../node.ts";
4
+ import type { Morph } from "../roots/morph.ts";
5
+ import { type BaseRoot } from "../roots/root.ts";
6
+ import type { BaseScope } from "../scope.ts";
7
+ import type { NodeCompiler, TransformStep } from "../shared/compile.ts";
8
+ import type { BaseErrorContext, BaseNodeInput, declareNode } from "../shared/declare.ts";
9
+ import { type nodeImplementationOf, type StructuralKind } from "../shared/implement.ts";
10
+ import { TransformErrors } from "../shared/transform.ts";
11
+ import type { FailureSite } from "../shared/issues.ts";
12
+ import { type AliasDepth, type InternalTraversal, type TraversalKind } from "../shared/traversal.ts";
13
+ import { makeRootAndArrayPropertiesMutable } from "../shared/utils.ts";
14
+ import type { Index } from "./index.ts";
15
+ import { Optional } from "./optional.ts";
16
+ import type { Prop } from "./prop.ts";
17
+ import type { Required } from "./required.ts";
18
+ import type { Sequence } from "./sequence.ts";
19
+ /**
20
+ * - `"ignore"` (default) - allow and preserve extra properties
21
+ * - `"reject"` - disallow extra string keys
22
+ * - `"delete"` - output only declared keys
23
+ */
24
+ export type UndeclaredKeyBehavior = "ignore" | UndeclaredKeyHandling;
25
+ export type UndeclaredKeyHandling = "reject" | "delete";
26
+ export interface UndeclaredErrorContext extends BaseErrorContext<"undeclared"> {
27
+ /** the undeclared key's value */
28
+ readonly data: unknown;
29
+ }
30
+ export declare namespace Structure {
31
+ interface Inner {
32
+ readonly optional?: readonly Optional.Node[];
33
+ readonly required?: readonly Required.Node[];
34
+ readonly index?: readonly Index.Node[];
35
+ readonly sequence?: Sequence.Node;
36
+ readonly undeclared?: UndeclaredKeyBehavior;
37
+ /**
38
+ * the order an object built as output lists its declared keys in.
39
+ * keys it doesn't list follow in canonical order, required first
40
+ */
41
+ readonly order?: readonly Key[];
42
+ }
43
+ namespace Inner {
44
+ type mutable = makeRootAndArrayPropertiesMutable<Inner>;
45
+ }
46
+ interface Input extends Inner, BaseNodeInput {
47
+ }
48
+ interface Declaration extends declareNode<{
49
+ kind: "structure";
50
+ inner: Inner;
51
+ prerequisite: object;
52
+ childKind: StructuralKind;
53
+ }> {
54
+ }
55
+ type Node = StructureNode;
56
+ }
57
+ export declare class StructureNode extends BaseConstraint<Structure.Declaration> {
58
+ constructor(...args: ConstructorParameters<typeof BaseConstraint>);
59
+ sameInner(r: StructureNode): boolean | undefined;
60
+ /** how undeclared keys are constrained, if they are */
61
+ get handlesUndeclared(): UndeclaredKeyHandling | undefined;
62
+ protected get ctxSel(): boolean;
63
+ implied: BaseRoot;
64
+ impliedBy: array<BaseConstraint>;
65
+ props: array<Prop.Node>;
66
+ private _orderedProps;
67
+ /** its props in the order they're checked and an output lists them */
68
+ get inOrder(): array<Prop.Node>;
69
+ /** the keys of its props in the order an output lists them */
70
+ get keyOrder(): Key[];
71
+ get resultLayout(): [literal: array<Prop.Node>, added: array<Prop.Node>];
72
+ get failSite(): FailureSite;
73
+ private _allowsProps;
74
+ get allowsProps(): array<Prop.Node>;
75
+ private _byKey;
76
+ /** its props, keyed by key */
77
+ get byKey(): Record<Key, Prop.Node | undefined>;
78
+ get expression(): string;
79
+ get requiredKeys(): Key[];
80
+ get literalKeys(): Key[];
81
+ _keyof: BaseRoot | undefined;
82
+ keyof(): BaseRoot;
83
+ map(flatMapProp: PropFlatMapper): StructureNode;
84
+ assertHasKeys(keys: array<KeyOrKeyNode>): void;
85
+ get(indexer: GettableKeyOrNode, ...path: array<GettableKeyOrNode>): BaseRoot;
86
+ pick(...keys: KeyOrKeyNode[]): StructureNode;
87
+ omit(...keys: KeyOrKeyNode[]): StructureNode;
88
+ optionalize(): StructureNode;
89
+ require(): StructureNode;
90
+ merge(r: StructureNode): StructureNode;
91
+ private withoutKeysOf;
92
+ private filterKeys;
93
+ tAllows(data: object, ctx: InternalTraversal | AliasDepth): boolean;
94
+ tApply(data: object, ctx: InternalTraversal): void;
95
+ protected _traverse(trav: TraversalKind, data: object, ctx: InternalTraversal, transformsKeys?: boolean): boolean;
96
+ tTransform(data: object, ctx: InternalTraversal): unknown;
97
+ get sharesTfs(): boolean;
98
+ applySharedKeys(data: object, ctx: InternalTraversal): boolean;
99
+ /** transforms a key's value through each constraint transforming it: its prop or the index signatures it matches */
100
+ private tfSharedKey;
101
+ /** applies its defaults and structural morphs to data, writing into `out` */
102
+ applyStructMorph(data: object, out: object, ctx: InternalTraversal | undefined): object | TransformErrors;
103
+ private writesInto;
104
+ private copy;
105
+ /** its props whose key `Object.prototype` has, which data can inherit */
106
+ readonly protoProps: Prop.Node[];
107
+ private _hasIndexedProp;
108
+ get hasIndexedProp(): boolean;
109
+ private _tfsByKey;
110
+ /** the steps transforming prop's value, shared by the constraints transforming its key */
111
+ tfsOf(prop: Prop.Node): TransformStep[];
112
+ readonly defaultable: Optional.Node.withDefault[];
113
+ declaresKey: (k: Key) => boolean;
114
+ /** writes whether `k` is a declared key */
115
+ _jsDeclaresKey(js: NodeCompiler): string;
116
+ get slicesSeq(): boolean;
117
+ /** the morph it applies to data as a whole, like deleting undeclared keys */
118
+ readonly structMorph: Morph | undefined;
119
+ compile(js: NodeCompiler): unknown;
120
+ get countsKeys(): boolean;
121
+ /** writes `onCount` for a plain object whose key count is that of the declared keys it holds */
122
+ private jsKeyCount;
123
+ private propsOf;
124
+ /** writes its check as one condition: with nothing to loop over, it holds while each child does */
125
+ jsConjunction(js: NodeCompiler): string | undefined;
126
+ /** writes its Transform */
127
+ private jsTf;
128
+ /** writes the copy of a plain object missing every default, its only changes, once */
129
+ private jsCopyOnce;
130
+ /** writes the defaults of its missing keys */
131
+ private jsDefaults;
132
+ /** writes `out`, which a transform writes into: data at the first site and where it writes in place */
133
+ private jsCopy;
134
+ /** writes the check of data's shape, reading a required key first; copyOf handles data without it */
135
+ jsShapeCheck(js: NodeCompiler): string;
136
+ /** writes the copy of data's declared keys, those in `written` aside */
137
+ jsDeclaredCopy(js: NodeCompiler, written?: Key[]): NodeCompiler;
138
+ /** writes the copy of data's props: an array's copy has only its enumerable props */
139
+ private jsCopyProps;
140
+ /** writes the defaults of a sequence's missing elements */
141
+ private jsSequenceDefaults;
142
+ /** writes the deletion of undeclared keys from a copy of data, after its transforms and defaults */
143
+ private jsDeleteFromCopy;
144
+ /** writes the deletion of undeclared keys: from a copy where data has them, else into a literal of the declared ones */
145
+ private jsDeleteTransform;
146
+ private get indexSyms();
147
+ /** writes a loop of `k` over the own keys of `object` */
148
+ private jsForOwnKeys;
149
+ /** writes the check of one of data's entries */
150
+ protected jsEntry(js: NodeCompiler, keyDomain: "string" | "symbol"): NodeCompiler;
151
+ }
152
+ export declare const compileDefault: (js: NodeCompiler, node: Optional.Node.withDefault, out: string) => NodeCompiler;
153
+ export declare const normalizeOrder: (inner: mutable<Structure.Inner>) => void;
154
+ export declare const ownKeysOf: (data: object) => Key[];
155
+ export type PropFlatMapper = (entry: Prop.Node) => listable<MappedPropInner>;
156
+ export type MappedPropInner = BaseMappedPropInner | OptionalMappedPropInner;
157
+ export interface BaseMappedPropInner extends Required.Inner {
158
+ kind?: "required" | "optional";
159
+ }
160
+ export interface OptionalMappedPropInner extends Optional.Inner {
161
+ kind: "optional";
162
+ }
163
+ export declare const Structure: {
164
+ impl: nodeImplementationOf<Structure.Declaration>;
165
+ Node: typeof StructureNode;
166
+ };
167
+ export declare const writeNumberIndexMessage: (indexExpression: string, sequenceExpression: string) => string;
168
+ export type NormalizedIndex = {
169
+ index?: Index.Node;
170
+ required?: Required.Node[];
171
+ optional?: Optional.Node[];
172
+ };
173
+ /** extract enumerable named props from an index signature */
174
+ export declare const normalizeIndex: (signature: BaseRoot, value: BaseRoot, $: BaseScope) => NormalizedIndex;
175
+ export declare const typeKeyToString: (k: KeyOrKeyNode) => string;
176
+ export declare const writeInvalidKeysMessage: <o extends string, keys extends array<KeyOrKeyNode>>(o: o, keys: keys) => string;
177
+ export declare const writeDuplicateKeyMessage: <key extends Key>(key: key) => writeDuplicateKeyMessage<key>;
178
+ export type writeDuplicateKeyMessage<key extends Key> = `Duplicate key '${describe<key>}'`;
@@ -0,0 +1,123 @@
1
+ import { type Fn } from "../util/index.js";
2
+ import { type BaseNode } from "./node.ts";
3
+ import type { NodeId } from "./parse.ts";
4
+ import type { BaseRoot } from "./roots/root.ts";
5
+ import type { BaseScope } from "./scope.ts";
6
+ import { NodeCompiler, type InvokeOptions, type ReferenceOptions } from "./shared/compile.ts";
7
+ import { errorFromUnion } from "./shared/errors.ts";
8
+ import { ArkErrors } from "./shared/issues.ts";
9
+ import { copyDeclared, copyOf, holdsOnlyIndices, keepOwn, mergeTransformed, TransformErrors } from "./shared/transform.ts";
10
+ import { addErrors, addMorphErrs, allowsInBranch, allowsInBranchBy, callMorph, disallowed, matchesRepeated, rejected, rejects, transformed, transformedInApply, transformsValid, type TraversalKind, type TraverseAllows, type TraverseApply, type TraverseTransform } from "./shared/traversal.ts";
11
+ export declare const precompile: (references: readonly BaseNode[], owningScope?: BaseScope, unbound?: UnboundTraversals, root?: BaseNode) => Fn;
12
+ export declare const precompileRoot: (root: BaseNode, references: readonly BaseNode[]) => void;
13
+ export declare const precompileInPlace: (root: BaseRoot, unbound: UnboundTraversals | undefined) => void;
14
+ type PrecompiledTraversals = [
15
+ allows: TraverseAllows,
16
+ apply: TraverseApply,
17
+ transform?: TraverseTransform
18
+ ];
19
+ export type UnboundTraversals = Map<BaseNode, PrecompiledTraversals | undefined>;
20
+ type CompiledUnit = (dependencies: Fn[], refs: unknown[]) => PrecompiledTraversals[];
21
+ declare const unitConstants: {
22
+ addErrors: typeof addErrors;
23
+ addMorphErrs: typeof addMorphErrs;
24
+ allowsInBranch: typeof allowsInBranch;
25
+ allowsInBranchBy: typeof allowsInBranchBy;
26
+ ArkErrors: import("./shared/issues.ts").IssuesClass<ArkErrors>;
27
+ arrayIndexMatcher: RegExp;
28
+ callMorph: typeof callMorph;
29
+ copyDeclared: typeof copyDeclared;
30
+ copyOf: typeof copyOf;
31
+ disallowed: typeof disallowed;
32
+ errorFromUnion: typeof errorFromUnion;
33
+ holdsOnlyIndices: typeof holdsOnlyIndices;
34
+ isIpv4: (s: string) => boolean;
35
+ isIpv6: (s: string) => boolean;
36
+ isIso8601: (s: string) => boolean;
37
+ isNumericString: (s: string) => boolean;
38
+ isUuid: (s: string) => boolean;
39
+ isValidDate: (date: Date) => boolean;
40
+ isWellFormedInteger: (s: string) => boolean;
41
+ jsTypeOfDescriptions: {
42
+ readonly boolean: "boolean";
43
+ readonly null: "null";
44
+ readonly undefined: "undefined";
45
+ readonly bigint: "a bigint";
46
+ readonly number: "a number";
47
+ readonly object: "an object";
48
+ readonly string: "a string";
49
+ readonly symbol: "a symbol";
50
+ } & {
51
+ readonly function: "a function";
52
+ };
53
+ keepOwn: typeof keepOwn;
54
+ matchesRepeated: typeof matchesRepeated;
55
+ mergeTransformed: typeof mergeTransformed;
56
+ pipeApplied: import("./shared/traversal.ts").TraversePipe;
57
+ pipeChecked: import("./shared/traversal.ts").TraversePipe;
58
+ pipeTransformed: import("./shared/traversal.ts").TraversePipe;
59
+ printable: (data: unknown, opts?: import("../util/index.js").PrintableOptions) => string;
60
+ rejected: typeof rejected;
61
+ rejects: typeof rejects;
62
+ timeOf: (date: Date) => number | undefined;
63
+ transformed: typeof transformed;
64
+ transformedInApply: typeof transformedInApply;
65
+ transformsValid: typeof transformsValid;
66
+ TransformErrors: typeof TransformErrors;
67
+ };
68
+ export type PrecompiledUnit = [
69
+ bind: (root: BaseNode, constants: typeof unitConstants) => [declared: BaseNode[], refs: unknown[], dependencies: BaseNode[]],
70
+ unitFn: CompiledUnit,
71
+ dependencies: [key: string, kind: number][],
72
+ size: number
73
+ ];
74
+ export declare let bindPrecompiledUnits: ((roots: readonly unknown[]) => void) | undefined;
75
+ export declare const registerPrecompiledUnits: (units: Record<string, PrecompiledUnit>) => void;
76
+ export type UnitMember = [name: string, source: string];
77
+ type UnitDependency = [node: BaseNode, kind: TraversalKind];
78
+ interface UnitLinkage {
79
+ byId: Record<string, BaseNode>;
80
+ reused: Pick<ReadonlySet<BaseNode>, "has">;
81
+ unreached: Set<BaseNode>;
82
+ reached: BaseNode[];
83
+ dependencies: Record<string, UnitDependency>;
84
+ refs: NodeCompiler.Refs;
85
+ members: UnitMember[];
86
+ nameOf: ((id: NodeId) => string) | undefined;
87
+ opts: UnitOptions;
88
+ unit?: string | undefined;
89
+ }
90
+ export declare class TraversalCompiler extends NodeCompiler {
91
+ /** how the units it writes reference one another */
92
+ readonly link: UnitLinkage;
93
+ constructor(kind: TraversalKind, link: UnitLinkage, needsCtx: boolean);
94
+ declareTraversals?(node: BaseNode): string[] | undefined;
95
+ inv(node: BaseNode, opts?: InvokeOptions): string;
96
+ traversal(node: BaseNode, kind: TraversalKind): string;
97
+ ref(value: object | symbol): string;
98
+ reach(node: BaseNode): void;
99
+ refToId(id: NodeId, opts?: ReferenceOptions): string;
100
+ nameOf(id: NodeId): string;
101
+ outline(name: string, args: readonly string[], body: (js: NodeCompiler) => unknown): this;
102
+ }
103
+ export type ContentKeyOf = (value: object | symbol | string) => string | undefined;
104
+ export interface RootUnit {
105
+ name: string;
106
+ names: Record<NodeId, string>;
107
+ roots: BaseRoot[];
108
+ traversals: string[][];
109
+ declared: BaseNode[];
110
+ declaredTraversals: string[][];
111
+ members: UnitMember[];
112
+ refs: unknown[];
113
+ dependencies: Record<string, UnitDependency>;
114
+ identityNamed: ReadonlySet<NodeId>;
115
+ unitsById: Record<NodeId, RootUnit>;
116
+ }
117
+ export declare const precompileRootUnits: (root: BaseRoot, opts?: UnitOptions) => RootUnit[];
118
+ interface UnitOptions {
119
+ keyOf?: ContentKeyOf;
120
+ compiler?: typeof TraversalCompiler;
121
+ }
122
+ export declare const writePrecompiledUnits: (roots: readonly BaseRoot[]) => Record<string, string>;
123
+ export {};
@@ -0,0 +1,26 @@
1
+ import { type Root, type Schema } from "./formats.ts";
2
+ /** every value l accepts, r accepts (false if that can't be proven) */
3
+ export declare const isSubset: (l: Schema, r: Schema) => boolean;
4
+ /** l and r accept the same values (false if that can't be proven) */
5
+ export declare const isEqual: (l: Schema, r: Schema) => boolean;
6
+ /** no value is accepted by both l and r (false if that can't be proven) */
7
+ export declare const isDisjoint: (l: Schema, r: Schema) => boolean;
8
+ /** the values every schema accepts: never if they're disjoint, unknown if there are none */
9
+ export declare const intersect: (...schemas: Schema[]) => Root;
10
+ /** the values any schema accepts, without the branches others subsume */
11
+ export declare const union: (...schemas: Schema[]) => Root;
12
+ export interface Discriminant {
13
+ path: readonly PropertyKey[];
14
+ /** whether a case is a value (===) or a domain (typeof) */
15
+ kind: "unit" | "domain";
16
+ cases: readonly {
17
+ /** the unit, or the domain's name for kind "domain" */
18
+ value: unknown;
19
+ /** the union's branches a value at path matching this case can satisfy */
20
+ branches: Root;
21
+ }[];
22
+ /** the branches with nothing at path, or null if a value matching no case is rejected */
23
+ default: Root | null;
24
+ }
25
+ /** the path and cases a union's branches can be told apart by, or null if there are none */
26
+ export declare const discriminate: (schema: Schema) => Discriminant | null;
@@ -0,0 +1,19 @@
1
+ import { Disjoint, type BaseConstraint, type BaseNode, type BaseRoot, type Intersection, type IntersectionContext, type NodeKind, type RootKind, type Structure, type nodeOfKind } from "../schema/index.js";
2
+ import { type array, type satisfy } from "../util/index.js";
3
+ type ConstraintGroupKind = satisfy<NodeKind, "intersection" | "structure">;
4
+ interface ConstraintIntersectionState<kind extends ConstraintGroupKind = ConstraintGroupKind> {
5
+ kind: kind;
6
+ baseInner: Record<string, unknown>;
7
+ l: BaseConstraint[];
8
+ r: BaseConstraint[];
9
+ roots: BaseRoot[];
10
+ derivedL?: Set<BaseConstraint>;
11
+ derivedR?: Set<BaseConstraint>;
12
+ ctx: IntersectionContext;
13
+ }
14
+ export declare const intersectConstraints: <kind extends ConstraintGroupKind>(s: ConstraintIntersectionState<kind>) => nodeOfKind<RootKind | Extract<kind, "structure">> | Disjoint;
15
+ export declare const flattenConstraints: (inner: object) => BaseConstraint[];
16
+ export declare const sortSiblings: <node extends BaseNode>(nodes: readonly node[]) => readonly node[];
17
+ type FlatIntersectionInner = Intersection.Inner & Structure.Inner;
18
+ export declare const unflattenConstraints: (constraints: array<BaseConstraint>) => FlatIntersectionInner;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type SetEngine } from "../schema/index.js";
2
+ export declare const setEngine: SetEngine;
@@ -0,0 +1,23 @@
1
+ import { BaseRoot, type JsonSchema, type StandardJSONSchemaV1, type ToJsonSchema } from "../schema/index.js";
2
+ /** a set of values as an @ark/schema node, which every arktype Type is */
3
+ export type Root = BaseRoot;
4
+ /** a Root (e.g. an arktype Type), a Standard JSON Schema (e.g. a zod schema) or a JSON Schema */
5
+ export type Schema = Root | StandardJSONSchemaV1 | JsonSchemaInput;
6
+ /**
7
+ * a JSON Schema: a boolean or an object. JsonSchema's keywords complete in a
8
+ * literal, but any object type is accepted, like a library's own JSON Schema
9
+ * interface, except an array or other iterable, which no JSON Schema is
10
+ */
11
+ export type JsonSchemaInput = JsonSchema.Branch | (object & {
12
+ readonly [Symbol.iterator]?: never;
13
+ });
14
+ export interface ParseOptions {
15
+ /** which side of a schema with morphs to read, its input by default */
16
+ io?: "in" | "out";
17
+ /** the document a JSON Schema's #/... refs resolve against, the schema itself by default */
18
+ root?: JsonSchemaInput;
19
+ }
20
+ /** the Root a schema's values make up */
21
+ export declare const parse: (schema: Schema, options?: ParseOptions) => Root;
22
+ /** the JSON Schema of a schema's values */
23
+ export declare const toJsonSchema: (schema: Schema, options?: ToJsonSchema.Options) => JsonSchema;
@@ -0,0 +1,15 @@
1
+ import { type BaseRoot, type JsonSchema } from "../schema/index.js";
2
+ import "./engine.ts";
3
+ export declare const readJsonSchema: (schema: JsonSchema.Input, document?: JsonSchema.Input) => BaseRoot;
4
+ export declare const isJsonSchemaObject: (value: unknown) => value is object;
5
+ export declare const writeUnparsableSchemaMessage: (actual: string) => string;
6
+ export declare const writeUnreadableStandardSchemaMessage: (vendor: string, method: "input" | "output", cause: unknown) => string;
7
+ export declare const writeInvalidJsonSchemaMessage: (pointer: string, actual: unknown) => string;
8
+ export declare const writeInvalidKeywordMessage: (pointer: string, expected: string, actual: unknown) => string;
9
+ export declare const writeUnsupportedKeywordMessage: (pointer: string) => string;
10
+ export declare const writeUnsupportedRefMessage: (ref: string, pointer: string) => string;
11
+ export declare const writeUnresolvableRefMessage: (ref: string) => string;
12
+ export declare const writeNonNullableNullMessage: (pointer: string) => string;
13
+ export declare const writeShallowCycleMessage: (ref: string, pointer: string) => string;
14
+ export declare const writeCircularSchemaMessage: (pointer: string) => string;
15
+ export declare const writeMaxDepthMessage: (pointer: string, maxDepth?: number) => string;
@@ -0,0 +1,16 @@
1
+ import { type mutable } from "../util/index.js";
2
+ import { type BaseNodeDeclaration, type BaseScope, type Disjoint, type IntersectionMap, type RootIntersection, type RootKind, type UnknownIntersectionMap, type nodeOfKind, type schemaKindRightOf } from "../schema/index.js";
3
+ interface CommonSetImplementationInput<d extends BaseNodeDeclaration> {
4
+ reduce?: (inner: d["inner"], $: BaseScope) => nodeOfKind<d["reducibleTo"]> | Disjoint | undefined;
5
+ sort?: (inner: mutable<d["inner"]>) => void;
6
+ }
7
+ export type setImplementationOf<d extends BaseNodeDeclaration> = CommonSetImplementationInput<d> & {
8
+ intersections: IntersectionMap<d["kind"]>;
9
+ } & (d["reducibleTo"] extends d["kind"] ? {} : {
10
+ reduce: {};
11
+ });
12
+ export interface UnknownSetImplementation extends CommonSetImplementationInput<BaseNodeDeclaration> {
13
+ intersections: UnknownIntersectionMap;
14
+ }
15
+ export declare const defineRightwardIntersections: <kind extends RootKind>(kind: kind, implementation: RootIntersection<kind, schemaKindRightOf<kind>>) => { [k in schemaKindRightOf<kind>]: RootIntersection<kind, k>; };
16
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./algebra.ts";
2
+ export * from "./formats.ts";
@@ -0,0 +1,20 @@
1
+ export * from "./index.ts";
2
+ export * from "./constraint.ts";
3
+ export * from "./engine.ts";
4
+ export * from "./fromJsonSchema.ts";
5
+ export * from "./implement.ts";
6
+ export * from "./intersections.ts";
7
+ export * from "./kinds.ts";
8
+ export * from "./refinements.ts";
9
+ export * from "./roots/alias.ts";
10
+ export * from "./roots/domain.ts";
11
+ export * from "./roots/intersection.ts";
12
+ export * from "./roots/morph.ts";
13
+ export * from "./roots/proto.ts";
14
+ export * from "./roots/union.ts";
15
+ export * from "./roots/unit.ts";
16
+ export * from "./structure/index.ts";
17
+ export * from "./structure/prop.ts";
18
+ export * from "./structure/sequence.ts";
19
+ export * from "./structure/structure.ts";
20
+ export * from "./toJsonSchema.ts";
@@ -0,0 +1,5 @@
1
+ import { type BaseNode, type BaseScope, type InternalNodeIntersection, type IntersectionContext } from "../schema/index.js";
2
+ export declare const intersectNodesRoot: InternalNodeIntersection<BaseScope>;
3
+ export declare const pipeNodesRoot: InternalNodeIntersection<BaseScope>;
4
+ export declare const intersectOrPipeNodes: InternalNodeIntersection<IntersectionContext>;
5
+ export declare const listsKeysAlike: (l: BaseNode, r: BaseNode) => boolean;
@@ -0,0 +1,3 @@
1
+ import type { NodeKind } from "../schema/index.js";
2
+ import type { UnknownSetImplementation } from "./implement.ts";
3
+ export declare const setImplementationsByKind: Record<NodeKind, UnknownSetImplementation>;
@@ -0,0 +1,14 @@
1
+ import { type After, type Before, type Divisor, type ExactLength, type Max, type MaxLength, type Min, type MinLength, type NotEqual, type NotEqualLength, type Pattern, type Predicate } from "../schema/index.js";
2
+ import type { setImplementationOf } from "./implement.ts";
3
+ export declare const pattern: setImplementationOf<Pattern.Declaration>;
4
+ export declare const divisor: setImplementationOf<Divisor.Declaration>;
5
+ export declare const exactLength: setImplementationOf<ExactLength.Declaration>;
6
+ export declare const max: setImplementationOf<Max.Declaration>;
7
+ export declare const min: setImplementationOf<Min.Declaration>;
8
+ export declare const notEqual: setImplementationOf<NotEqual.Declaration>;
9
+ export declare const notEqualLength: setImplementationOf<NotEqualLength.Declaration>;
10
+ export declare const maxLength: setImplementationOf<MaxLength.Declaration>;
11
+ export declare const minLength: setImplementationOf<MinLength.Declaration>;
12
+ export declare const before: setImplementationOf<Before.Declaration>;
13
+ export declare const after: setImplementationOf<After.Declaration>;
14
+ export declare const predicate: setImplementationOf<Predicate.Declaration>;
@@ -0,0 +1,3 @@
1
+ import { type Alias } from "../../schema/index.js";
2
+ import { type setImplementationOf } from "../implement.ts";
3
+ export declare const alias: setImplementationOf<Alias.Declaration>;
@@ -0,0 +1,3 @@
1
+ import { type Domain } from "../../schema/index.js";
2
+ import type { setImplementationOf } from "../implement.ts";
3
+ export declare const domain: setImplementationOf<Domain.Declaration>;
@@ -0,0 +1,4 @@
1
+ import { Disjoint, type BaseRoot, type BaseScope, type Intersection } from "../../schema/index.js";
2
+ import { type setImplementationOf } from "../implement.ts";
3
+ export declare const intersection: setImplementationOf<Intersection.Declaration>;
4
+ export declare const constrainIntersection: (l: Intersection.Node, inner: Intersection.Inner, $: BaseScope) => BaseRoot | Disjoint;
@@ -0,0 +1,4 @@
1
+ import { type Morph } from "../../schema/index.js";
2
+ import { type setImplementationOf } from "../implement.ts";
3
+ export declare const morph: setImplementationOf<Morph.Declaration>;
4
+ export declare const writeMorphIntersectionMessage: (lDescription: string, rDescription: string) => string;
@@ -0,0 +1,3 @@
1
+ import { type Proto } from "../../schema/index.js";
2
+ import type { setImplementationOf } from "../implement.ts";
3
+ export declare const proto: setImplementationOf<Proto.Declaration>;
@@ -0,0 +1,16 @@
1
+ import { Disjoint, type BaseRoot, type BaseScope, type CaseDiscriminant, type Discriminant, type DiscriminantLocation, type Domain, type IntersectionContext, type Union } from "../../schema/index.js";
2
+ import { type JsonStructure } from "../../util/index.js";
3
+ import { type setImplementationOf } from "../implement.ts";
4
+ export declare const unionImplementation: setImplementationOf<Union.Declaration>;
5
+ export declare const discriminateUnion: (node: Union.Node) => Discriminant | null;
6
+ export declare const discriminantCaseToNode: (caseDiscriminant: CaseDiscriminant, path: PropertyKey[], $: BaseScope, { includesPrimitives }?: {
7
+ includesPrimitives?: boolean;
8
+ }) => BaseRoot;
9
+ export declare const intersectBranches: (l: readonly Union.ChildNode[], r: readonly Union.ChildNode[], ctx: IntersectionContext) => readonly Union.ChildNode[] | Disjoint;
10
+ export declare const unitBitsOf: (domain: Domain) => number;
11
+ export declare const domainsOf: (node: BaseRoot) => number;
12
+ export declare const reduceBranches: ({ branches, ordered }: Union.Inner) => readonly Union.ChildNode[];
13
+ export declare const discriminantJsonOf: (node: Union.Node) => JsonStructure | null;
14
+ export declare const pruneDiscriminant: (discriminantBranch: BaseRoot, discriminantCtx: DiscriminantLocation) => BaseRoot | null;
15
+ export declare const writeIndiscriminableMorphMessage: (lDescription: string, rDescription: string) => string;
16
+ export declare const writeOrderedIntersectionMessage: (lDescription: string, rDescription: string) => string;
@@ -0,0 +1,3 @@
1
+ import { type Unit } from "../../schema/index.js";
2
+ import { type setImplementationOf } from "../implement.ts";
3
+ export declare const unit: setImplementationOf<Unit.Declaration>;