@depup/typebox 1.1.21-depup.0 → 1.3.8-depup.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 (960) hide show
  1. package/README.md +2 -2
  2. package/build/compile/code.mjs +2 -2
  3. package/build/compile/validator.d.mts +7 -14
  4. package/build/compile/validator.mjs +32 -57
  5. package/build/error/errors.d.mts +1 -7
  6. package/build/format/_idna.mjs +36 -6
  7. package/build/format/_puny.mjs +4 -1
  8. package/build/format/_registry.mjs +9 -9
  9. package/build/format/email.d.mts +1 -1
  10. package/build/format/email.mjs +3 -24
  11. package/build/format/format.d.mts +9 -9
  12. package/build/format/format.mjs +9 -9
  13. package/build/format/{idn-email.d.mts → idn_email.d.mts} +1 -1
  14. package/build/format/idn_email.mjs +8 -0
  15. package/build/format/uuid.d.mts +2 -2
  16. package/build/format/uuid.mjs +3 -3
  17. package/build/guard/emit.d.mts +3 -5
  18. package/build/guard/emit.mjs +12 -13
  19. package/build/guard/guard.d.mts +15 -7
  20. package/build/guard/guard.mjs +40 -15
  21. package/build/guard/string.mjs +16 -4
  22. package/build/schema/build.d.mts +11 -7
  23. package/build/schema/build.mjs +28 -9
  24. package/build/schema/check.d.mts +3 -3
  25. package/build/schema/compile.d.mts +4 -4
  26. package/build/schema/compile.mjs +9 -9
  27. package/build/schema/engine/_context.mjs +3 -3
  28. package/build/schema/engine/_functions.mjs +34 -16
  29. package/build/schema/engine/_refine.mjs +4 -4
  30. package/build/schema/engine/_stack.d.mts +4 -4
  31. package/build/schema/engine/_stack.mjs +52 -18
  32. package/build/schema/engine/additionalItems.mjs +17 -7
  33. package/build/schema/engine/additionalProperties.mjs +1 -1
  34. package/build/schema/engine/boolean.d.mts +3 -3
  35. package/build/schema/engine/boolean.mjs +4 -4
  36. package/build/schema/engine/contains.mjs +18 -6
  37. package/build/schema/engine/dynamicRef.d.mts +6 -0
  38. package/build/schema/engine/dynamicRef.mjs +25 -0
  39. package/build/schema/engine/enum.mjs +1 -1
  40. package/build/schema/engine/index.d.mts +0 -1
  41. package/build/schema/engine/index.mjs +0 -1
  42. package/build/schema/engine/items.mjs +26 -6
  43. package/build/schema/engine/maxContains.mjs +3 -3
  44. package/build/schema/engine/minContains.mjs +14 -4
  45. package/build/schema/engine/not.mjs +4 -2
  46. package/build/schema/engine/oneOf.mjs +7 -6
  47. package/build/schema/engine/recursiveRef.mjs +3 -3
  48. package/build/schema/engine/ref.mjs +4 -10
  49. package/build/schema/engine/schema.mjs +15 -15
  50. package/build/schema/engine/type.mjs +15 -19
  51. package/build/schema/parse.d.mts +3 -3
  52. package/build/schema/pointer/index.d.mts +1 -1
  53. package/build/schema/pointer/index.mjs +1 -1
  54. package/build/schema/pointer/pointer.mjs +11 -1
  55. package/build/schema/resolve/ref.d.mts +1 -0
  56. package/build/schema/resolve/ref.mjs +61 -11
  57. package/build/schema/static/_canonical.d.mts +7 -0
  58. package/build/schema/static/{~elements.d.mts → _elements.d.mts} +3 -3
  59. package/build/schema/static/items.d.mts +1 -1
  60. package/build/schema/static/prefixItems.d.mts +1 -1
  61. package/build/schema/static/properties.d.mts +27 -6
  62. package/build/schema/static/ref.d.mts +1 -1
  63. package/build/schema/static/required.d.mts +1 -11
  64. package/build/schema/static/schema.d.mts +3 -2
  65. package/build/schema/static/static.d.mts +2 -2
  66. package/build/schema/types/_refine.d.mts +2 -2
  67. package/build/schema/types/_refine.mjs +4 -4
  68. package/build/schema/types/dependencies.mjs +1 -1
  69. package/build/schema/types/index.d.mts +0 -1
  70. package/build/schema/types/index.mjs +0 -1
  71. package/build/schema/types/schema.d.mts +1 -1
  72. package/build/schema/types/schema.mjs +2 -2
  73. package/build/system/environment/evaluate.mjs +1 -1
  74. package/build/system/locale/_config.d.mts +1 -1
  75. package/build/system/locale/ar_001.d.mts +1 -1
  76. package/build/system/locale/ar_001.mjs +0 -1
  77. package/build/system/locale/bn_BD.d.mts +1 -1
  78. package/build/system/locale/bn_BD.mjs +0 -1
  79. package/build/system/locale/cs_CZ.d.mts +1 -1
  80. package/build/system/locale/cs_CZ.mjs +0 -1
  81. package/build/system/locale/de_DE.d.mts +1 -1
  82. package/build/system/locale/de_DE.mjs +0 -1
  83. package/build/system/locale/el_GR.d.mts +1 -1
  84. package/build/system/locale/el_GR.mjs +0 -1
  85. package/build/system/locale/en_US.d.mts +1 -1
  86. package/build/system/locale/en_US.mjs +0 -1
  87. package/build/system/locale/es_419.d.mts +1 -1
  88. package/build/system/locale/es_419.mjs +0 -1
  89. package/build/system/locale/es_AR.d.mts +1 -1
  90. package/build/system/locale/es_AR.mjs +0 -1
  91. package/build/system/locale/es_ES.d.mts +1 -1
  92. package/build/system/locale/es_ES.mjs +0 -1
  93. package/build/system/locale/es_MX.d.mts +1 -1
  94. package/build/system/locale/es_MX.mjs +0 -1
  95. package/build/system/locale/fa_IR.d.mts +1 -1
  96. package/build/system/locale/fa_IR.mjs +0 -1
  97. package/build/system/locale/fil_PH.d.mts +1 -1
  98. package/build/system/locale/fil_PH.mjs +0 -1
  99. package/build/system/locale/fr_CA.d.mts +1 -1
  100. package/build/system/locale/fr_CA.mjs +0 -1
  101. package/build/system/locale/fr_FR.d.mts +1 -1
  102. package/build/system/locale/fr_FR.mjs +0 -1
  103. package/build/system/locale/ha_NG.d.mts +1 -1
  104. package/build/system/locale/ha_NG.mjs +0 -1
  105. package/build/system/locale/hi_IN.d.mts +1 -1
  106. package/build/system/locale/hi_IN.mjs +0 -1
  107. package/build/system/locale/hu_HU.d.mts +1 -1
  108. package/build/system/locale/hu_HU.mjs +0 -1
  109. package/build/system/locale/id_ID.d.mts +1 -1
  110. package/build/system/locale/id_ID.mjs +0 -1
  111. package/build/system/locale/it_IT.d.mts +1 -1
  112. package/build/system/locale/it_IT.mjs +0 -1
  113. package/build/system/locale/ja_JP.d.mts +1 -1
  114. package/build/system/locale/ja_JP.mjs +0 -1
  115. package/build/system/locale/ko_KR.d.mts +1 -1
  116. package/build/system/locale/ko_KR.mjs +0 -1
  117. package/build/system/locale/ms_MY.d.mts +1 -1
  118. package/build/system/locale/ms_MY.mjs +0 -1
  119. package/build/system/locale/nl_NL.d.mts +1 -1
  120. package/build/system/locale/nl_NL.mjs +0 -1
  121. package/build/system/locale/pl_PL.d.mts +1 -1
  122. package/build/system/locale/pl_PL.mjs +0 -1
  123. package/build/system/locale/pt_BR.d.mts +1 -1
  124. package/build/system/locale/pt_BR.mjs +0 -1
  125. package/build/system/locale/pt_PT.d.mts +1 -1
  126. package/build/system/locale/pt_PT.mjs +0 -1
  127. package/build/system/locale/ro_RO.d.mts +1 -1
  128. package/build/system/locale/ro_RO.mjs +0 -1
  129. package/build/system/locale/ru_RU.d.mts +1 -1
  130. package/build/system/locale/ru_RU.mjs +0 -1
  131. package/build/system/locale/sv_SE.d.mts +1 -1
  132. package/build/system/locale/sv_SE.mjs +0 -1
  133. package/build/system/locale/sw_TZ.d.mts +1 -1
  134. package/build/system/locale/sw_TZ.mjs +0 -1
  135. package/build/system/locale/th_TH.d.mts +1 -1
  136. package/build/system/locale/th_TH.mjs +0 -1
  137. package/build/system/locale/tr_TR.d.mts +1 -1
  138. package/build/system/locale/tr_TR.mjs +0 -1
  139. package/build/system/locale/uk_UA.d.mts +1 -1
  140. package/build/system/locale/uk_UA.mjs +0 -1
  141. package/build/system/locale/ur_PK.d.mts +1 -1
  142. package/build/system/locale/ur_PK.mjs +0 -1
  143. package/build/system/locale/vi_VN.d.mts +1 -1
  144. package/build/system/locale/vi_VN.mjs +0 -1
  145. package/build/system/locale/yo_NG.d.mts +1 -1
  146. package/build/system/locale/yo_NG.mjs +0 -1
  147. package/build/system/locale/zh_Hans.d.mts +1 -1
  148. package/build/system/locale/zh_Hans.mjs +0 -1
  149. package/build/system/locale/zh_Hant.d.mts +1 -1
  150. package/build/system/locale/zh_Hant.mjs +0 -1
  151. package/build/system/memory/clone.d.mts +2 -3
  152. package/build/system/memory/clone.mjs +73 -26
  153. package/build/system/settings/settings.d.mts +15 -0
  154. package/build/system/settings/settings.mjs +3 -1
  155. package/build/type/action/_add_immutable.d.mts +11 -0
  156. package/build/type/action/_add_immutable.mjs +11 -0
  157. package/build/type/action/_add_optional.d.mts +11 -0
  158. package/build/type/action/_add_optional.mjs +11 -0
  159. package/build/type/action/_add_readonly.d.mts +11 -0
  160. package/build/type/action/_add_readonly.mjs +11 -0
  161. package/build/type/action/_remove_immutable.d.mts +11 -0
  162. package/build/type/action/_remove_immutable.mjs +11 -0
  163. package/build/type/action/_remove_optional.d.mts +11 -0
  164. package/build/type/action/_remove_optional.mjs +11 -0
  165. package/build/type/action/_remove_readonly.d.mts +11 -0
  166. package/build/type/action/_remove_readonly.mjs +11 -0
  167. package/build/type/action/capitalize.d.mts +2 -2
  168. package/build/type/action/capitalize.mjs +2 -3
  169. package/build/type/action/conditional.d.mts +3 -2
  170. package/build/type/action/conditional.mjs +3 -2
  171. package/build/type/action/{constructor-parameters.d.mts → constructor_parameters.d.mts} +2 -2
  172. package/build/type/action/{constructor-parameters.mjs → constructor_parameters.mjs} +2 -3
  173. package/build/type/action/evaluate.d.mts +2 -2
  174. package/build/type/action/evaluate.mjs +2 -3
  175. package/build/type/action/exclude.d.mts +2 -2
  176. package/build/type/action/exclude.mjs +2 -3
  177. package/build/type/action/extract.d.mts +2 -2
  178. package/build/type/action/extract.mjs +2 -3
  179. package/build/type/action/index.d.mts +12 -9
  180. package/build/type/action/index.mjs +12 -9
  181. package/build/type/action/indexed.d.mts +3 -3
  182. package/build/type/action/indexed.mjs +3 -4
  183. package/build/type/action/{instance-type.d.mts → instance_type.d.mts} +2 -2
  184. package/build/type/action/{instance-type.mjs → instance_type.mjs} +2 -3
  185. package/build/type/action/interface.d.mts +2 -2
  186. package/build/type/action/interface.mjs +5 -3
  187. package/build/type/action/keyof.d.mts +2 -2
  188. package/build/type/action/keyof.mjs +2 -3
  189. package/build/type/action/lowercase.d.mts +2 -2
  190. package/build/type/action/lowercase.mjs +2 -3
  191. package/build/type/action/mapped.d.mts +3 -2
  192. package/build/type/action/mapped.mjs +3 -2
  193. package/build/type/action/module.d.mts +8 -7
  194. package/build/type/action/module.mjs +7 -6
  195. package/build/type/action/{non-nullable.d.mts → non_nullable.d.mts} +2 -2
  196. package/build/type/action/{non-nullable.mjs → non_nullable.mjs} +2 -3
  197. package/build/type/action/omit.d.mts +3 -3
  198. package/build/type/action/omit.mjs +3 -4
  199. package/build/type/action/parameters.d.mts +2 -2
  200. package/build/type/action/parameters.mjs +2 -3
  201. package/build/type/action/partial.d.mts +3 -3
  202. package/build/type/action/partial.mjs +2 -3
  203. package/build/type/action/pick.d.mts +3 -3
  204. package/build/type/action/pick.mjs +3 -4
  205. package/build/type/action/readonly_object.d.mts +16 -0
  206. package/build/type/action/readonly_object.mjs +19 -0
  207. package/build/type/action/required.d.mts +2 -2
  208. package/build/type/action/required.mjs +2 -3
  209. package/build/type/action/{return-type.d.mts → return_type.d.mts} +2 -2
  210. package/build/type/action/{return-type.mjs → return_type.mjs} +2 -3
  211. package/build/type/action/uncapitalize.d.mts +2 -2
  212. package/build/type/action/uncapitalize.mjs +2 -3
  213. package/build/type/action/uppercase.d.mts +2 -2
  214. package/build/type/action/uppercase.mjs +2 -3
  215. package/build/type/action/with.d.mts +11 -0
  216. package/build/type/action/with.mjs +11 -0
  217. package/build/type/engine/call/{distribute-arguments.mjs → distribute_arguments.mjs} +1 -7
  218. package/build/type/engine/call/instantiate.d.mts +4 -6
  219. package/build/type/engine/call/instantiate.mjs +6 -5
  220. package/build/type/engine/call/{resolve-arguments.mjs → resolve_arguments.mjs} +3 -9
  221. package/build/type/engine/conditional/instantiate.d.mts +4 -2
  222. package/build/type/engine/conditional/instantiate.mjs +13 -9
  223. package/build/type/engine/constructor_parameters/instantiate.d.mts +14 -0
  224. package/build/type/engine/constructor_parameters/instantiate.mjs +25 -0
  225. package/build/type/engine/cyclic/candidates.d.mts +3 -4
  226. package/build/type/engine/cyclic/candidates.mjs +3 -6
  227. package/build/type/engine/cyclic/check.d.mts +6 -9
  228. package/build/type/engine/cyclic/check.mjs +13 -22
  229. package/build/type/engine/cyclic/dependencies.d.mts +1 -4
  230. package/build/type/engine/cyclic/dependencies.mjs +9 -15
  231. package/build/type/engine/cyclic/extends.d.mts +1 -4
  232. package/build/type/engine/cyclic/extends.mjs +8 -14
  233. package/build/type/engine/cyclic/instantiate.d.mts +2 -5
  234. package/build/type/engine/cyclic/instantiate.mjs +3 -2
  235. package/build/type/engine/enum/index.d.mts +1 -2
  236. package/build/type/engine/enum/index.mjs +1 -2
  237. package/build/type/engine/evaluate/broaden.d.mts +1 -2
  238. package/build/type/engine/evaluate/broaden.mjs +2 -6
  239. package/build/type/engine/evaluate/composite.d.mts +11 -7
  240. package/build/type/engine/evaluate/composite.mjs +11 -7
  241. package/build/type/engine/evaluate/distribute.d.mts +2 -1
  242. package/build/type/engine/evaluate/distribute.mjs +7 -17
  243. package/build/type/engine/evaluate/evaluate.d.mts +17 -5
  244. package/build/type/engine/evaluate/evaluate.mjs +34 -8
  245. package/build/type/engine/evaluate/flatten.d.mts +1 -1
  246. package/build/type/engine/evaluate/instantiate.d.mts +3 -3
  247. package/build/type/engine/evaluate/instantiate.mjs +5 -10
  248. package/build/type/engine/evaluate/narrow.d.mts +3 -3
  249. package/build/type/engine/exclude/instantiate.d.mts +4 -11
  250. package/build/type/engine/exclude/instantiate.mjs +7 -28
  251. package/build/type/engine/exclude/operation.d.mts +10 -0
  252. package/build/type/engine/exclude/operation.mjs +23 -0
  253. package/build/type/engine/extract/instantiate.d.mts +4 -11
  254. package/build/type/engine/extract/instantiate.mjs +7 -28
  255. package/build/type/engine/extract/operation.d.mts +10 -0
  256. package/build/type/engine/extract/operation.mjs +23 -0
  257. package/build/type/engine/helpers/index.d.mts +1 -1
  258. package/build/type/engine/helpers/index.mjs +1 -1
  259. package/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  260. package/build/type/engine/immutable/instantiate_add.mjs +14 -0
  261. package/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  262. package/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  263. package/build/type/engine/index.d.mts +8 -8
  264. package/build/type/engine/index.mjs +8 -8
  265. package/build/type/engine/indexable/{from-cyclic.d.mts → from_cyclic.d.mts} +1 -1
  266. package/build/type/engine/{object/from-cyclic.mjs → indexable/from_cyclic.mjs} +1 -1
  267. package/build/type/engine/indexable/from_dependent.d.mts +5 -0
  268. package/build/type/engine/indexable/from_dependent.mjs +8 -0
  269. package/build/type/engine/indexable/from_enum.d.mts +6 -0
  270. package/build/type/engine/indexable/from_enum.mjs +8 -0
  271. package/build/type/engine/indexable/{from-intersect.d.mts → from_intersect.d.mts} +1 -1
  272. package/build/type/engine/indexable/{from-intersect.mjs → from_intersect.mjs} +1 -1
  273. package/build/type/engine/indexable/{from-literal.d.mts → from_literal.d.mts} +1 -1
  274. package/build/type/engine/indexable/from_template_literal.d.mts +5 -0
  275. package/build/type/engine/indexable/from_template_literal.mjs +8 -0
  276. package/build/type/engine/indexable/from_type.d.mts +19 -0
  277. package/build/type/engine/indexable/from_type.mjs +25 -0
  278. package/build/type/engine/indexable/{from-union.d.mts → from_union.d.mts} +1 -1
  279. package/build/type/engine/indexable/{from-union.mjs → from_union.mjs} +1 -1
  280. package/build/type/engine/indexable/{to-indexable-keys.d.mts → to_indexable_keys.d.mts} +1 -1
  281. package/build/type/engine/indexable/{to-indexable-keys.mjs → to_indexable_keys.mjs} +1 -1
  282. package/build/type/engine/indexed/from_object.d.mts +16 -0
  283. package/build/type/engine/indexed/from_object.mjs +40 -0
  284. package/build/type/engine/indexed/{from-tuple.d.mts → from_tuple.d.mts} +1 -1
  285. package/build/type/engine/indexed/{from-tuple.mjs → from_tuple.mjs} +1 -1
  286. package/build/type/engine/indexed/from_type.d.mts +11 -0
  287. package/build/type/engine/indexed/from_type.mjs +14 -0
  288. package/build/type/engine/indexed/instantiate.d.mts +7 -12
  289. package/build/type/engine/indexed/instantiate.mjs +13 -22
  290. package/build/type/engine/instance_type/instantiate.d.mts +12 -0
  291. package/build/type/engine/{instance-type → instance_type}/instantiate.mjs +10 -9
  292. package/build/type/engine/instantiate.d.mts +53 -42
  293. package/build/type/engine/instantiate.mjs +92 -106
  294. package/build/type/engine/interface/instantiate.d.mts +6 -7
  295. package/build/type/engine/interface/instantiate.mjs +12 -8
  296. package/build/type/engine/intrinsics/{from-template-literal.d.mts → from_template_literal.d.mts} +3 -3
  297. package/build/type/engine/intrinsics/from_template_literal.mjs +8 -0
  298. package/build/type/engine/intrinsics/{from-type.d.mts → from_type.d.mts} +4 -4
  299. package/build/type/engine/intrinsics/{from-type.mjs → from_type.mjs} +4 -4
  300. package/build/type/engine/intrinsics/{from-union.d.mts → from_union.d.mts} +1 -1
  301. package/build/type/engine/intrinsics/{from-union.mjs → from_union.mjs} +1 -1
  302. package/build/type/engine/intrinsics/instantiate.d.mts +13 -9
  303. package/build/type/engine/intrinsics/instantiate.mjs +29 -25
  304. package/build/type/engine/keyof/from_type.d.mts +15 -0
  305. package/build/type/engine/keyof/from_type.mjs +23 -0
  306. package/build/type/engine/keyof/instantiate.d.mts +6 -17
  307. package/build/type/engine/keyof/instantiate.mjs +12 -28
  308. package/build/type/engine/mapped/instantiate.d.mts +4 -19
  309. package/build/type/engine/mapped/instantiate.mjs +7 -42
  310. package/build/type/engine/mapped/mapped_operation.d.mts +22 -0
  311. package/build/type/engine/mapped/mapped_operation.mjs +42 -0
  312. package/build/type/engine/mapped/mapped_variants.d.mts +17 -0
  313. package/build/type/engine/mapped/mapped_variants.mjs +39 -0
  314. package/build/type/engine/module/instantiate.d.mts +7 -9
  315. package/build/type/engine/module/instantiate.mjs +17 -15
  316. package/build/type/engine/non_nullable/instantiate.d.mts +14 -0
  317. package/build/type/engine/non_nullable/instantiate.mjs +22 -0
  318. package/build/type/engine/object/collapse.d.mts +1 -1
  319. package/build/type/engine/object/collapse.mjs +1 -1
  320. package/build/type/engine/object/{from-cyclic.d.mts → from_cyclic.d.mts} +1 -1
  321. package/build/type/engine/{indexable/from-cyclic.mjs → object/from_cyclic.mjs} +1 -1
  322. package/build/type/engine/object/from_dependent.d.mts +5 -0
  323. package/build/type/engine/object/from_dependent.mjs +8 -0
  324. package/build/type/engine/object/{from-intersect.d.mts → from_intersect.d.mts} +1 -1
  325. package/build/type/engine/object/{from-intersect.mjs → from_intersect.mjs} +1 -1
  326. package/build/type/engine/object/{from-tuple.d.mts → from_tuple.d.mts} +2 -2
  327. package/build/type/engine/object/{from-tuple.mjs → from_tuple.mjs} +2 -2
  328. package/build/type/engine/object/from_type.d.mts +16 -0
  329. package/build/type/engine/object/from_type.mjs +23 -0
  330. package/build/type/engine/object/{from-union.d.mts → from_union.d.mts} +1 -1
  331. package/build/type/engine/object/{from-union.mjs → from_union.mjs} +4 -11
  332. package/build/type/engine/omit/from_type.d.mts +12 -0
  333. package/build/type/engine/omit/from_type.mjs +18 -0
  334. package/build/type/engine/omit/instantiate.d.mts +4 -11
  335. package/build/type/engine/omit/instantiate.mjs +7 -22
  336. package/build/type/engine/optional/instantiate_add.d.mts +10 -0
  337. package/build/type/engine/optional/instantiate_add.mjs +14 -0
  338. package/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  339. package/build/type/engine/optional/instantiate_remove.mjs +14 -0
  340. package/build/type/engine/parameters/instantiate.d.mts +7 -7
  341. package/build/type/engine/parameters/instantiate.mjs +14 -11
  342. package/build/type/engine/{readonly-type/from-cyclic.d.mts → partial/from_cyclic.d.mts} +1 -1
  343. package/build/type/engine/partial/{from-cyclic.mjs → from_cyclic.mjs} +1 -1
  344. package/build/type/engine/partial/from_dependent.d.mts +5 -0
  345. package/build/type/engine/partial/from_dependent.mjs +8 -0
  346. package/build/type/engine/partial/from_intersect.d.mts +5 -0
  347. package/build/type/engine/partial/from_intersect.mjs +8 -0
  348. package/build/type/engine/{readonly-type/from-object.d.mts → partial/from_object.d.mts} +2 -2
  349. package/build/type/engine/partial/{from-object.mjs → from_object.mjs} +2 -2
  350. package/build/type/engine/partial/from_type.d.mts +14 -0
  351. package/build/type/engine/partial/from_type.mjs +20 -0
  352. package/build/type/engine/{readonly-type/from-union.d.mts → partial/from_union.d.mts} +1 -1
  353. package/build/type/engine/{readonly-type/from-union.mjs → partial/from_union.mjs} +1 -1
  354. package/build/type/engine/partial/instantiate.d.mts +4 -4
  355. package/build/type/engine/partial/instantiate.mjs +8 -7
  356. package/build/type/engine/pick/from_type.d.mts +13 -0
  357. package/build/type/engine/pick/from_type.mjs +20 -0
  358. package/build/type/engine/pick/instantiate.d.mts +4 -12
  359. package/build/type/engine/pick/instantiate.mjs +7 -23
  360. package/build/type/engine/priority/index.d.mts +1 -0
  361. package/build/type/engine/priority/index.mjs +1 -0
  362. package/build/type/engine/priority/priority.d.mts +20 -0
  363. package/build/type/engine/priority/priority.mjs +28 -0
  364. package/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  365. package/build/type/engine/readonly/instantiate_add.mjs +14 -0
  366. package/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  367. package/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  368. package/build/type/engine/{readonly-type/from-array.d.mts → readonly_object/from_array.d.mts} +2 -2
  369. package/build/type/engine/{readonly-type/from-array.mjs → readonly_object/from_array.mjs} +2 -2
  370. package/build/type/engine/{partial/from-cyclic.d.mts → readonly_object/from_cyclic.d.mts} +1 -1
  371. package/build/type/engine/{required/from-cyclic.mjs → readonly_object/from_cyclic.mjs} +1 -1
  372. package/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  373. package/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  374. package/build/type/engine/readonly_object/from_intersect.d.mts +5 -0
  375. package/build/type/engine/readonly_object/from_intersect.mjs +8 -0
  376. package/build/type/engine/{partial/from-object.d.mts → readonly_object/from_object.d.mts} +2 -2
  377. package/build/type/engine/{readonly-type/from-object.mjs → readonly_object/from_object.mjs} +2 -2
  378. package/build/type/engine/{readonly-type/from-tuple.d.mts → readonly_object/from_tuple.d.mts} +2 -2
  379. package/build/type/engine/{readonly-type/from-tuple.mjs → readonly_object/from_tuple.mjs} +2 -2
  380. package/build/type/engine/readonly_object/from_type.d.mts +18 -0
  381. package/build/type/engine/readonly_object/from_type.mjs +25 -0
  382. package/build/type/engine/{partial/from-union.d.mts → readonly_object/from_union.d.mts} +1 -1
  383. package/build/type/engine/{partial/from-union.mjs → readonly_object/from_union.mjs} +1 -1
  384. package/build/type/engine/readonly_object/instantiate.d.mts +9 -0
  385. package/build/type/engine/readonly_object/instantiate.mjs +15 -0
  386. package/build/type/engine/record/{from-key.d.mts → from_key.d.mts} +11 -11
  387. package/build/type/engine/record/{from-key.mjs → from_key.mjs} +11 -11
  388. package/build/type/engine/record/{from-key-any.mjs → from_key_any.mjs} +1 -1
  389. package/build/type/engine/record/{from-key-enum.d.mts → from_key_enum.d.mts} +3 -3
  390. package/build/type/engine/record/from_key_enum.mjs +8 -0
  391. package/build/type/engine/record/{from-key-integer.mjs → from_key_integer.mjs} +1 -1
  392. package/build/type/engine/record/{from-key-intersect.d.mts → from_key_intersect.d.mts} +1 -1
  393. package/build/type/engine/record/{from-key-intersect.mjs → from_key_intersect.mjs} +1 -1
  394. package/build/type/engine/record/{from-key-number.mjs → from_key_number.mjs} +1 -1
  395. package/build/type/engine/record/{from-key-string.mjs → from_key_string.mjs} +1 -1
  396. package/build/type/engine/record/{from-key-template-literal.d.mts → from_key_template_literal.d.mts} +4 -4
  397. package/build/type/engine/record/from_key_template_literal.mjs +12 -0
  398. package/build/type/engine/record/{from-key-union.mjs → from_key_union.mjs} +1 -1
  399. package/build/type/engine/record/instantiate.d.mts +4 -4
  400. package/build/type/engine/record/instantiate.mjs +9 -8
  401. package/build/type/engine/ref/instantiate.d.mts +4 -4
  402. package/build/type/engine/ref/instantiate.mjs +6 -6
  403. package/build/type/engine/required/{from-cyclic.d.mts → from_cyclic.d.mts} +1 -1
  404. package/build/type/engine/{readonly-type/from-cyclic.mjs → required/from_cyclic.mjs} +1 -1
  405. package/build/type/engine/required/from_dependent.d.mts +5 -0
  406. package/build/type/engine/required/from_dependent.mjs +8 -0
  407. package/build/type/engine/required/from_intersect.d.mts +5 -0
  408. package/build/type/engine/required/from_intersect.mjs +8 -0
  409. package/build/type/engine/required/{from-object.d.mts → from_object.d.mts} +2 -2
  410. package/build/type/engine/required/{from-object.mjs → from_object.mjs} +2 -2
  411. package/build/type/engine/required/from_type.d.mts +14 -0
  412. package/build/type/engine/required/from_type.mjs +20 -0
  413. package/build/type/engine/required/{from-union.d.mts → from_union.d.mts} +1 -1
  414. package/build/type/engine/required/{from-union.mjs → from_union.mjs} +1 -1
  415. package/build/type/engine/required/instantiate.d.mts +4 -4
  416. package/build/type/engine/required/instantiate.mjs +8 -7
  417. package/build/type/engine/return_type/instantiate.d.mts +12 -0
  418. package/build/type/engine/return_type/instantiate.mjs +21 -0
  419. package/build/type/engine/{template-literal → template_literal}/decode.d.mts +4 -4
  420. package/build/type/engine/{template-literal → template_literal}/decode.mjs +6 -12
  421. package/build/type/engine/{template-literal → template_literal}/encode.d.mts +6 -4
  422. package/build/type/engine/{template-literal → template_literal}/encode.mjs +17 -16
  423. package/build/type/engine/{template-literal → template_literal}/index.d.mts +2 -2
  424. package/build/type/engine/{template-literal → template_literal}/index.mjs +2 -2
  425. package/build/type/engine/{template-literal → template_literal}/instantiate.d.mts +4 -4
  426. package/build/type/engine/template_literal/instantiate.mjs +15 -0
  427. package/build/type/engine/{template-literal/is-finite.mjs → template_literal/is_finite.mjs} +3 -7
  428. package/build/type/engine/{template-literal/is-pattern.mjs → template_literal/is_pattern.mjs} +1 -0
  429. package/build/type/engine/this/expand_this.d.mts +16 -0
  430. package/build/type/engine/this/expand_this.mjs +26 -0
  431. package/build/type/engine/with/instantiate.d.mts +8 -0
  432. package/build/type/engine/with/instantiate.mjs +14 -0
  433. package/build/type/extends/any.d.mts +1 -1
  434. package/build/type/extends/any.mjs +1 -1
  435. package/build/type/extends/array.d.mts +2 -2
  436. package/build/type/extends/array.mjs +2 -2
  437. package/build/type/extends/bigint.d.mts +1 -1
  438. package/build/type/extends/bigint.mjs +1 -1
  439. package/build/type/extends/boolean.d.mts +1 -1
  440. package/build/type/extends/boolean.mjs +1 -1
  441. package/build/type/extends/constructor.d.mts +1 -1
  442. package/build/type/extends/constructor.mjs +1 -1
  443. package/build/type/extends/dependent.d.mts +6 -0
  444. package/build/type/extends/dependent.mjs +6 -0
  445. package/build/type/extends/enum.d.mts +5 -5
  446. package/build/type/extends/enum.mjs +4 -3
  447. package/build/type/extends/extends.d.mts +5 -3
  448. package/build/type/extends/extends.mjs +10 -8
  449. package/build/type/extends/{extends-left.d.mts → extends_left.d.mts} +7 -9
  450. package/build/type/extends/{extends-left.mjs → extends_left.mjs} +26 -29
  451. package/build/type/extends/{extends-right.d.mts → extends_right.d.mts} +9 -7
  452. package/build/type/extends/extends_right.mjs +49 -0
  453. package/build/type/extends/function.d.mts +1 -1
  454. package/build/type/extends/function.mjs +1 -1
  455. package/build/type/extends/inference.d.mts +1 -1
  456. package/build/type/extends/inference.mjs +2 -2
  457. package/build/type/extends/integer.d.mts +1 -1
  458. package/build/type/extends/integer.mjs +1 -1
  459. package/build/type/extends/intersect.d.mts +1 -1
  460. package/build/type/extends/intersect.mjs +1 -1
  461. package/build/type/extends/literal.d.mts +2 -2
  462. package/build/type/extends/literal.mjs +2 -2
  463. package/build/type/extends/never.d.mts +1 -1
  464. package/build/type/extends/never.mjs +1 -1
  465. package/build/type/extends/null.d.mts +1 -1
  466. package/build/type/extends/null.mjs +1 -1
  467. package/build/type/extends/number.d.mts +1 -1
  468. package/build/type/extends/number.mjs +1 -1
  469. package/build/type/extends/object.d.mts +10 -3
  470. package/build/type/extends/object.mjs +27 -5
  471. package/build/type/extends/parameters.d.mts +1 -1
  472. package/build/type/extends/parameters.mjs +4 -3
  473. package/build/type/extends/record.d.mts +13 -0
  474. package/build/type/extends/record.mjs +23 -0
  475. package/build/type/extends/result.d.mts +1 -4
  476. package/build/type/extends/result.mjs +0 -3
  477. package/build/type/extends/{return-type.d.mts → return_type.d.mts} +1 -1
  478. package/build/type/extends/{return-type.mjs → return_type.mjs} +1 -1
  479. package/build/type/extends/string.d.mts +1 -1
  480. package/build/type/extends/string.mjs +1 -1
  481. package/build/type/extends/symbol.d.mts +1 -1
  482. package/build/type/extends/symbol.mjs +1 -1
  483. package/build/type/extends/template_literal.d.mts +6 -0
  484. package/build/type/extends/template_literal.mjs +7 -0
  485. package/build/type/extends/tuple.d.mts +5 -8
  486. package/build/type/extends/tuple.mjs +8 -7
  487. package/build/type/extends/undefined.d.mts +1 -1
  488. package/build/type/extends/undefined.mjs +1 -1
  489. package/build/type/extends/union.d.mts +1 -1
  490. package/build/type/extends/union.mjs +4 -3
  491. package/build/type/extends/unknown.d.mts +1 -1
  492. package/build/type/extends/unknown.mjs +1 -1
  493. package/build/type/extends/void.d.mts +1 -1
  494. package/build/type/extends/void.mjs +1 -1
  495. package/build/type/script/mapping.d.mts +86 -98
  496. package/build/type/script/mapping.mjs +95 -92
  497. package/build/type/script/parser.d.mts +42 -40
  498. package/build/type/script/parser.mjs +23 -22
  499. package/build/type/script/script.d.mts +3 -4
  500. package/build/type/script/script.mjs +3 -2
  501. package/build/type/script/token/internal/guard.d.mts +1 -1
  502. package/build/type/script/token/internal/guard.mjs +1 -1
  503. package/build/type/script/token/internal/take.mjs +5 -9
  504. package/build/type/script/token/until.mjs +4 -7
  505. package/build/type/types/_codec.d.mts +12 -12
  506. package/build/type/types/_codec.mjs +0 -1
  507. package/build/type/types/_immutable.d.mts +2 -9
  508. package/build/type/types/_immutable.mjs +2 -10
  509. package/build/type/types/_optional.d.mts +2 -9
  510. package/build/type/types/_optional.mjs +2 -11
  511. package/build/type/types/_readonly.d.mts +2 -9
  512. package/build/type/types/_readonly.mjs +2 -10
  513. package/build/type/types/_refine.d.mts +13 -8
  514. package/build/type/types/_refine.mjs +20 -4
  515. package/build/type/types/array.d.mts +2 -1
  516. package/build/type/types/array.mjs +2 -1
  517. package/build/type/types/call.d.mts +3 -3
  518. package/build/type/types/call.mjs +3 -2
  519. package/build/type/types/deferred.d.mts +1 -0
  520. package/build/type/types/deferred.mjs +1 -1
  521. package/build/type/types/dependent.d.mts +17 -0
  522. package/build/type/types/{iterator.mjs → dependent.mjs} +9 -9
  523. package/build/type/types/enum.d.mts +5 -3
  524. package/build/type/types/enum.mjs +7 -2
  525. package/build/type/types/function.mjs +1 -1
  526. package/build/type/types/index.d.mts +2 -5
  527. package/build/type/types/index.mjs +2 -5
  528. package/build/type/types/number.d.mts +1 -1
  529. package/build/type/types/number.mjs +1 -1
  530. package/build/type/types/object.mjs +1 -1
  531. package/build/type/types/properties.d.mts +2 -1
  532. package/build/type/types/record.d.mts +19 -15
  533. package/build/type/types/record.mjs +19 -17
  534. package/build/type/types/static.d.mts +3 -6
  535. package/build/type/types/{template-literal.d.mts → template_literal.d.mts} +6 -4
  536. package/build/type/types/{template-literal.mjs → template_literal.mjs} +10 -4
  537. package/build/type/types/unsafe.d.mts +1 -2
  538. package/build/type/types/unsafe.mjs +5 -3
  539. package/build/typebox.d.mts +11 -15
  540. package/build/typebox.mjs +10 -14
  541. package/build/value/clean/clean.mjs +5 -3
  542. package/build/value/clean/{from-array.mjs → from_array.mjs} +1 -1
  543. package/build/value/clean/{from-cyclic.mjs → from_cyclic.mjs} +1 -1
  544. package/build/value/clean/{from-intersect.mjs → from_intersect.mjs} +3 -3
  545. package/build/value/clean/{from-object.mjs → from_object.mjs} +1 -1
  546. package/build/value/clean/{from-record.mjs → from_record.mjs} +1 -1
  547. package/build/value/clean/{from-ref.mjs → from_ref.mjs} +1 -1
  548. package/build/value/clean/{from-tuple.mjs → from_tuple.mjs} +1 -1
  549. package/build/value/clean/from_type.mjs +21 -0
  550. package/build/value/clean/{from-union.mjs → from_union.mjs} +2 -3
  551. package/build/value/clone/clone.mjs +2 -72
  552. package/build/value/codec/decode.mjs +5 -3
  553. package/build/value/codec/encode.mjs +5 -3
  554. package/build/value/codec/{from-array.mjs → from_array.mjs} +2 -5
  555. package/build/value/codec/{from-cyclic.mjs → from_cyclic.mjs} +1 -1
  556. package/build/value/codec/{from-intersect.mjs → from_intersect.mjs} +1 -1
  557. package/build/value/codec/{from-object.mjs → from_object.mjs} +3 -6
  558. package/build/value/codec/{from-record.mjs → from_record.mjs} +3 -8
  559. package/build/value/codec/{from-ref.mjs → from_ref.mjs} +1 -1
  560. package/build/value/codec/{from-tuple.mjs → from_tuple.mjs} +2 -5
  561. package/build/value/codec/{from-type.mjs → from_type.mjs} +8 -8
  562. package/build/value/codec/{from-union.mjs → from_union.mjs} +3 -4
  563. package/build/value/convert/convert.mjs +1 -1
  564. package/build/value/convert/{from-additional.mjs → from_additional.mjs} +1 -1
  565. package/build/value/convert/from_array.mjs +7 -0
  566. package/build/value/convert/{from-bigint.mjs → from_bigint.mjs} +0 -3
  567. package/build/value/convert/{from-boolean.mjs → from_boolean.mjs} +0 -3
  568. package/build/value/convert/{from-cyclic.mjs → from_cyclic.mjs} +1 -1
  569. package/build/value/convert/from_enum.mjs +6 -0
  570. package/build/value/convert/{from-integer.mjs → from_integer.mjs} +0 -3
  571. package/build/value/convert/{from-intersect.mjs → from_intersect.mjs} +1 -1
  572. package/build/value/convert/{from-literal.d.mts → from_literal.d.mts} +1 -1
  573. package/build/value/convert/{from-null.mjs → from_null.mjs} +0 -3
  574. package/build/value/convert/{from-number.mjs → from_number.mjs} +0 -3
  575. package/build/value/convert/{from-object.mjs → from_object.mjs} +3 -3
  576. package/build/value/convert/{from-record.mjs → from_record.mjs} +2 -2
  577. package/build/value/convert/{from-ref.mjs → from_ref.mjs} +1 -1
  578. package/build/value/convert/{from-string.mjs → from_string.mjs} +0 -3
  579. package/build/value/convert/{from-template-literal.d.mts → from_template_literal.d.mts} +1 -1
  580. package/build/value/convert/from_template_literal.mjs +6 -0
  581. package/build/value/convert/{from-tuple.mjs → from_tuple.mjs} +1 -1
  582. package/build/value/convert/from_type.d.mts +2 -0
  583. package/build/value/convert/from_type.mjs +43 -0
  584. package/build/value/convert/{from-undefined.mjs → from_undefined.mjs} +0 -3
  585. package/build/value/convert/{from-union.mjs → from_union.mjs} +1 -1
  586. package/build/value/convert/{from-void.mjs → from_void.mjs} +0 -3
  587. package/build/value/convert/try/try.d.mts +8 -7
  588. package/build/value/convert/try/try.mjs +8 -7
  589. package/build/value/convert/try/try_array.d.mts +2 -0
  590. package/build/value/convert/try/try_array.mjs +6 -0
  591. package/build/value/convert/try/{try-bigint.d.mts → try_bigint.d.mts} +1 -1
  592. package/build/value/convert/try/{try-bigint.mjs → try_bigint.mjs} +5 -34
  593. package/build/value/convert/try/{try-boolean.d.mts → try_boolean.d.mts} +1 -1
  594. package/build/value/convert/try/{try-boolean.mjs → try_boolean.mjs} +4 -27
  595. package/build/value/convert/try/{try-null.d.mts → try_null.d.mts} +1 -1
  596. package/build/value/convert/try/{try-null.mjs → try_null.mjs} +3 -20
  597. package/build/value/convert/try/{try-number.d.mts → try_number.d.mts} +1 -1
  598. package/build/value/convert/try/try_number.mjs +44 -0
  599. package/build/value/convert/try/{try-result.mjs → try_result.mjs} +0 -1
  600. package/build/value/convert/try/{try-string.d.mts → try_string.d.mts} +1 -1
  601. package/build/value/convert/try/try_string.mjs +12 -0
  602. package/build/value/convert/try/{try-undefined.d.mts → try_undefined.d.mts} +1 -1
  603. package/build/value/convert/try/{try-undefined.mjs → try_undefined.mjs} +3 -20
  604. package/build/value/create/create.mjs +1 -1
  605. package/build/value/create/{from-array.mjs → from_array.mjs} +1 -1
  606. package/build/value/create/{from-constructor.mjs → from_constructor.mjs} +1 -1
  607. package/build/value/create/{from-cyclic.mjs → from_cyclic.mjs} +1 -1
  608. package/build/value/create/from_enum.mjs +6 -0
  609. package/build/value/create/{from-function.mjs → from_function.mjs} +1 -1
  610. package/build/value/create/{from-intersect.mjs → from_intersect.mjs} +1 -1
  611. package/build/value/create/{from-object.mjs → from_object.mjs} +1 -1
  612. package/build/value/create/{from-ref.mjs → from_ref.mjs} +1 -1
  613. package/build/value/create/{from-template-literal.mjs → from_template_literal.mjs} +2 -2
  614. package/build/value/create/{from-tuple.mjs → from_tuple.mjs} +1 -1
  615. package/build/value/create/from_type.mjs +61 -0
  616. package/build/value/create/{from-union.mjs → from_union.mjs} +1 -1
  617. package/build/value/default/default.mjs +1 -1
  618. package/build/value/default/{from-array.mjs → from_array.mjs} +1 -1
  619. package/build/value/{clean/from-cyclic.d.mts → default/from_cyclic.d.mts} +1 -1
  620. package/build/value/default/{from-cyclic.mjs → from_cyclic.mjs} +1 -1
  621. package/build/value/default/{from-intersect.mjs → from_intersect.mjs} +1 -1
  622. package/build/value/default/{from-object.mjs → from_object.mjs} +2 -2
  623. package/build/value/default/{from-record.mjs → from_record.mjs} +1 -1
  624. package/build/value/default/{from-ref.mjs → from_ref.mjs} +1 -1
  625. package/build/value/default/{from-tuple.mjs → from_tuple.mjs} +1 -1
  626. package/build/value/default/from_type.mjs +25 -0
  627. package/build/value/default/{from-union.mjs → from_union.mjs} +1 -1
  628. package/build/value/delta/diff.mjs +6 -0
  629. package/build/value/errors/errors.d.mts +2 -2
  630. package/build/value/errors/errors.mjs +1 -1
  631. package/build/value/index.d.mts +0 -1
  632. package/build/value/index.mjs +0 -1
  633. package/build/value/repair/{from-array.mjs → from_array.mjs} +1 -1
  634. package/build/value/repair/from_enum.mjs +6 -0
  635. package/build/value/repair/from_intersect.d.mts +2 -0
  636. package/build/value/repair/{from-intersect.mjs → from_intersect.mjs} +1 -1
  637. package/build/value/repair/{from-object.mjs → from_object.mjs} +1 -1
  638. package/build/value/repair/{from-record.mjs → from_record.mjs} +1 -1
  639. package/build/value/repair/{from-ref.mjs → from_ref.mjs} +1 -1
  640. package/build/value/{convert/from-template-literal.mjs → repair/from_template_literal.mjs} +2 -2
  641. package/build/value/repair/{from-tuple.mjs → from_tuple.mjs} +1 -1
  642. package/build/value/repair/{from-type.mjs → from_type.mjs} +34 -32
  643. package/build/value/{clean/from-union.d.mts → repair/from_union.d.mts} +1 -1
  644. package/build/value/repair/{from-union.mjs → from_union.mjs} +2 -2
  645. package/build/value/repair/repair.mjs +1 -1
  646. package/build/value/shared/index.d.mts +3 -3
  647. package/build/value/shared/index.mjs +3 -3
  648. package/build/value/shared/union_priority_sort.d.mts +7 -0
  649. package/build/value/shared/union_priority_sort.mjs +72 -0
  650. package/build/value/value.d.mts +0 -1
  651. package/build/value/value.mjs +0 -1
  652. package/changes.json +1 -1
  653. package/package.json +22 -22
  654. package/readme.md +214 -95
  655. package/build/format/idn-email.mjs +0 -8
  656. package/build/schema/engine/_guard.d.mts +0 -6
  657. package/build/schema/engine/_guard.mjs +0 -26
  658. package/build/schema/static/~non-readonly.d.mts +0 -7
  659. package/build/schema/static/~readonly.d.mts +0 -6
  660. package/build/schema/static/~readonly.mjs +0 -2
  661. package/build/schema/types/_guard.d.mts +0 -10
  662. package/build/schema/types/_guard.mjs +0 -16
  663. package/build/type/action/_optional.d.mts +0 -19
  664. package/build/type/action/_optional.mjs +0 -40
  665. package/build/type/action/_readonly.d.mts +0 -19
  666. package/build/type/action/_readonly.mjs +0 -40
  667. package/build/type/action/awaited.d.mts +0 -11
  668. package/build/type/action/awaited.mjs +0 -12
  669. package/build/type/action/options.d.mts +0 -12
  670. package/build/type/action/options.mjs +0 -12
  671. package/build/type/action/readonly-type.d.mts +0 -11
  672. package/build/type/action/readonly-type.mjs +0 -12
  673. package/build/type/engine/awaited/instantiate.d.mts +0 -10
  674. package/build/type/engine/awaited/instantiate.mjs +0 -19
  675. package/build/type/engine/constructor-parameters/instantiate.d.mts +0 -14
  676. package/build/type/engine/constructor-parameters/instantiate.mjs +0 -22
  677. package/build/type/engine/enum/enum-to-union.d.mts +0 -14
  678. package/build/type/engine/enum/enum-to-union.mjs +0 -24
  679. package/build/type/engine/indexable/from-enum.d.mts +0 -6
  680. package/build/type/engine/indexable/from-enum.mjs +0 -8
  681. package/build/type/engine/indexable/from-template-literal.d.mts +0 -5
  682. package/build/type/engine/indexable/from-template-literal.mjs +0 -8
  683. package/build/type/engine/indexable/from-type.d.mts +0 -17
  684. package/build/type/engine/indexable/from-type.mjs +0 -22
  685. package/build/type/engine/indexed/from-object.d.mts +0 -9
  686. package/build/type/engine/indexed/from-object.mjs +0 -18
  687. package/build/type/engine/instance-type/instantiate.d.mts +0 -12
  688. package/build/type/engine/intrinsics/from-template-literal.mjs +0 -8
  689. package/build/type/engine/mapped/mapped-variants.d.mts +0 -15
  690. package/build/type/engine/mapped/mapped-variants.mjs +0 -29
  691. package/build/type/engine/non-nullable/instantiate.d.mts +0 -15
  692. package/build/type/engine/non-nullable/instantiate.mjs +0 -22
  693. package/build/type/engine/object/from-type.d.mts +0 -14
  694. package/build/type/engine/object/from-type.mjs +0 -20
  695. package/build/type/engine/options/instantiate.d.mts +0 -8
  696. package/build/type/engine/options/instantiate.mjs +0 -13
  697. package/build/type/engine/partial/from-intersect.d.mts +0 -5
  698. package/build/type/engine/partial/from-intersect.mjs +0 -7
  699. package/build/type/engine/partial/from-type.d.mts +0 -12
  700. package/build/type/engine/partial/from-type.mjs +0 -17
  701. package/build/type/engine/readonly-type/from-intersect.d.mts +0 -5
  702. package/build/type/engine/readonly-type/from-intersect.mjs +0 -7
  703. package/build/type/engine/readonly-type/from-type.d.mts +0 -16
  704. package/build/type/engine/readonly-type/from-type.mjs +0 -22
  705. package/build/type/engine/readonly-type/instantiate.d.mts +0 -9
  706. package/build/type/engine/readonly-type/instantiate.mjs +0 -14
  707. package/build/type/engine/record/from-key-enum.mjs +0 -8
  708. package/build/type/engine/record/from-key-template-literal.mjs +0 -12
  709. package/build/type/engine/required/from-intersect.d.mts +0 -5
  710. package/build/type/engine/required/from-intersect.mjs +0 -7
  711. package/build/type/engine/required/from-type.d.mts +0 -12
  712. package/build/type/engine/required/from-type.mjs +0 -17
  713. package/build/type/engine/return-type/index.d.mts +0 -1
  714. package/build/type/engine/return-type/index.mjs +0 -1
  715. package/build/type/engine/return-type/instantiate.d.mts +0 -11
  716. package/build/type/engine/return-type/instantiate.mjs +0 -18
  717. package/build/type/engine/template-literal/instantiate.mjs +0 -14
  718. package/build/type/extends/async-iterator.d.mts +0 -7
  719. package/build/type/extends/async-iterator.mjs +0 -9
  720. package/build/type/extends/extends-right.mjs +0 -43
  721. package/build/type/extends/iterator.d.mts +0 -7
  722. package/build/type/extends/iterator.mjs +0 -9
  723. package/build/type/extends/promise.d.mts +0 -7
  724. package/build/type/extends/promise.mjs +0 -9
  725. package/build/type/extends/template-literal.d.mts +0 -6
  726. package/build/type/extends/template-literal.mjs +0 -7
  727. package/build/type/types/async-iterator.d.mts +0 -16
  728. package/build/type/types/async-iterator.mjs +0 -24
  729. package/build/type/types/base.d.mts +0 -50
  730. package/build/type/types/base.mjs +0 -84
  731. package/build/type/types/iterator.d.mts +0 -16
  732. package/build/type/types/promise.d.mts +0 -16
  733. package/build/type/types/promise.mjs +0 -24
  734. package/build/value/clean/from-base.d.mts +0 -2
  735. package/build/value/clean/from-base.mjs +0 -4
  736. package/build/value/clean/from-type.mjs +0 -23
  737. package/build/value/convert/from-array.mjs +0 -8
  738. package/build/value/convert/from-base.d.mts +0 -2
  739. package/build/value/convert/from-base.mjs +0 -4
  740. package/build/value/convert/from-enum.mjs +0 -7
  741. package/build/value/convert/from-type.mjs +0 -45
  742. package/build/value/convert/try/try-number.mjs +0 -76
  743. package/build/value/convert/try/try-string.mjs +0 -56
  744. package/build/value/create/from-async-iterator.d.mts +0 -2
  745. package/build/value/create/from-async-iterator.mjs +0 -5
  746. package/build/value/create/from-base.d.mts +0 -2
  747. package/build/value/create/from-base.mjs +0 -4
  748. package/build/value/create/from-enum.mjs +0 -6
  749. package/build/value/create/from-iterator.d.mts +0 -2
  750. package/build/value/create/from-iterator.mjs +0 -5
  751. package/build/value/create/from-promise.d.mts +0 -2
  752. package/build/value/create/from-promise.mjs +0 -5
  753. package/build/value/create/from-type.mjs +0 -69
  754. package/build/value/default/from-base.d.mts +0 -2
  755. package/build/value/default/from-base.mjs +0 -5
  756. package/build/value/default/from-intersect.d.mts +0 -2
  757. package/build/value/default/from-type.mjs +0 -27
  758. package/build/value/mutate/error.d.mts +0 -3
  759. package/build/value/mutate/error.mjs +0 -6
  760. package/build/value/mutate/from-array.d.mts +0 -2
  761. package/build/value/mutate/from-array.mjs +0 -16
  762. package/build/value/mutate/from-object.d.mts +0 -2
  763. package/build/value/mutate/from-object.mjs +0 -27
  764. package/build/value/mutate/from-unknown.d.mts +0 -2
  765. package/build/value/mutate/from-unknown.mjs +0 -7
  766. package/build/value/mutate/from-value.d.mts +0 -2
  767. package/build/value/mutate/from-value.mjs +0 -12
  768. package/build/value/mutate/index.d.mts +0 -1
  769. package/build/value/mutate/index.mjs +0 -1
  770. package/build/value/mutate/mutate.d.mts +0 -9
  771. package/build/value/mutate/mutate.mjs +0 -39
  772. package/build/value/repair/from-base.d.mts +0 -2
  773. package/build/value/repair/from-base.mjs +0 -8
  774. package/build/value/repair/from-enum.mjs +0 -7
  775. package/build/value/repair/from-template-literal.mjs +0 -7
  776. package/build/value/repair/from-type.d.mts +0 -2
  777. package/build/value/shared/union-priority-sort.d.mts +0 -3
  778. package/build/value/shared/union-priority-sort.mjs +0 -36
  779. /package/build/format/{date-time.d.mts → date_time.d.mts} +0 -0
  780. /package/build/format/{date-time.mjs → date_time.mjs} +0 -0
  781. /package/build/format/{idn-hostname.d.mts → idn_hostname.d.mts} +0 -0
  782. /package/build/format/{idn-hostname.mjs → idn_hostname.mjs} +0 -0
  783. /package/build/format/{iri-reference.d.mts → iri_reference.d.mts} +0 -0
  784. /package/build/format/{iri-reference.mjs → iri_reference.mjs} +0 -0
  785. /package/build/format/{json-pointer.d.mts → json_pointer.d.mts} +0 -0
  786. /package/build/format/{json-pointer.mjs → json_pointer.mjs} +0 -0
  787. /package/build/format/{json-pointer-uri-fragment.d.mts → json_pointer_uri_fragment.d.mts} +0 -0
  788. /package/build/format/{json-pointer-uri-fragment.mjs → json_pointer_uri_fragment.mjs} +0 -0
  789. /package/build/format/{relative-json-pointer.d.mts → relative_json_pointer.d.mts} +0 -0
  790. /package/build/format/{relative-json-pointer.mjs → relative_json_pointer.mjs} +0 -0
  791. /package/build/format/{uri-reference.d.mts → uri_reference.d.mts} +0 -0
  792. /package/build/format/{uri-reference.mjs → uri_reference.mjs} +0 -0
  793. /package/build/format/{uri-template.d.mts → uri_template.d.mts} +0 -0
  794. /package/build/format/{uri-template.mjs → uri_template.mjs} +0 -0
  795. /package/build/schema/pointer/{pointer-get.d.mts → pointer_get.d.mts} +0 -0
  796. /package/build/schema/pointer/{pointer-get.mjs → pointer_get.mjs} +0 -0
  797. /package/build/schema/static/{~comparer.mjs → _canonical.mjs} +0 -0
  798. /package/build/schema/static/{~comparer.d.mts → _comparer.d.mts} +0 -0
  799. /package/build/schema/static/{~elements.mjs → _comparer.mjs} +0 -0
  800. /package/build/schema/static/{~non-readonly.mjs → _elements.mjs} +0 -0
  801. /package/build/type/engine/call/{distribute-arguments.d.mts → distribute_arguments.d.mts} +0 -0
  802. /package/build/type/engine/call/{resolve-arguments.d.mts → resolve_arguments.d.mts} +0 -0
  803. /package/build/type/engine/call/{resolve-target.d.mts → resolve_target.d.mts} +0 -0
  804. /package/build/type/engine/call/{resolve-target.mjs → resolve_target.mjs} +0 -0
  805. /package/build/type/engine/{awaited → constructor_parameters}/index.d.mts +0 -0
  806. /package/build/type/engine/{awaited → constructor_parameters}/index.mjs +0 -0
  807. /package/build/type/engine/enum/{typescript-enum-to-enum-values.d.mts → typescript_enum_to_enum_values.d.mts} +0 -0
  808. /package/build/type/engine/enum/{typescript-enum-to-enum-values.mjs → typescript_enum_to_enum_values.mjs} +0 -0
  809. /package/build/type/engine/helpers/{keys-to-indexer.d.mts → keys_to_indexer.d.mts} +0 -0
  810. /package/build/type/engine/helpers/{keys-to-indexer.mjs → keys_to_indexer.mjs} +0 -0
  811. /package/build/type/engine/indexable/{from-literal.mjs → from_literal.mjs} +0 -0
  812. /package/build/type/engine/indexable/{to-indexable.d.mts → to_indexable.d.mts} +0 -0
  813. /package/build/type/engine/indexable/{to-indexable.mjs → to_indexable.mjs} +0 -0
  814. /package/build/type/engine/indexed/{array-indexer.d.mts → array_indexer.d.mts} +0 -0
  815. /package/build/type/engine/indexed/{array-indexer.mjs → array_indexer.mjs} +0 -0
  816. /package/build/type/engine/indexed/{from-array.d.mts → from_array.d.mts} +0 -0
  817. /package/build/type/engine/indexed/{from-array.mjs → from_array.mjs} +0 -0
  818. /package/build/type/engine/{constructor-parameters → instance_type}/index.d.mts +0 -0
  819. /package/build/type/engine/{constructor-parameters → instance_type}/index.mjs +0 -0
  820. /package/build/type/engine/intrinsics/{from-literal.d.mts → from_literal.d.mts} +0 -0
  821. /package/build/type/engine/intrinsics/{from-literal.mjs → from_literal.mjs} +0 -0
  822. /package/build/type/engine/keyof/{from-any.d.mts → from_any.d.mts} +0 -0
  823. /package/build/type/engine/keyof/{from-any.mjs → from_any.mjs} +0 -0
  824. /package/build/type/engine/keyof/{from-array.d.mts → from_array.d.mts} +0 -0
  825. /package/build/type/engine/keyof/{from-array.mjs → from_array.mjs} +0 -0
  826. /package/build/type/engine/keyof/{from-object.d.mts → from_object.d.mts} +0 -0
  827. /package/build/type/engine/keyof/{from-object.mjs → from_object.mjs} +0 -0
  828. /package/build/type/engine/keyof/{from-record.d.mts → from_record.d.mts} +0 -0
  829. /package/build/type/engine/keyof/{from-record.mjs → from_record.mjs} +0 -0
  830. /package/build/type/engine/keyof/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  831. /package/build/type/engine/keyof/{from-tuple.mjs → from_tuple.mjs} +0 -0
  832. /package/build/type/engine/{instance-type → non_nullable}/index.d.mts +0 -0
  833. /package/build/type/engine/{instance-type → non_nullable}/index.mjs +0 -0
  834. /package/build/type/engine/object/{from-object.d.mts → from_object.d.mts} +0 -0
  835. /package/build/type/engine/object/{from-object.mjs → from_object.mjs} +0 -0
  836. /package/build/type/engine/{non-nullable → readonly_object}/index.d.mts +0 -0
  837. /package/build/type/engine/{non-nullable → readonly_object}/index.mjs +0 -0
  838. /package/build/type/engine/record/{from-key-any.d.mts → from_key_any.d.mts} +0 -0
  839. /package/build/type/engine/record/{from-key-boolean.d.mts → from_key_boolean.d.mts} +0 -0
  840. /package/build/type/engine/record/{from-key-boolean.mjs → from_key_boolean.mjs} +0 -0
  841. /package/build/type/engine/record/{from-key-integer.d.mts → from_key_integer.d.mts} +0 -0
  842. /package/build/type/engine/record/{from-key-literal.d.mts → from_key_literal.d.mts} +0 -0
  843. /package/build/type/engine/record/{from-key-literal.mjs → from_key_literal.mjs} +0 -0
  844. /package/build/type/engine/record/{from-key-number.d.mts → from_key_number.d.mts} +0 -0
  845. /package/build/type/engine/record/{from-key-string.d.mts → from_key_string.d.mts} +0 -0
  846. /package/build/type/engine/record/{from-key-union.d.mts → from_key_union.d.mts} +0 -0
  847. /package/build/type/engine/record/{record-create.d.mts → record_create.d.mts} +0 -0
  848. /package/build/type/engine/record/{record-create.mjs → record_create.mjs} +0 -0
  849. /package/build/type/engine/{options → return_type}/index.d.mts +0 -0
  850. /package/build/type/engine/{options → return_type}/index.mjs +0 -0
  851. /package/build/type/engine/{template-literal → template_literal}/create.d.mts +0 -0
  852. /package/build/type/engine/{template-literal → template_literal}/create.mjs +0 -0
  853. /package/build/type/engine/{template-literal/is-finite.d.mts → template_literal/is_finite.d.mts} +0 -0
  854. /package/build/type/engine/{template-literal/is-pattern.d.mts → template_literal/is_pattern.d.mts} +0 -0
  855. /package/build/type/engine/{template-literal → template_literal}/static.d.mts +0 -0
  856. /package/build/type/engine/{template-literal → template_literal}/static.mjs +0 -0
  857. /package/build/type/engine/tuple/{to-object.d.mts → to_object.d.mts} +0 -0
  858. /package/build/type/engine/tuple/{to-object.mjs → to_object.mjs} +0 -0
  859. /package/build/type/engine/{readonly-type → with}/index.d.mts +0 -0
  860. /package/build/type/engine/{readonly-type → with}/index.mjs +0 -0
  861. /package/build/value/clean/{from-array.d.mts → from_array.d.mts} +0 -0
  862. /package/build/value/{convert/from-cyclic.d.mts → clean/from_cyclic.d.mts} +0 -0
  863. /package/build/value/clean/{from-intersect.d.mts → from_intersect.d.mts} +0 -0
  864. /package/build/value/clean/{from-object.d.mts → from_object.d.mts} +0 -0
  865. /package/build/value/clean/{from-record.d.mts → from_record.d.mts} +0 -0
  866. /package/build/value/clean/{from-ref.d.mts → from_ref.d.mts} +0 -0
  867. /package/build/value/clean/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  868. /package/build/value/clean/{from-type.d.mts → from_type.d.mts} +0 -0
  869. /package/build/value/{repair/from-union.d.mts → clean/from_union.d.mts} +0 -0
  870. /package/build/value/codec/{from-array.d.mts → from_array.d.mts} +0 -0
  871. /package/build/value/codec/{from-cyclic.d.mts → from_cyclic.d.mts} +0 -0
  872. /package/build/value/codec/{from-intersect.d.mts → from_intersect.d.mts} +0 -0
  873. /package/build/value/codec/{from-object.d.mts → from_object.d.mts} +0 -0
  874. /package/build/value/codec/{from-record.d.mts → from_record.d.mts} +0 -0
  875. /package/build/value/codec/{from-ref.d.mts → from_ref.d.mts} +0 -0
  876. /package/build/value/codec/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  877. /package/build/value/codec/{from-type.d.mts → from_type.d.mts} +0 -0
  878. /package/build/value/codec/{from-union.d.mts → from_union.d.mts} +0 -0
  879. /package/build/value/convert/{from-additional.d.mts → from_additional.d.mts} +0 -0
  880. /package/build/value/convert/{from-array.d.mts → from_array.d.mts} +0 -0
  881. /package/build/value/convert/{from-bigint.d.mts → from_bigint.d.mts} +0 -0
  882. /package/build/value/convert/{from-boolean.d.mts → from_boolean.d.mts} +0 -0
  883. /package/build/value/{default/from-cyclic.d.mts → convert/from_cyclic.d.mts} +0 -0
  884. /package/build/value/convert/{from-enum.d.mts → from_enum.d.mts} +0 -0
  885. /package/build/value/convert/{from-integer.d.mts → from_integer.d.mts} +0 -0
  886. /package/build/value/convert/{from-intersect.d.mts → from_intersect.d.mts} +0 -0
  887. /package/build/value/convert/{from-literal.mjs → from_literal.mjs} +0 -0
  888. /package/build/value/convert/{from-null.d.mts → from_null.d.mts} +0 -0
  889. /package/build/value/convert/{from-number.d.mts → from_number.d.mts} +0 -0
  890. /package/build/value/convert/{from-object.d.mts → from_object.d.mts} +0 -0
  891. /package/build/value/convert/{from-record.d.mts → from_record.d.mts} +0 -0
  892. /package/build/value/convert/{from-ref.d.mts → from_ref.d.mts} +0 -0
  893. /package/build/value/convert/{from-string.d.mts → from_string.d.mts} +0 -0
  894. /package/build/value/convert/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  895. /package/build/value/convert/{from-undefined.d.mts → from_undefined.d.mts} +0 -0
  896. /package/build/value/convert/{from-union.d.mts → from_union.d.mts} +0 -0
  897. /package/build/value/convert/{from-void.d.mts → from_void.d.mts} +0 -0
  898. /package/build/value/convert/try/{try-result.d.mts → try_result.d.mts} +0 -0
  899. /package/build/value/create/{from-array.d.mts → from_array.d.mts} +0 -0
  900. /package/build/value/create/{from-bigint.d.mts → from_bigint.d.mts} +0 -0
  901. /package/build/value/create/{from-bigint.mjs → from_bigint.mjs} +0 -0
  902. /package/build/value/create/{from-boolean.d.mts → from_boolean.d.mts} +0 -0
  903. /package/build/value/create/{from-boolean.mjs → from_boolean.mjs} +0 -0
  904. /package/build/value/create/{from-constructor.d.mts → from_constructor.d.mts} +0 -0
  905. /package/build/value/create/{from-cyclic.d.mts → from_cyclic.d.mts} +0 -0
  906. /package/build/value/create/{from-default.d.mts → from_default.d.mts} +0 -0
  907. /package/build/value/create/{from-default.mjs → from_default.mjs} +0 -0
  908. /package/build/value/create/{from-enum.d.mts → from_enum.d.mts} +0 -0
  909. /package/build/value/create/{from-function.d.mts → from_function.d.mts} +0 -0
  910. /package/build/value/create/{from-integer.d.mts → from_integer.d.mts} +0 -0
  911. /package/build/value/create/{from-integer.mjs → from_integer.mjs} +0 -0
  912. /package/build/value/create/{from-intersect.d.mts → from_intersect.d.mts} +0 -0
  913. /package/build/value/create/{from-literal.d.mts → from_literal.d.mts} +0 -0
  914. /package/build/value/create/{from-literal.mjs → from_literal.mjs} +0 -0
  915. /package/build/value/create/{from-never.d.mts → from_never.d.mts} +0 -0
  916. /package/build/value/create/{from-never.mjs → from_never.mjs} +0 -0
  917. /package/build/value/create/{from-null.d.mts → from_null.d.mts} +0 -0
  918. /package/build/value/create/{from-null.mjs → from_null.mjs} +0 -0
  919. /package/build/value/create/{from-number.d.mts → from_number.d.mts} +0 -0
  920. /package/build/value/create/{from-number.mjs → from_number.mjs} +0 -0
  921. /package/build/value/create/{from-object.d.mts → from_object.d.mts} +0 -0
  922. /package/build/value/create/{from-record.d.mts → from_record.d.mts} +0 -0
  923. /package/build/value/create/{from-record.mjs → from_record.mjs} +0 -0
  924. /package/build/value/create/{from-ref.d.mts → from_ref.d.mts} +0 -0
  925. /package/build/value/create/{from-string.d.mts → from_string.d.mts} +0 -0
  926. /package/build/value/create/{from-string.mjs → from_string.mjs} +0 -0
  927. /package/build/value/create/{from-symbol.d.mts → from_symbol.d.mts} +0 -0
  928. /package/build/value/create/{from-symbol.mjs → from_symbol.mjs} +0 -0
  929. /package/build/value/create/{from-template-literal.d.mts → from_template_literal.d.mts} +0 -0
  930. /package/build/value/create/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  931. /package/build/value/create/{from-type.d.mts → from_type.d.mts} +0 -0
  932. /package/build/value/create/{from-undefined.d.mts → from_undefined.d.mts} +0 -0
  933. /package/build/value/create/{from-undefined.mjs → from_undefined.mjs} +0 -0
  934. /package/build/value/create/{from-union.d.mts → from_union.d.mts} +0 -0
  935. /package/build/value/create/{from-void.d.mts → from_void.d.mts} +0 -0
  936. /package/build/value/create/{from-void.mjs → from_void.mjs} +0 -0
  937. /package/build/value/default/{from-array.d.mts → from_array.d.mts} +0 -0
  938. /package/build/value/default/{from-default.d.mts → from_default.d.mts} +0 -0
  939. /package/build/value/default/{from-default.mjs → from_default.mjs} +0 -0
  940. /package/build/value/{repair/from-intersect.d.mts → default/from_intersect.d.mts} +0 -0
  941. /package/build/value/default/{from-object.d.mts → from_object.d.mts} +0 -0
  942. /package/build/value/default/{from-record.d.mts → from_record.d.mts} +0 -0
  943. /package/build/value/default/{from-ref.d.mts → from_ref.d.mts} +0 -0
  944. /package/build/value/default/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  945. /package/build/value/{convert/from-type.d.mts → default/from_type.d.mts} +0 -0
  946. /package/build/value/default/{from-union.d.mts → from_union.d.mts} +0 -0
  947. /package/build/value/repair/{from-array.d.mts → from_array.d.mts} +0 -0
  948. /package/build/value/repair/{from-enum.d.mts → from_enum.d.mts} +0 -0
  949. /package/build/value/repair/{from-object.d.mts → from_object.d.mts} +0 -0
  950. /package/build/value/repair/{from-record.d.mts → from_record.d.mts} +0 -0
  951. /package/build/value/repair/{from-ref.d.mts → from_ref.d.mts} +0 -0
  952. /package/build/value/repair/{from-template-literal.d.mts → from_template_literal.d.mts} +0 -0
  953. /package/build/value/repair/{from-tuple.d.mts → from_tuple.d.mts} +0 -0
  954. /package/build/value/{default/from-type.d.mts → repair/from_type.d.mts} +0 -0
  955. /package/build/value/repair/{from-unknown.d.mts → from_unknown.d.mts} +0 -0
  956. /package/build/value/repair/{from-unknown.mjs → from_unknown.mjs} +0 -0
  957. /package/build/value/shared/{optional-undefined.d.mts → optional_undefined.d.mts} +0 -0
  958. /package/build/value/shared/{optional-undefined.mjs → optional_undefined.mjs} +0 -0
  959. /package/build/value/shared/{union-score-select.d.mts → union_score_select.d.mts} +0 -0
  960. /package/build/value/shared/{union-score-select.mjs → union_score_select.mjs} +0 -0
@@ -1,8 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { FromType } from './from-type.mjs';
3
- import { Guard } from '../../guard/index.mjs';
4
- export function FromArray(context, type, value) {
5
- return Guard.IsArray(value)
6
- ? value.map(value => FromType(context, type.items, value))
7
- : value;
8
- }
@@ -1,2 +0,0 @@
1
- import type { Base, TProperties } from '../../type/index.mjs';
2
- export declare function FromBase(_context: TProperties, type: Base, value: unknown): unknown;
@@ -1,4 +0,0 @@
1
- // deno-fmt-ignore-file
2
- export function FromBase(_context, type, value) {
3
- return type.Convert(value);
4
- }
@@ -1,7 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { EnumToUnion } from '../../type/engine/enum/index.mjs';
3
- import { FromUnion } from './from-union.mjs';
4
- export function FromEnum(context, type, value) {
5
- const union = EnumToUnion(type);
6
- return FromUnion(context, union, value);
7
- }
@@ -1,45 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import * as T from '../../type/index.mjs';
3
- import { FromArray } from './from-array.mjs';
4
- import { FromBase } from './from-base.mjs';
5
- import { FromBigInt } from './from-bigint.mjs';
6
- import { FromBoolean } from './from-boolean.mjs';
7
- import { FromCyclic } from './from-cyclic.mjs';
8
- import { FromEnum } from './from-enum.mjs';
9
- import { FromInteger } from './from-integer.mjs';
10
- import { FromIntersect } from './from-intersect.mjs';
11
- import { FromLiteral } from './from-literal.mjs';
12
- import { FromNull } from './from-null.mjs';
13
- import { FromNumber } from './from-number.mjs';
14
- import { FromObject } from './from-object.mjs';
15
- import { FromRecord } from './from-record.mjs';
16
- import { FromRef } from './from-ref.mjs';
17
- import { FromString } from './from-string.mjs';
18
- import { FromTemplateLiteral } from './from-template-literal.mjs';
19
- import { FromTuple } from './from-tuple.mjs';
20
- import { FromUndefined } from './from-undefined.mjs';
21
- import { FromUnion } from './from-union.mjs';
22
- import { FromVoid } from './from-void.mjs';
23
- export function FromType(context, type, value) {
24
- return (T.IsArray(type) ? FromArray(context, type, value) :
25
- T.IsBase(type) ? FromBase(context, type, value) :
26
- T.IsBigInt(type) ? FromBigInt(context, type, value) :
27
- T.IsBoolean(type) ? FromBoolean(context, type, value) :
28
- T.IsCyclic(type) ? FromCyclic(context, type, value) :
29
- T.IsEnum(type) ? FromEnum(context, type, value) :
30
- T.IsInteger(type) ? FromInteger(context, type, value) :
31
- T.IsIntersect(type) ? FromIntersect(context, type, value) :
32
- T.IsLiteral(type) ? FromLiteral(context, type, value) :
33
- T.IsNull(type) ? FromNull(context, type, value) :
34
- T.IsNumber(type) ? FromNumber(context, type, value) :
35
- T.IsObject(type) ? FromObject(context, type, value) :
36
- T.IsRecord(type) ? FromRecord(context, type, value) :
37
- T.IsRef(type) ? FromRef(context, type, value) :
38
- T.IsString(type) ? FromString(context, type, value) :
39
- T.IsTemplateLiteral(type) ? FromTemplateLiteral(context, type, value) :
40
- T.IsTuple(type) ? FromTuple(context, type, value) :
41
- T.IsUndefined(type) ? FromUndefined(context, type, value) :
42
- T.IsUnion(type) ? FromUnion(context, type, value) :
43
- T.IsVoid(type) ? FromVoid(context, type, value) :
44
- value);
45
- }
@@ -1,76 +0,0 @@
1
- // deno-fmt-ignore-file
2
- // deno-lint-ignore-file
3
- import { Guard } from '../../../guard/index.mjs';
4
- import { Ok, Fail, IsOk } from './try-result.mjs';
5
- // ------------------------------------------------------------------
6
- // Two-Phase
7
- // ------------------------------------------------------------------
8
- import { TryBigInt } from './try-bigint.mjs';
9
- // ------------------------------------------------------------------
10
- // BigInt
11
- // ------------------------------------------------------------------
12
- const maxBigInt = BigInt(Number.MAX_SAFE_INTEGER);
13
- const minBigInt = BigInt(Number.MIN_SAFE_INTEGER);
14
- function CanBigIntDowncast(value) {
15
- return (value <= maxBigInt && value >= minBigInt);
16
- }
17
- function FromBigInt(value) {
18
- return CanBigIntDowncast(value) ? Ok(Number(value)) : Fail();
19
- }
20
- // ------------------------------------------------------------------
21
- // Boolean
22
- // ------------------------------------------------------------------
23
- function FromBoolean(value) {
24
- return value ? Ok(1) : Ok(0);
25
- }
26
- // ------------------------------------------------------------------
27
- // Number
28
- // ------------------------------------------------------------------
29
- // deno-coverage-ignore-start - unreachable | guarded
30
- function FromNumber(value) {
31
- return Ok(value);
32
- }
33
- // deno-coverage-ignore-stop
34
- // ------------------------------------------------------------------
35
- // Null
36
- // ------------------------------------------------------------------
37
- function FromNull(value) {
38
- return Ok(0);
39
- }
40
- // ------------------------------------------------------------------
41
- // String
42
- // ------------------------------------------------------------------
43
- function FromString(value) {
44
- const coerced = +value;
45
- if (Guard.IsNumber(coerced))
46
- return Ok(coerced);
47
- const lowercase = value.toLowerCase();
48
- if (Guard.IsEqual(lowercase, 'false'))
49
- return Ok(0);
50
- if (Guard.IsEqual(lowercase, 'true'))
51
- return Ok(1);
52
- const result = TryBigInt(value);
53
- if (IsOk(result))
54
- return FromBigInt(result.value);
55
- return Fail();
56
- }
57
- // ------------------------------------------------------------------
58
- // Undefined
59
- // ------------------------------------------------------------------
60
- function FromUndefined(value) {
61
- return Ok(0);
62
- }
63
- // ------------------------------------------------------------------
64
- // Try
65
- // ------------------------------------------------------------------
66
- // deno-coverage-ignore-start - unreachable | guarded
67
- export function TryNumber(value) {
68
- return (Guard.IsBigInt(value) ? FromBigInt(value) :
69
- Guard.IsBoolean(value) ? FromBoolean(value) :
70
- Guard.IsNumber(value) ? FromNumber(value) :
71
- Guard.IsNull(value) ? FromNull(value) :
72
- Guard.IsString(value) ? FromString(value) :
73
- Guard.IsUndefined(value) ? FromUndefined(value) :
74
- Fail());
75
- }
76
- // deno-coverage-ignore-stop
@@ -1,56 +0,0 @@
1
- // deno-fmt-ignore-file
2
- // deno-lint-ignore-file
3
- import { Guard } from '../../../guard/index.mjs';
4
- import { Ok, Fail } from './try-result.mjs';
5
- // ------------------------------------------------------------------
6
- // BigInt
7
- // ------------------------------------------------------------------
8
- function FromBigInt(value) {
9
- return Ok(value.toString());
10
- }
11
- // ------------------------------------------------------------------
12
- // Boolean
13
- // ------------------------------------------------------------------
14
- function FromBoolean(value) {
15
- return Ok(value.toString());
16
- }
17
- // ------------------------------------------------------------------
18
- // Number
19
- // ------------------------------------------------------------------
20
- function FromNumber(value) {
21
- return Ok(value.toString());
22
- }
23
- // ------------------------------------------------------------------
24
- // Null
25
- // ------------------------------------------------------------------
26
- function FromNull(value) {
27
- return Ok('null');
28
- }
29
- // ------------------------------------------------------------------
30
- // String
31
- // ------------------------------------------------------------------
32
- // deno-coverage-ignore-start - unreachable | guarded
33
- function FromString(value) {
34
- return Ok(value);
35
- }
36
- // deno-coverage-ignore-stop
37
- // ------------------------------------------------------------------
38
- // Undefined
39
- // ------------------------------------------------------------------
40
- function FromUndefined(value) {
41
- return Ok('');
42
- }
43
- // ------------------------------------------------------------------
44
- // Try
45
- // ------------------------------------------------------------------
46
- // deno-coverage-ignore-start - unreachable | guarded
47
- export function TryString(value) {
48
- return (Guard.IsBigInt(value) ? FromBigInt(value) :
49
- Guard.IsBoolean(value) ? FromBoolean(value) :
50
- Guard.IsNumber(value) ? FromNumber(value) :
51
- Guard.IsNull(value) ? FromNull(value) :
52
- Guard.IsString(value) ? FromString(value) :
53
- Guard.IsUndefined(value) ? FromUndefined(value) :
54
- Fail());
55
- }
56
- // deno-coverage-ignore-stop
@@ -1,2 +0,0 @@
1
- import type { TProperties, TAsyncIterator } from '../../type/index.mjs';
2
- export declare function FromAsyncIterator(_context: TProperties, _type: TAsyncIterator): unknown;
@@ -1,5 +0,0 @@
1
- // deno-fmt-ignore-file
2
- async function* CreateAsyncIterator() { }
3
- export function FromAsyncIterator(_context, _type) {
4
- return CreateAsyncIterator();
5
- }
@@ -1,2 +0,0 @@
1
- import type { TProperties, Base } from '../../type/index.mjs';
2
- export declare function FromBase(_context: TProperties, type: Base): unknown;
@@ -1,4 +0,0 @@
1
- // deno-fmt-ignore-file
2
- export function FromBase(_context, type) {
3
- return type.Create();
4
- }
@@ -1,6 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { EnumToUnion } from '../../type/engine/enum/index.mjs';
3
- import { FromType } from './from-type.mjs';
4
- export function FromEnum(context, type) {
5
- return FromType(context, EnumToUnion(type));
6
- }
@@ -1,2 +0,0 @@
1
- import type { TProperties, TIterator } from '../../type/index.mjs';
2
- export declare function FromIterator(_context: TProperties, _type: TIterator): unknown;
@@ -1,5 +0,0 @@
1
- // deno-fmt-ignore-file
2
- function* CreateIterator() { }
3
- export function FromIterator(_context, _type) {
4
- return CreateIterator();
5
- }
@@ -1,2 +0,0 @@
1
- import type { TProperties, TPromise } from '../../type/index.mjs';
2
- export declare function FromPromise(context: TProperties, type: TPromise): unknown;
@@ -1,5 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { FromType } from './from-type.mjs';
3
- export function FromPromise(context, type) {
4
- return Promise.resolve(FromType(context, type.item));
5
- }
@@ -1,69 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import * as T from '../../type/index.mjs';
3
- import * as S from '../../schema/types/index.mjs';
4
- import { FromDefault } from './from-default.mjs';
5
- import { FromArray } from './from-array.mjs';
6
- import { FromAsyncIterator } from './from-async-iterator.mjs';
7
- import { FromBase } from './from-base.mjs';
8
- import { FromBigInt } from './from-bigint.mjs';
9
- import { FromBoolean } from './from-boolean.mjs';
10
- import { FromConstructor } from './from-constructor.mjs';
11
- import { FromCyclic } from './from-cyclic.mjs';
12
- import { FromEnum } from './from-enum.mjs';
13
- import { FromFunction } from './from-function.mjs';
14
- import { FromInteger } from './from-integer.mjs';
15
- import { FromIntersect } from './from-intersect.mjs';
16
- import { FromIterator } from './from-iterator.mjs';
17
- import { FromLiteral } from './from-literal.mjs';
18
- import { FromNever } from './from-never.mjs';
19
- import { FromNull } from './from-null.mjs';
20
- import { FromNumber } from './from-number.mjs';
21
- import { FromObject } from './from-object.mjs';
22
- import { FromPromise } from './from-promise.mjs';
23
- import { FromRecord } from './from-record.mjs';
24
- import { FromRef } from './from-ref.mjs';
25
- import { FromString } from './from-string.mjs';
26
- import { FromSymbol } from './from-symbol.mjs';
27
- import { FromTemplateLiteral } from './from-template-literal.mjs';
28
- import { FromTuple } from './from-tuple.mjs';
29
- import { FromUndefined } from './from-undefined.mjs';
30
- import { FromUnion } from './from-union.mjs';
31
- import { FromVoid } from './from-void.mjs';
32
- export function FromType(context, type) {
33
- return (
34
- // -----------------------------------------------------
35
- // Default
36
- // -----------------------------------------------------
37
- S.IsDefault(type) ? FromDefault(context, type) :
38
- // -----------------------------------------------------
39
- // Types
40
- // -----------------------------------------------------
41
- T.IsArray(type) ? FromArray(context, type) :
42
- T.IsAsyncIterator(type) ? FromAsyncIterator(context, type) :
43
- T.IsBase(type) ? FromBase(context, type) :
44
- T.IsBigInt(type) ? FromBigInt(context, type) :
45
- T.IsBoolean(type) ? FromBoolean(context, type) :
46
- T.IsConstructor(type) ? FromConstructor(context, type) :
47
- T.IsCyclic(type) ? FromCyclic(context, type) :
48
- T.IsEnum(type) ? FromEnum(context, type) :
49
- T.IsFunction(type) ? FromFunction(context, type) :
50
- T.IsInteger(type) ? FromInteger(context, type) :
51
- T.IsIntersect(type) ? FromIntersect(context, type) :
52
- T.IsIterator(type) ? FromIterator(context, type) :
53
- T.IsLiteral(type) ? FromLiteral(context, type) :
54
- T.IsNever(type) ? FromNever(context, type) :
55
- T.IsNull(type) ? FromNull(context, type) :
56
- T.IsNumber(type) ? FromNumber(context, type) :
57
- T.IsObject(type) ? FromObject(context, type) :
58
- T.IsPromise(type) ? FromPromise(context, type) :
59
- T.IsRecord(type) ? FromRecord(context, type) :
60
- T.IsRef(type) ? FromRef(context, type) :
61
- T.IsString(type) ? FromString(context, type) :
62
- T.IsSymbol(type) ? FromSymbol(context, type) :
63
- T.IsTemplateLiteral(type) ? FromTemplateLiteral(context, type) :
64
- T.IsTuple(type) ? FromTuple(context, type) :
65
- T.IsUndefined(type) ? FromUndefined(context, type) :
66
- T.IsUnion(type) ? FromUnion(context, type) :
67
- T.IsVoid(type) ? FromVoid(context, type) :
68
- undefined);
69
- }
@@ -1,2 +0,0 @@
1
- import type { TProperties, Base } from '../../type/index.mjs';
2
- export declare function FromBase(context: TProperties, type: Base, value: unknown): unknown;
@@ -1,5 +0,0 @@
1
- // deno-fmt-ignore-file
2
- // deno-lint-ignore-file
3
- export function FromBase(context, type, value) {
4
- return type.Default(value);
5
- }
@@ -1,2 +0,0 @@
1
- import { TProperties, TIntersect } from '../../type/index.mjs';
2
- export declare function FromIntersect(context: TProperties, type: TIntersect, value: unknown): unknown;
@@ -1,27 +0,0 @@
1
- // deno-fmt-ignore-file
2
- // deno-lint-ignore-file
3
- import { IsDefault } from '../../schema/index.mjs';
4
- import * as T from '../../type/index.mjs';
5
- import { FromArray } from './from-array.mjs';
6
- import { FromBase } from './from-base.mjs';
7
- import { FromCyclic } from './from-cyclic.mjs';
8
- import { FromDefault } from './from-default.mjs';
9
- import { FromIntersect } from './from-intersect.mjs';
10
- import { FromObject } from './from-object.mjs';
11
- import { FromRecord } from './from-record.mjs';
12
- import { FromRef } from './from-ref.mjs';
13
- import { FromTuple } from './from-tuple.mjs';
14
- import { FromUnion } from './from-union.mjs';
15
- export function FromType(context, type, value) {
16
- const defaulted = IsDefault(type) ? FromDefault(type, value) : value;
17
- return (T.IsArray(type) ? FromArray(context, type, defaulted) :
18
- T.IsBase(type) ? FromBase(context, type, defaulted) :
19
- T.IsCyclic(type) ? FromCyclic(context, type, defaulted) :
20
- T.IsIntersect(type) ? FromIntersect(context, type, defaulted) :
21
- T.IsObject(type) ? FromObject(context, type, defaulted) :
22
- T.IsRecord(type) ? FromRecord(context, type, defaulted) :
23
- T.IsRef(type) ? FromRef(context, type, defaulted) :
24
- T.IsTuple(type) ? FromTuple(context, type, defaulted) :
25
- T.IsUnion(type) ? FromUnion(context, type, defaulted) :
26
- defaulted);
27
- }
@@ -1,3 +0,0 @@
1
- export declare class MutateError extends Error {
2
- constructor(message: string);
3
- }
@@ -1,6 +0,0 @@
1
- // deno-fmt-ignore-file
2
- export class MutateError extends Error {
3
- constructor(message) {
4
- super(message);
5
- }
6
- }
@@ -1,2 +0,0 @@
1
- import { type TMutable } from './mutate.mjs';
2
- export declare function FromArray(root: TMutable, path: string, current: unknown, next: unknown[]): void;
@@ -1,16 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- import { Clone } from '../clone/index.mjs';
4
- import { Pointer } from '../pointer/index.mjs';
5
- import { FromValue } from './from-value.mjs';
6
- export function FromArray(root, path, current, next) {
7
- if (!Guard.IsArray(current)) {
8
- Pointer.Set(root, path, Clone(next));
9
- }
10
- else {
11
- for (let index = 0; index < next.length; index++) {
12
- FromValue(root, `${path}/${index}`, current[index], next[index]);
13
- }
14
- current.splice(next.length);
15
- }
16
- }
@@ -1,2 +0,0 @@
1
- import { type TMutable } from './mutate.mjs';
2
- export declare function FromObject(root: TMutable, path: string, current: unknown, next: Record<string, unknown>): void;
@@ -1,27 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- import { Pointer } from '../pointer/index.mjs';
4
- import { Clone } from '../clone/index.mjs';
5
- import { FromValue } from './from-value.mjs';
6
- export function FromObject(root, path, current, next) {
7
- if (!Guard.IsObjectNotArray(current)) {
8
- Pointer.Set(root, path, Clone(next));
9
- }
10
- else {
11
- const currentKeys = Guard.Keys(current);
12
- const nextKeys = Guard.Keys(next);
13
- for (const currentKey of currentKeys) {
14
- if (!nextKeys.includes(currentKey)) {
15
- delete current[currentKey];
16
- }
17
- }
18
- for (const nextKey of nextKeys) {
19
- if (!currentKeys.includes(nextKey)) {
20
- current[nextKey] = next[nextKey];
21
- }
22
- }
23
- for (const nextKey of nextKeys) {
24
- FromValue(root, `${path}/${nextKey}`, current[nextKey], next[nextKey]);
25
- }
26
- }
27
- }
@@ -1,2 +0,0 @@
1
- import { type TMutable } from './mutate.mjs';
2
- export declare function FromUnknown(root: TMutable, path: string, current: unknown, next: unknown): void;
@@ -1,7 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Pointer } from '../pointer/index.mjs';
3
- export function FromUnknown(root, path, current, next) {
4
- if (current === next)
5
- return;
6
- Pointer.Set(root, path, next);
7
- }
@@ -1,2 +0,0 @@
1
- import { type TMutable } from './mutate.mjs';
2
- export declare function FromValue(root: TMutable, path: string, current: unknown, next: unknown): void;
@@ -1,12 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- import { FromArray } from './from-array.mjs';
4
- import { FromObject } from './from-object.mjs';
5
- import { FromUnknown } from './from-unknown.mjs';
6
- export function FromValue(root, path, current, next) {
7
- if (Guard.IsArray(next))
8
- return FromArray(root, path, current, next);
9
- if (Guard.IsObject(next))
10
- return FromObject(root, path, current, next);
11
- return FromUnknown(root, path, current, next);
12
- }
@@ -1 +0,0 @@
1
- export * from './mutate.mjs';
@@ -1 +0,0 @@
1
- export * from './mutate.mjs';
@@ -1,9 +0,0 @@
1
- export type TMutable = {
2
- [key: string]: unknown;
3
- } | unknown[];
4
- /**
5
- * Performs a deep structural assignment, applying values from next to current while retaining internal references. This function
6
- * is written for use in infrastructure that interprets reference changes as a signal to perform some action (i.e. React redraw), this
7
- * function can mitigate this by applying mutable updates deep within a value, ensuring parent references are retained.
8
- */
9
- export declare function Mutate(current: TMutable, next: TMutable): void;
@@ -1,39 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard, GlobalsGuard } from '../../guard/index.mjs';
3
- import { MutateError } from './error.mjs';
4
- import { FromValue } from './from-value.mjs';
5
- // ------------------------------------------------------------------
6
- // IsNonMutableValue
7
- // ------------------------------------------------------------------
8
- function IsNonMutableValue(value) {
9
- return GlobalsGuard.IsTypeArray(value)
10
- || GlobalsGuard.IsDate(value)
11
- || GlobalsGuard.IsMap(value)
12
- || GlobalsGuard.IsSet(value)
13
- || Guard.IsNumber(value)
14
- || Guard.IsString(value)
15
- || Guard.IsBoolean(value)
16
- || Guard.IsSymbol(value);
17
- }
18
- // ------------------------------------------------------------------
19
- // IsTrueObject
20
- // ------------------------------------------------------------------
21
- function IsMismatchedValue(left, right) {
22
- return ((Guard.IsObjectNotArray(left) && Guard.IsArray(right)) ||
23
- (Guard.IsArray(left) && Guard.IsObjectNotArray(right)));
24
- }
25
- // ------------------------------------------------------------------
26
- // Mutate
27
- // ------------------------------------------------------------------
28
- /**
29
- * Performs a deep structural assignment, applying values from next to current while retaining internal references. This function
30
- * is written for use in infrastructure that interprets reference changes as a signal to perform some action (i.e. React redraw), this
31
- * function can mitigate this by applying mutable updates deep within a value, ensuring parent references are retained.
32
- */
33
- export function Mutate(current, next) {
34
- if (IsNonMutableValue(current) || IsNonMutableValue(next))
35
- throw new MutateError('Only object and array types can be mutated at the root level');
36
- if (IsMismatchedValue(current, next))
37
- throw new MutateError('Cannot assign due type mismatch of assignable values');
38
- FromValue(current, '', current, next);
39
- }
@@ -1,2 +0,0 @@
1
- import type { TProperties, Base } from '../../type/index.mjs';
2
- export declare function FromBase(context: TProperties, type: Base, value: unknown): unknown;
@@ -1,8 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { FromUnknown } from './from-unknown.mjs';
3
- // ------------------------------------------------------------------
4
- // FromBase
5
- // ------------------------------------------------------------------
6
- export function FromBase(context, type, value) {
7
- return FromUnknown(context, type, value);
8
- }
@@ -1,7 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { EnumToUnion } from '../../type/engine/enum/index.mjs';
3
- import { FromType } from './from-type.mjs';
4
- export function FromEnum(context, type, value) {
5
- const union = EnumToUnion(type);
6
- return FromType(context, union, value);
7
- }
@@ -1,7 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { TemplateLiteralDecode } from '../../type/engine/template-literal/index.mjs';
3
- import { FromType } from './from-type.mjs';
4
- export function FromTemplateLiteral(context, type, value) {
5
- const decoded = TemplateLiteralDecode(type.pattern);
6
- return FromType(context, decoded, value);
7
- }
@@ -1,2 +0,0 @@
1
- import * as T from '../../type/index.mjs';
2
- export declare function FromType(context: T.TProperties, type: T.TSchema, value: unknown): unknown;
@@ -1,3 +0,0 @@
1
- import { type TSchema } from '../../type/index.mjs';
2
- /** Deterministically sorts schemas by structural relationship (narrow to broad) */
3
- export declare function UnionPrioritySort(types: TSchema[], order?: number): TSchema[];
@@ -1,36 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- import { Compare } from '../../type/index.mjs';
4
- // ------------------------------------------------------------------
5
- // DeterministicCompare
6
- //
7
- // Provides a deterministic tie-break for schemas. This is used when
8
- // schemas are structurally disjoint or mutually inclusive. While
9
- // JSON serialization incurs a performance overhead, it serves as a
10
- // reliable mechanism to ensure stable ordering and preserves the
11
- // alphabetical alignment of named constants.
12
- //
13
- // ------------------------------------------------------------------
14
- function DeterministicCompare(left, right) {
15
- return JSON.stringify(left).localeCompare(JSON.stringify(right));
16
- }
17
- // ------------------------------------------------------------------
18
- // UnionPrioritySort
19
- //
20
- // Performs a deterministic sort on Union members. By default, this
21
- // function ensures that narrow (more specific) types precede broader
22
- // types in the resulting array. The order can be reversed by setting
23
- // the order property to -1 which will reverse unions from broader
24
- // to more narrow.
25
- //
26
- // ------------------------------------------------------------------
27
- /** Deterministically sorts schemas by structural relationship (narrow to broad) */
28
- export function UnionPrioritySort(types, order = 1) {
29
- return types.sort((left, right) => {
30
- const result = Compare(left, right);
31
- return (Guard.IsEqual(result, 'disjoint') ? DeterministicCompare(left, right) :
32
- Guard.IsEqual(result, 'right-inside') ? 1 :
33
- Guard.IsEqual(result, 'left-inside') ? -1 :
34
- DeterministicCompare(left, right)) * order;
35
- });
36
- }
File without changes