@es-joy/jsoe 0.24.3 → 0.25.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 (524) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.ncurc.cjs +2 -2
  3. package/CHANGES.md +47 -0
  4. package/README.md +23 -13
  5. package/badges/coverage-badge.svg +1 -1
  6. package/dist/eslint.config.d.ts +3 -0
  7. package/dist/eslint.config.d.ts.map +1 -0
  8. package/dist/formatAndTypeChoices.d.ts +28 -30
  9. package/dist/formatAndTypeChoices.d.ts.map +1 -1
  10. package/dist/formats/indexedDBKey.d.ts.map +1 -1
  11. package/dist/formats/schema.d.ts +46 -3
  12. package/dist/formats/schema.d.ts.map +1 -1
  13. package/dist/formats/structuredCloning.d.ts +3 -0
  14. package/dist/formats/structuredCloning.d.ts.map +1 -1
  15. package/dist/formats.d.ts +24 -6
  16. package/dist/formats.d.ts.map +1 -1
  17. package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
  18. package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
  19. package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
  20. package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -1
  21. package/dist/fundamentalTypes/arrayType.d.ts +7 -0
  22. package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
  23. package/dist/fundamentalTypes/bigintObjectType.d.ts.map +1 -1
  24. package/dist/fundamentalTypes/bigintType.d.ts +10 -0
  25. package/dist/fundamentalTypes/bigintType.d.ts.map +1 -1
  26. package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
  27. package/dist/fundamentalTypes/booleanType.d.ts.map +1 -1
  28. package/dist/fundamentalTypes/catchType.d.ts +2 -2
  29. package/dist/fundamentalTypes/catchType.d.ts.map +1 -1
  30. package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
  31. package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
  32. package/dist/fundamentalTypes/enumType.d.ts +2 -2
  33. package/dist/fundamentalTypes/enumType.d.ts.map +1 -1
  34. package/dist/fundamentalTypes/errorType.d.ts.map +1 -1
  35. package/dist/fundamentalTypes/fileType.d.ts +6 -0
  36. package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
  37. package/dist/fundamentalTypes/functionType.d.ts.map +1 -1
  38. package/dist/fundamentalTypes/literalType.d.ts +3 -2
  39. package/dist/fundamentalTypes/literalType.d.ts.map +1 -1
  40. package/dist/fundamentalTypes/looseRecordType.d.ts +6 -0
  41. package/dist/fundamentalTypes/looseRecordType.d.ts.map +1 -0
  42. package/dist/fundamentalTypes/nanType.d.ts.map +1 -1
  43. package/dist/fundamentalTypes/neverType.d.ts +2 -2
  44. package/dist/fundamentalTypes/neverType.d.ts.map +1 -1
  45. package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -1
  46. package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
  47. package/dist/fundamentalTypes/numberType.d.ts.map +1 -1
  48. package/dist/fundamentalTypes/promiseType.d.ts.map +1 -1
  49. package/dist/fundamentalTypes/regexpType.d.ts.map +1 -1
  50. package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
  51. package/dist/fundamentalTypes/symbolType.d.ts.map +1 -1
  52. package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
  53. package/dist/fundamentalTypes/voidType.d.ts +2 -2
  54. package/dist/fundamentalTypes/voidType.d.ts.map +1 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +6 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/rollup.config.d.ts +30 -0
  59. package/dist/rollup.config.d.ts.map +1 -0
  60. package/dist/server.d.ts +2 -0
  61. package/dist/server.d.ts.map +1 -0
  62. package/dist/src/formatAndTypeChoices.d.ts +108 -0
  63. package/dist/src/formatAndTypeChoices.d.ts.map +1 -0
  64. package/dist/src/formats/arbitraryJS.d.ts +4 -0
  65. package/dist/src/formats/arbitraryJS.d.ts.map +1 -0
  66. package/dist/src/formats/indexedDBKey.d.ts +4 -0
  67. package/dist/src/formats/indexedDBKey.d.ts.map +1 -0
  68. package/dist/src/formats/json.d.ts +4 -0
  69. package/dist/src/formats/json.d.ts.map +1 -0
  70. package/dist/src/formats/schema.d.ts +17 -0
  71. package/dist/src/formats/schema.d.ts.map +1 -0
  72. package/dist/src/formats/structuredCloning.d.ts +19 -0
  73. package/dist/src/formats/structuredCloning.d.ts.map +1 -0
  74. package/dist/src/formats.d.ts +135 -0
  75. package/dist/src/formats.d.ts.map +1 -0
  76. package/dist/src/fundamentalTypes/BooleanObjectType.d.ts +8 -0
  77. package/dist/src/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
  78. package/dist/src/fundamentalTypes/NumberObjectType.d.ts +6 -0
  79. package/dist/src/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
  80. package/dist/src/fundamentalTypes/StringObjectType.d.ts +6 -0
  81. package/dist/src/fundamentalTypes/StringObjectType.d.ts.map +1 -0
  82. package/dist/src/fundamentalTypes/arrayReferenceType.d.ts +8 -0
  83. package/dist/src/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
  84. package/dist/src/fundamentalTypes/arrayType.d.ts +29 -0
  85. package/dist/src/fundamentalTypes/arrayType.d.ts.map +1 -0
  86. package/dist/src/fundamentalTypes/bigintObjectType.d.ts +6 -0
  87. package/dist/src/fundamentalTypes/bigintObjectType.d.ts.map +1 -0
  88. package/dist/src/fundamentalTypes/bigintType.d.ts +6 -0
  89. package/dist/src/fundamentalTypes/bigintType.d.ts.map +1 -0
  90. package/dist/src/fundamentalTypes/blobType.d.ts +11 -0
  91. package/dist/src/fundamentalTypes/blobType.d.ts.map +1 -0
  92. package/dist/src/fundamentalTypes/booleanType.d.ts +8 -0
  93. package/dist/src/fundamentalTypes/booleanType.d.ts.map +1 -0
  94. package/dist/src/fundamentalTypes/catchType.d.ts +6 -0
  95. package/dist/src/fundamentalTypes/catchType.d.ts.map +1 -0
  96. package/dist/src/fundamentalTypes/dateType.d.ts +26 -0
  97. package/dist/src/fundamentalTypes/dateType.d.ts.map +1 -0
  98. package/dist/src/fundamentalTypes/domexceptionType.d.ts +6 -0
  99. package/dist/src/fundamentalTypes/domexceptionType.d.ts.map +1 -0
  100. package/dist/src/fundamentalTypes/enumType.d.ts +6 -0
  101. package/dist/src/fundamentalTypes/enumType.d.ts.map +1 -0
  102. package/dist/src/fundamentalTypes/errorType.d.ts +6 -0
  103. package/dist/src/fundamentalTypes/errorType.d.ts.map +1 -0
  104. package/dist/src/fundamentalTypes/fileType.d.ts +13 -0
  105. package/dist/src/fundamentalTypes/fileType.d.ts.map +1 -0
  106. package/dist/src/fundamentalTypes/filelistType.d.ts +6 -0
  107. package/dist/src/fundamentalTypes/filelistType.d.ts.map +1 -0
  108. package/dist/src/fundamentalTypes/functionType.d.ts +7 -0
  109. package/dist/src/fundamentalTypes/functionType.d.ts.map +1 -0
  110. package/dist/src/fundamentalTypes/literalType.d.ts +6 -0
  111. package/dist/src/fundamentalTypes/literalType.d.ts.map +1 -0
  112. package/dist/src/fundamentalTypes/mapType.d.ts +6 -0
  113. package/dist/src/fundamentalTypes/mapType.d.ts.map +1 -0
  114. package/dist/src/fundamentalTypes/nanType.d.ts +6 -0
  115. package/dist/src/fundamentalTypes/nanType.d.ts.map +1 -0
  116. package/dist/src/fundamentalTypes/neverType.d.ts +6 -0
  117. package/dist/src/fundamentalTypes/neverType.d.ts.map +1 -0
  118. package/dist/src/fundamentalTypes/noneditableType.d.ts +6 -0
  119. package/dist/src/fundamentalTypes/noneditableType.d.ts.map +1 -0
  120. package/dist/src/fundamentalTypes/nullType.d.ts +6 -0
  121. package/dist/src/fundamentalTypes/nullType.d.ts.map +1 -0
  122. package/dist/src/fundamentalTypes/numberType.d.ts +6 -0
  123. package/dist/src/fundamentalTypes/numberType.d.ts.map +1 -0
  124. package/dist/src/fundamentalTypes/objectReferenceType.d.ts +8 -0
  125. package/dist/src/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
  126. package/dist/src/fundamentalTypes/objectType.d.ts +6 -0
  127. package/dist/src/fundamentalTypes/objectType.d.ts.map +1 -0
  128. package/dist/src/fundamentalTypes/promiseType.d.ts +6 -0
  129. package/dist/src/fundamentalTypes/promiseType.d.ts.map +1 -0
  130. package/dist/src/fundamentalTypes/recordType.d.ts +6 -0
  131. package/dist/src/fundamentalTypes/recordType.d.ts.map +1 -0
  132. package/dist/src/fundamentalTypes/regexpType.d.ts +8 -0
  133. package/dist/src/fundamentalTypes/regexpType.d.ts.map +1 -0
  134. package/dist/src/fundamentalTypes/setType.d.ts +6 -0
  135. package/dist/src/fundamentalTypes/setType.d.ts.map +1 -0
  136. package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
  137. package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
  138. package/dist/src/fundamentalTypes/stringType.d.ts +6 -0
  139. package/dist/src/fundamentalTypes/stringType.d.ts.map +1 -0
  140. package/dist/src/fundamentalTypes/symbolType.d.ts +8 -0
  141. package/dist/src/fundamentalTypes/symbolType.d.ts.map +1 -0
  142. package/dist/src/fundamentalTypes/tupleType.d.ts +6 -0
  143. package/dist/src/fundamentalTypes/tupleType.d.ts.map +1 -0
  144. package/dist/src/fundamentalTypes/undefinedType.d.ts +6 -0
  145. package/dist/src/fundamentalTypes/undefinedType.d.ts.map +1 -0
  146. package/dist/src/fundamentalTypes/voidType.d.ts +6 -0
  147. package/dist/src/fundamentalTypes/voidType.d.ts.map +1 -0
  148. package/dist/src/index.d.ts +12 -0
  149. package/dist/src/index.d.ts.map +1 -0
  150. package/dist/src/subTypes/blobHTMLType.d.ts +20 -0
  151. package/dist/src/subTypes/blobHTMLType.d.ts.map +1 -0
  152. package/dist/src/subTypes/falseType.d.ts +8 -0
  153. package/dist/src/subTypes/falseType.d.ts.map +1 -0
  154. package/dist/src/subTypes/trueType.d.ts +8 -0
  155. package/dist/src/subTypes/trueType.d.ts.map +1 -0
  156. package/dist/src/superTypes/SpecialNumberType.d.ts +6 -0
  157. package/dist/src/superTypes/SpecialNumberType.d.ts.map +1 -0
  158. package/dist/src/superTypes/SpecialRealNumberType.d.ts +6 -0
  159. package/dist/src/superTypes/SpecialRealNumberType.d.ts.map +1 -0
  160. package/dist/src/superTypes/buffersourceType.d.ts +8 -0
  161. package/dist/src/superTypes/buffersourceType.d.ts.map +1 -0
  162. package/dist/src/superTypes/dommatrixType.d.ts +6 -0
  163. package/dist/src/superTypes/dommatrixType.d.ts.map +1 -0
  164. package/dist/src/superTypes/dompointType.d.ts +6 -0
  165. package/dist/src/superTypes/dompointType.d.ts.map +1 -0
  166. package/dist/src/superTypes/domrectType.d.ts +6 -0
  167. package/dist/src/superTypes/domrectType.d.ts.map +1 -0
  168. package/dist/src/superTypes/errorsSpecialType.d.ts +8 -0
  169. package/dist/src/superTypes/errorsSpecialType.d.ts.map +1 -0
  170. package/dist/src/typeChoices.d.ts +140 -0
  171. package/dist/src/typeChoices.d.ts.map +1 -0
  172. package/dist/src/types.d.ts +758 -0
  173. package/dist/src/types.d.ts.map +1 -0
  174. package/dist/src/utils/FileList.d.ts +26 -0
  175. package/dist/src/utils/FileList.d.ts.map +1 -0
  176. package/dist/src/utils/dialogs.d.ts +111 -0
  177. package/dist/src/utils/dialogs.d.ts.map +1 -0
  178. package/dist/src/utils/jsonPointer.d.ts +46 -0
  179. package/dist/src/utils/jsonPointer.d.ts.map +1 -0
  180. package/dist/src/utils/media.d.ts +18 -0
  181. package/dist/src/utils/media.d.ts.map +1 -0
  182. package/dist/src/utils/objects.d.ts +16 -0
  183. package/dist/src/utils/objects.d.ts.map +1 -0
  184. package/dist/src/utils/templateUtils.d.ts +59 -0
  185. package/dist/src/utils/templateUtils.d.ts.map +1 -0
  186. package/dist/src/utils/types.d.ts +2 -0
  187. package/dist/src/utils/types.d.ts.map +1 -0
  188. package/dist/src/vendor-imports.d.ts +4 -0
  189. package/dist/src/vendor-imports.d.ts.map +1 -0
  190. package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
  191. package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
  192. package/dist/superTypes/buffersourceType.d.ts.map +1 -1
  193. package/dist/superTypes/dommatrixType.d.ts.map +1 -1
  194. package/dist/superTypes/dompointType.d.ts.map +1 -1
  195. package/dist/superTypes/domrectType.d.ts.map +1 -1
  196. package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
  197. package/dist/typeChoices.d.ts +21 -87
  198. package/dist/typeChoices.d.ts.map +1 -1
  199. package/dist/types.d.ts +90 -64
  200. package/dist/types.d.ts.map +1 -1
  201. package/dist/utils/FileList.d.ts +4 -3
  202. package/dist/utils/FileList.d.ts.map +1 -1
  203. package/dist/utils/dialogs.d.ts +4 -4
  204. package/dist/utils/dialogs.d.ts.map +1 -1
  205. package/dist/utils/media.d.ts.map +1 -1
  206. package/dist/utils/schemaMeta.d.ts +92 -0
  207. package/dist/utils/schemaMeta.d.ts.map +1 -0
  208. package/dist/utils/templateUtils.d.ts +3 -3
  209. package/dist/utils/templateUtils.d.ts.map +1 -1
  210. package/dist/utils/timing.d.ts +2 -0
  211. package/dist/utils/timing.d.ts.map +1 -0
  212. package/dist/utils/types.d.ts +1 -0
  213. package/dist/utils/types.d.ts.map +1 -1
  214. package/dist/vendor-imports.d.ts +3 -1
  215. package/docs/proposals/schema-meta.md +233 -0
  216. package/eslint.config.js +51 -4
  217. package/licenseInfo.json +1 -1
  218. package/package.json +52 -42
  219. package/pnpm-workspace.yaml +57 -0
  220. package/rollup.config.js +20 -18
  221. package/server.js +3 -3
  222. package/src/deepEqual.js.map +1 -1
  223. package/src/formatAndTypeChoices.js +62 -58
  224. package/src/formats/indexedDBKey.js +3 -4
  225. package/src/formats/schema.js +824 -475
  226. package/src/formats/structuredCloning.js +189 -79
  227. package/src/formats.js +17 -5
  228. package/src/fundamentalTypes/BooleanObjectType.js +4 -5
  229. package/src/fundamentalTypes/NumberObjectType.js +4 -4
  230. package/src/fundamentalTypes/StringObjectType.js +3 -4
  231. package/src/fundamentalTypes/arrayReferenceType.js +0 -2
  232. package/src/fundamentalTypes/arrayType.js +624 -389
  233. package/src/fundamentalTypes/bigintObjectType.js +3 -2
  234. package/src/fundamentalTypes/bigintType.js +79 -17
  235. package/src/fundamentalTypes/blobType.js +35 -35
  236. package/src/fundamentalTypes/booleanType.js +16 -8
  237. package/src/fundamentalTypes/dateType.js +6 -8
  238. package/src/fundamentalTypes/domexceptionType.js +5 -4
  239. package/src/fundamentalTypes/errorType.js +39 -32
  240. package/src/fundamentalTypes/fileType.js +238 -52
  241. package/src/fundamentalTypes/functionType.js +61 -41
  242. package/src/fundamentalTypes/nanType.js +5 -4
  243. package/src/fundamentalTypes/noneditableType.js +4 -3
  244. package/src/fundamentalTypes/nullType.js +3 -2
  245. package/src/fundamentalTypes/numberType.js +72 -20
  246. package/src/fundamentalTypes/promiseType.js +16 -40
  247. package/src/fundamentalTypes/regexpType.js +7 -13
  248. package/src/fundamentalTypes/stringType.js +176 -110
  249. package/src/fundamentalTypes/symbolType.js +3 -2
  250. package/src/fundamentalTypes/undefinedType.js +3 -2
  251. package/src/index.js +6 -5
  252. package/src/jsoe.css +107 -8
  253. package/src/subTypes/blobHTMLType.js +23 -10
  254. package/src/superTypes/SpecialNumberType.js +6 -6
  255. package/src/superTypes/SpecialRealNumberType.js +10 -9
  256. package/src/superTypes/buffersourceType.js +86 -75
  257. package/src/superTypes/dommatrixType.js +6 -5
  258. package/src/superTypes/dompointType.js +6 -5
  259. package/src/superTypes/domrectType.js +6 -5
  260. package/src/superTypes/errorsSpecialType.js +54 -35
  261. package/src/typeChoices.js +373 -53
  262. package/src/types.js +157 -97
  263. package/src/utils/FileList.js +3 -3
  264. package/src/utils/dialogs.js +5 -7
  265. package/src/utils/jsonPointer.js +1 -1
  266. package/src/utils/media.js +1 -0
  267. package/src/utils/schemaMeta.js +257 -0
  268. package/src/utils/templateUtils.js +3 -3
  269. package/src/utils/timing.js +12 -0
  270. package/src/utils/types.js +19 -0
  271. package/src/vendor-imports.js +10 -2
  272. package/tsconfig.json +2 -0
  273. package/vendor/acorn/dist/acorn.d.mts +46 -5
  274. package/vendor/acorn/dist/acorn.d.ts +46 -5
  275. package/vendor/acorn/dist/acorn.js +394 -117
  276. package/vendor/acorn/dist/acorn.mjs +394 -117
  277. package/vendor/acorn/dist/bin.js +1 -1
  278. package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +590 -312
  279. package/vendor/jamilih/package.json +1 -1
  280. package/vendor/mime/dist/types/other.js +719 -0
  281. package/vendor/mime/dist/types/standard.js +366 -0
  282. package/vendor/typeson-registry/dist/index.js +519 -99
  283. package/vendor/zod/classic/checks.d.ts +1 -0
  284. package/vendor/zod/classic/checks.js +1 -0
  285. package/vendor/zod/classic/coerce.d.ts +17 -0
  286. package/vendor/zod/classic/coerce.js +17 -0
  287. package/vendor/zod/classic/compat.d.ts +48 -0
  288. package/vendor/zod/classic/compat.js +31 -0
  289. package/vendor/zod/classic/deep-partial.d.ts +14 -0
  290. package/vendor/zod/classic/deep-partial.js +13 -0
  291. package/vendor/zod/classic/errors.d.ts +29 -0
  292. package/vendor/zod/classic/errors.js +57 -0
  293. package/vendor/zod/classic/external.d.ts +19 -0
  294. package/vendor/zod/classic/external.js +17 -0
  295. package/vendor/zod/classic/from-json-schema.d.ts +12 -0
  296. package/vendor/zod/classic/from-json-schema.js +660 -0
  297. package/vendor/zod/classic/in-out.d.ts +8 -0
  298. package/vendor/zod/classic/in-out.js +36 -0
  299. package/vendor/zod/classic/index.d.ts +3 -0
  300. package/vendor/zod/classic/index.js +4 -0
  301. package/vendor/zod/classic/iso.d.ts +7 -0
  302. package/vendor/zod/classic/iso.js +15 -0
  303. package/vendor/zod/classic/package.json +7 -0
  304. package/vendor/zod/classic/parse.d.ts +44 -0
  305. package/vendor/zod/classic/parse.js +16 -0
  306. package/vendor/zod/classic/schemas.d.ts +802 -0
  307. package/vendor/zod/classic/schemas.js +1491 -0
  308. package/vendor/zod/core/api.d.ts +329 -0
  309. package/vendor/zod/core/api.js +1104 -0
  310. package/vendor/zod/core/checks.d.ts +278 -0
  311. package/vendor/zod/core/checks.js +581 -0
  312. package/vendor/zod/core/compile.d.ts +51 -0
  313. package/vendor/zod/core/compile.js +1783 -0
  314. package/vendor/zod/core/core.d.ts +82 -0
  315. package/vendor/zod/core/core.js +141 -0
  316. package/vendor/zod/core/doc.d.ts +16 -0
  317. package/vendor/zod/core/doc.js +33 -0
  318. package/vendor/zod/core/errors.d.ts +225 -0
  319. package/vendor/zod/core/errors.js +270 -0
  320. package/vendor/zod/core/index.d.ts +19 -0
  321. package/vendor/zod/core/index.js +19 -0
  322. package/vendor/zod/core/json-schema-generator.d.ts +65 -0
  323. package/vendor/zod/core/json-schema-generator.js +99 -0
  324. package/vendor/zod/core/json-schema-processors.d.ts +49 -0
  325. package/vendor/zod/core/json-schema-processors.js +747 -0
  326. package/vendor/zod/core/json-schema.d.ts +89 -0
  327. package/vendor/zod/core/memoizer.d.ts +15 -0
  328. package/vendor/zod/core/memoizer.js +265 -0
  329. package/vendor/zod/core/package.json +7 -0
  330. package/vendor/zod/core/parse.d.ts +52 -0
  331. package/vendor/zod/core/parse.js +154 -0
  332. package/vendor/zod/core/regexes.d.ts +87 -0
  333. package/vendor/zod/core/regexes.js +150 -0
  334. package/vendor/zod/core/registries.d.ts +35 -0
  335. package/vendor/zod/core/registries.js +51 -0
  336. package/vendor/zod/core/schemas.d.ts +1253 -0
  337. package/vendor/zod/core/schemas.js +2440 -0
  338. package/vendor/zod/core/standard-schema.d.ts +126 -0
  339. package/vendor/zod/core/to-json-schema.d.ts +153 -0
  340. package/vendor/zod/core/to-json-schema.js +650 -0
  341. package/vendor/zod/core/util.d.ts +257 -0
  342. package/vendor/zod/core/util.js +846 -0
  343. package/vendor/zod/core/versions.d.ts +5 -0
  344. package/vendor/zod/core/versions.js +5 -0
  345. package/vendor/zod/core/visit.d.ts +30 -0
  346. package/vendor/zod/core/visit.js +169 -0
  347. package/vendor/zod/index.d.ts +3 -0
  348. package/vendor/zod/index.js +4 -0
  349. package/vendor/zod/locales/ar.d.ts +4 -0
  350. package/vendor/zod/locales/ar.js +109 -0
  351. package/vendor/zod/locales/az.d.ts +4 -0
  352. package/vendor/zod/locales/az.js +108 -0
  353. package/vendor/zod/locales/be.d.ts +4 -0
  354. package/vendor/zod/locales/be.js +166 -0
  355. package/vendor/zod/locales/bg.d.ts +4 -0
  356. package/vendor/zod/locales/bg.js +123 -0
  357. package/vendor/zod/locales/bn.d.ts +4 -0
  358. package/vendor/zod/locales/bn.js +111 -0
  359. package/vendor/zod/locales/ca.d.ts +4 -0
  360. package/vendor/zod/locales/ca.js +110 -0
  361. package/vendor/zod/locales/ckb.d.ts +4 -0
  362. package/vendor/zod/locales/ckb.js +131 -0
  363. package/vendor/zod/locales/cs.d.ts +4 -0
  364. package/vendor/zod/locales/cs.js +114 -0
  365. package/vendor/zod/locales/da.d.ts +4 -0
  366. package/vendor/zod/locales/da.js +118 -0
  367. package/vendor/zod/locales/de.d.ts +4 -0
  368. package/vendor/zod/locales/de.js +111 -0
  369. package/vendor/zod/locales/el.d.ts +4 -0
  370. package/vendor/zod/locales/el.js +110 -0
  371. package/vendor/zod/locales/en.d.ts +4 -0
  372. package/vendor/zod/locales/en.js +123 -0
  373. package/vendor/zod/locales/eo.d.ts +4 -0
  374. package/vendor/zod/locales/eo.js +112 -0
  375. package/vendor/zod/locales/es.d.ts +4 -0
  376. package/vendor/zod/locales/es.js +134 -0
  377. package/vendor/zod/locales/fa.d.ts +4 -0
  378. package/vendor/zod/locales/fa.js +117 -0
  379. package/vendor/zod/locales/fi.d.ts +4 -0
  380. package/vendor/zod/locales/fi.js +115 -0
  381. package/vendor/zod/locales/fr-CA.d.ts +4 -0
  382. package/vendor/zod/locales/fr-CA.js +110 -0
  383. package/vendor/zod/locales/fr.d.ts +4 -0
  384. package/vendor/zod/locales/fr.js +127 -0
  385. package/vendor/zod/locales/gu.d.ts +4 -0
  386. package/vendor/zod/locales/gu.js +111 -0
  387. package/vendor/zod/locales/he.d.ts +4 -0
  388. package/vendor/zod/locales/he.js +219 -0
  389. package/vendor/zod/locales/hi.d.ts +4 -0
  390. package/vendor/zod/locales/hi.js +109 -0
  391. package/vendor/zod/locales/hr.d.ts +4 -0
  392. package/vendor/zod/locales/hr.js +124 -0
  393. package/vendor/zod/locales/hu.d.ts +4 -0
  394. package/vendor/zod/locales/hu.js +111 -0
  395. package/vendor/zod/locales/hy.d.ts +4 -0
  396. package/vendor/zod/locales/hy.js +156 -0
  397. package/vendor/zod/locales/id.d.ts +4 -0
  398. package/vendor/zod/locales/id.js +109 -0
  399. package/vendor/zod/locales/index.d.ts +62 -0
  400. package/vendor/zod/locales/index.js +62 -0
  401. package/vendor/zod/locales/is.d.ts +4 -0
  402. package/vendor/zod/locales/is.js +112 -0
  403. package/vendor/zod/locales/it.d.ts +4 -0
  404. package/vendor/zod/locales/it.js +111 -0
  405. package/vendor/zod/locales/ja.d.ts +4 -0
  406. package/vendor/zod/locales/ja.js +110 -0
  407. package/vendor/zod/locales/ka.d.ts +4 -0
  408. package/vendor/zod/locales/ka.js +115 -0
  409. package/vendor/zod/locales/kh.d.ts +5 -0
  410. package/vendor/zod/locales/kh.js +5 -0
  411. package/vendor/zod/locales/km.d.ts +4 -0
  412. package/vendor/zod/locales/km.js +113 -0
  413. package/vendor/zod/locales/kn.d.ts +4 -0
  414. package/vendor/zod/locales/kn.js +114 -0
  415. package/vendor/zod/locales/ko.d.ts +4 -0
  416. package/vendor/zod/locales/ko.js +114 -0
  417. package/vendor/zod/locales/lt.d.ts +4 -0
  418. package/vendor/zod/locales/lt.js +205 -0
  419. package/vendor/zod/locales/mk.d.ts +4 -0
  420. package/vendor/zod/locales/mk.js +112 -0
  421. package/vendor/zod/locales/ms.d.ts +4 -0
  422. package/vendor/zod/locales/ms.js +110 -0
  423. package/vendor/zod/locales/ne.d.ts +4 -0
  424. package/vendor/zod/locales/ne.js +109 -0
  425. package/vendor/zod/locales/nl.d.ts +4 -0
  426. package/vendor/zod/locales/nl.js +113 -0
  427. package/vendor/zod/locales/nn.d.ts +4 -0
  428. package/vendor/zod/locales/nn.js +111 -0
  429. package/vendor/zod/locales/no.d.ts +4 -0
  430. package/vendor/zod/locales/no.js +111 -0
  431. package/vendor/zod/locales/ota.d.ts +4 -0
  432. package/vendor/zod/locales/ota.js +112 -0
  433. package/vendor/zod/locales/package.json +7 -0
  434. package/vendor/zod/locales/pl.d.ts +4 -0
  435. package/vendor/zod/locales/pl.js +112 -0
  436. package/vendor/zod/locales/ps.d.ts +4 -0
  437. package/vendor/zod/locales/ps.js +117 -0
  438. package/vendor/zod/locales/pt-BR.d.ts +4 -0
  439. package/vendor/zod/locales/pt-BR.js +141 -0
  440. package/vendor/zod/locales/pt.d.ts +4 -0
  441. package/vendor/zod/locales/pt.js +140 -0
  442. package/vendor/zod/locales/ro.d.ts +4 -0
  443. package/vendor/zod/locales/ro.js +120 -0
  444. package/vendor/zod/locales/ru.d.ts +4 -0
  445. package/vendor/zod/locales/ru.js +166 -0
  446. package/vendor/zod/locales/sk.d.ts +4 -0
  447. package/vendor/zod/locales/sk.js +114 -0
  448. package/vendor/zod/locales/sl.d.ts +4 -0
  449. package/vendor/zod/locales/sl.js +112 -0
  450. package/vendor/zod/locales/sv.d.ts +4 -0
  451. package/vendor/zod/locales/sv.js +113 -0
  452. package/vendor/zod/locales/ta.d.ts +4 -0
  453. package/vendor/zod/locales/ta.js +113 -0
  454. package/vendor/zod/locales/th.d.ts +4 -0
  455. package/vendor/zod/locales/th.js +113 -0
  456. package/vendor/zod/locales/tk.d.ts +4 -0
  457. package/vendor/zod/locales/tk.js +105 -0
  458. package/vendor/zod/locales/tr.d.ts +4 -0
  459. package/vendor/zod/locales/tr.js +108 -0
  460. package/vendor/zod/locales/ua.d.ts +5 -0
  461. package/vendor/zod/locales/ua.js +5 -0
  462. package/vendor/zod/locales/uk.d.ts +4 -0
  463. package/vendor/zod/locales/uk.js +111 -0
  464. package/vendor/zod/locales/ur.d.ts +4 -0
  465. package/vendor/zod/locales/ur.js +113 -0
  466. package/vendor/zod/locales/uz.d.ts +4 -0
  467. package/vendor/zod/locales/uz.js +111 -0
  468. package/vendor/zod/locales/vi.d.ts +4 -0
  469. package/vendor/zod/locales/vi.js +111 -0
  470. package/vendor/zod/locales/yo.d.ts +4 -0
  471. package/vendor/zod/locales/yo.js +110 -0
  472. package/vendor/zod/locales/zh-CN.d.ts +4 -0
  473. package/vendor/zod/locales/zh-CN.js +112 -0
  474. package/vendor/zod/locales/zh-TW.d.ts +4 -0
  475. package/vendor/zod/locales/zh-TW.js +110 -0
  476. package/vendor/zod/mini/checks.d.ts +1 -0
  477. package/vendor/zod/mini/checks.js +1 -0
  478. package/vendor/zod/mini/coerce.d.ts +7 -0
  479. package/vendor/zod/mini/coerce.js +22 -0
  480. package/vendor/zod/mini/deep-partial.d.ts +14 -0
  481. package/vendor/zod/mini/deep-partial.js +13 -0
  482. package/vendor/zod/mini/external.d.ts +16 -0
  483. package/vendor/zod/mini/external.js +16 -0
  484. package/vendor/zod/mini/in-out.d.ts +8 -0
  485. package/vendor/zod/mini/in-out.js +36 -0
  486. package/vendor/zod/mini/index.d.ts +3 -0
  487. package/vendor/zod/mini/index.js +3 -0
  488. package/vendor/zod/mini/iso.d.ts +22 -0
  489. package/vendor/zod/mini/iso.js +34 -0
  490. package/vendor/zod/mini/package.json +7 -0
  491. package/vendor/zod/mini/parse.d.ts +1 -0
  492. package/vendor/zod/mini/parse.js +1 -0
  493. package/vendor/zod/mini/schemas.d.ts +475 -0
  494. package/vendor/zod/mini/schemas.js +987 -0
  495. package/vendor/zod/package.json +7 -0
  496. package/vendor/zodexy/dist/esm/index.js +1274 -0
  497. package/vendor/zodexy/dist/index.js +1088 -0
  498. package/vendor/zodexy/dist/schema.zodexy.json +1036 -0
  499. package/dist/fundamentalTypes/nativeEnumType.d.ts +0 -6
  500. package/dist/fundamentalTypes/nativeEnumType.d.ts.map +0 -1
  501. package/src/fundamentalTypes/catchType.js +0 -140
  502. package/src/fundamentalTypes/enumType.js +0 -52
  503. package/src/fundamentalTypes/literalType.js +0 -81
  504. package/src/fundamentalTypes/nativeEnumType.js +0 -157
  505. package/src/fundamentalTypes/neverType.js +0 -49
  506. package/src/fundamentalTypes/recordType.js +0 -42
  507. package/src/fundamentalTypes/tupleType.js +0 -39
  508. package/src/fundamentalTypes/voidType.js +0 -48
  509. package/vendor/zod/lib/index.mjs +0 -4236
  510. package/vendor/zodex/dist/esm/dezerialize.d.ts +0 -26
  511. package/vendor/zodex/dist/esm/dezerialize.js +0 -393
  512. package/vendor/zodex/dist/esm/index.d.ts +0 -9
  513. package/vendor/zodex/dist/esm/index.js +0 -4
  514. package/vendor/zodex/dist/esm/infer.d.ts +0 -29
  515. package/vendor/zodex/dist/esm/package.json +0 -1
  516. package/vendor/zodex/dist/esm/types.d.ts +0 -201
  517. package/vendor/zodex/dist/esm/types.js +0 -13
  518. package/vendor/zodex/dist/esm/ui.d.ts +0 -23
  519. package/vendor/zodex/dist/esm/ui.js +0 -10
  520. package/vendor/zodex/dist/esm/zerialize.d.ts +0 -50
  521. package/vendor/zodex/dist/esm/zerialize.js +0 -417
  522. package/vendor/zodex/dist/esm/zod-types.d.ts +0 -11
  523. /package/vendor/{zodex/dist/esm/infer.js → zod/core/json-schema.js} +0 -0
  524. /package/vendor/{zodex/dist/esm/zod-types.js → zod/core/standard-schema.js} +0 -0
@@ -0,0 +1,660 @@
1
+ import { globalRegistry } from "../core/registries.js";
2
+ import { assignProp, isPlainObject } from "../core/util.js";
3
+ import * as _checks from "./checks.js";
4
+ import * as _iso from "./iso.js";
5
+ import * as _schemas from "./schemas.js";
6
+ // Local z object to avoid circular dependency with ../index.js
7
+ const z = {
8
+ ..._schemas,
9
+ ..._checks,
10
+ iso: _iso,
11
+ };
12
+ // Keys that are recognized and handled by the conversion logic
13
+ const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([
14
+ // Schema identification
15
+ "$schema",
16
+ "$ref",
17
+ "$defs",
18
+ "definitions",
19
+ // Core schema keywords
20
+ "$id",
21
+ "id",
22
+ "$comment",
23
+ "$anchor",
24
+ "$vocabulary",
25
+ "$dynamicRef",
26
+ "$dynamicAnchor",
27
+ // Type
28
+ "type",
29
+ "enum",
30
+ "const",
31
+ // Composition
32
+ "anyOf",
33
+ "oneOf",
34
+ "allOf",
35
+ "not",
36
+ // Object
37
+ "properties",
38
+ "required",
39
+ "additionalProperties",
40
+ "patternProperties",
41
+ "propertyNames",
42
+ "minProperties",
43
+ "maxProperties",
44
+ // Array
45
+ "items",
46
+ "prefixItems",
47
+ "additionalItems",
48
+ "minItems",
49
+ "maxItems",
50
+ "uniqueItems",
51
+ "contains",
52
+ "minContains",
53
+ "maxContains",
54
+ // String
55
+ "minLength",
56
+ "maxLength",
57
+ "pattern",
58
+ "format",
59
+ // Number
60
+ "minimum",
61
+ "maximum",
62
+ "exclusiveMinimum",
63
+ "exclusiveMaximum",
64
+ "multipleOf",
65
+ // Already handled metadata
66
+ "description",
67
+ "default",
68
+ // Content
69
+ "contentEncoding",
70
+ "contentMediaType",
71
+ "contentSchema",
72
+ // Unsupported (error-throwing)
73
+ "unevaluatedItems",
74
+ "unevaluatedProperties",
75
+ "if",
76
+ "then",
77
+ "else",
78
+ "dependentSchemas",
79
+ "dependentRequired",
80
+ // OpenAPI
81
+ "nullable",
82
+ "readOnly",
83
+ ]);
84
+ function detectVersion(schema, defaultTarget) {
85
+ const $schema = schema.$schema;
86
+ if ($schema === "https://json-schema.org/draft/2020-12/schema") {
87
+ return "draft-2020-12";
88
+ }
89
+ if ($schema === "http://json-schema.org/draft-07/schema#") {
90
+ return "draft-7";
91
+ }
92
+ if ($schema === "http://json-schema.org/draft-04/schema#") {
93
+ return "draft-4";
94
+ }
95
+ // Use defaultTarget if provided, otherwise default to draft-2020-12
96
+ return defaultTarget ?? "draft-2020-12";
97
+ }
98
+ // Positional schemas constrain the elements that are present; only minItems makes them required.
99
+ function applyMinItems(items, minItems) {
100
+ return items.map((item, index) => (index < minItems ? item : item.optional()));
101
+ }
102
+ // Inverse of the encoding applied to $ref pointer segments in to-json-schema.ts. Per RFC 6901 the `~1` replacement must run before `~0`.
103
+ function decodeJSONPointerSegment(segment) {
104
+ return segment.replace(/~1/g, "/").replace(/~0/g, "~");
105
+ }
106
+ function resolveRef(ref, ctx) {
107
+ if (!ref.startsWith("#")) {
108
+ throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
109
+ }
110
+ const path = ref.slice(1).split("/").filter(Boolean);
111
+ // Handle root reference "#"
112
+ if (path.length === 0) {
113
+ return ctx.rootSchema;
114
+ }
115
+ const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
116
+ if (path[0] === defsKey) {
117
+ const key = path[1] === undefined ? undefined : decodeJSONPointerSegment(path[1]);
118
+ if (!key || !ctx.defs[key]) {
119
+ throw new Error(`Reference not found: ${ref}`);
120
+ }
121
+ return ctx.defs[key];
122
+ }
123
+ throw new Error(`Reference not found: ${ref}`);
124
+ }
125
+ /**
126
+ * Rejects every own key that fails `keySchema`, before `objectSchema` runs. The
127
+ * guard has to see the raw input: an object parse drops `__proto__` and can add
128
+ * keys from a property `default`, so its output is not the set of names the
129
+ * instance actually carried.
130
+ */
131
+ function checkPropertyNames(objectSchema, keySchema) {
132
+ // An identity transform, not z.any(), so `toJSONSchema` reports the object on both the input and the output side of the pipe.
133
+ const guard = z
134
+ .transform((value) => value)
135
+ .check((payload) => {
136
+ const value = payload.value;
137
+ if (typeof value !== "object" || value === null || Array.isArray(value))
138
+ return;
139
+ for (const key of Object.getOwnPropertyNames(value)) {
140
+ const result = keySchema.safeParse(key);
141
+ if (result.success)
142
+ continue;
143
+ payload.issues.push({
144
+ code: "invalid_key",
145
+ origin: "record",
146
+ issues: result.error.issues,
147
+ input: key,
148
+ path: [key],
149
+ continue: true,
150
+ });
151
+ }
152
+ });
153
+ return guard.pipe(objectSchema);
154
+ }
155
+ function getTupleRest(restSchema, ctx) {
156
+ if (restSchema === false) {
157
+ return undefined;
158
+ }
159
+ if (restSchema === undefined || restSchema === true) {
160
+ return z.any();
161
+ }
162
+ return convertSchema(restSchema, ctx);
163
+ }
164
+ // the RFC 3339 full-time keyword, narrower than `z.iso.time()`; local because sharing it via `timeSource` pins that builder into every bundle (+139 B gzipped on a mini `z.boolean()`)
165
+ const fullTime = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
166
+ function convertBaseSchema(schema, ctx) {
167
+ // Handle unsupported features
168
+ if (schema.not !== undefined) {
169
+ // Special case: { not: {} } represents never
170
+ if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
171
+ return z.never();
172
+ }
173
+ throw new Error("not is not supported in Zod (except { not: {} } for never)");
174
+ }
175
+ if (schema.unevaluatedItems !== undefined) {
176
+ throw new Error("unevaluatedItems is not supported");
177
+ }
178
+ if (schema.unevaluatedProperties !== undefined) {
179
+ throw new Error("unevaluatedProperties is not supported");
180
+ }
181
+ if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
182
+ throw new Error("Conditional schemas (if/then/else) are not supported");
183
+ }
184
+ if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
185
+ throw new Error("dependentSchemas and dependentRequired are not supported");
186
+ }
187
+ // Handle $ref
188
+ if (schema.$ref) {
189
+ const refPath = schema.$ref;
190
+ if (ctx.refs.has(refPath)) {
191
+ return ctx.refs.get(refPath);
192
+ }
193
+ if (ctx.processing.has(refPath)) {
194
+ // Circular reference - use lazy
195
+ return z.lazy(() => {
196
+ if (!ctx.refs.has(refPath)) {
197
+ throw new Error(`Circular reference not resolved: ${refPath}`);
198
+ }
199
+ return ctx.refs.get(refPath);
200
+ });
201
+ }
202
+ ctx.processing.add(refPath);
203
+ const resolved = resolveRef(refPath, ctx);
204
+ const zodSchema = convertSchema(resolved, ctx);
205
+ ctx.refs.set(refPath, zodSchema);
206
+ ctx.processing.delete(refPath);
207
+ return zodSchema;
208
+ }
209
+ // Handle enum
210
+ if (schema.enum !== undefined) {
211
+ const enumValues = schema.enum;
212
+ // Special case: OpenAPI 3.0 null representation { type: "string", nullable: true, enum: [null] }
213
+ if (ctx.version === "openapi-3.0" &&
214
+ schema.nullable === true &&
215
+ enumValues.length === 1 &&
216
+ enumValues[0] === null) {
217
+ return z.null();
218
+ }
219
+ if (enumValues.length === 0) {
220
+ return z.never();
221
+ }
222
+ if (enumValues.length === 1) {
223
+ return z.literal(enumValues[0]);
224
+ }
225
+ // Check if all values are strings
226
+ if (enumValues.every((v) => typeof v === "string")) {
227
+ return z.enum(enumValues);
228
+ }
229
+ // Mixed types - use union of literals
230
+ const literalSchemas = enumValues.map((v) => z.literal(v));
231
+ if (literalSchemas.length < 2) {
232
+ return literalSchemas[0];
233
+ }
234
+ return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
235
+ }
236
+ // Handle const
237
+ if (schema.const !== undefined) {
238
+ return z.literal(schema.const);
239
+ }
240
+ // Handle type
241
+ const type = schema.type;
242
+ if (Array.isArray(type)) {
243
+ // Expand type array into anyOf union
244
+ const typeSchemas = type.map((t) => {
245
+ const typeSchema = { ...schema, type: t };
246
+ return convertBaseSchema(typeSchema, ctx);
247
+ });
248
+ if (typeSchemas.length === 0) {
249
+ return z.never();
250
+ }
251
+ if (typeSchemas.length === 1) {
252
+ return typeSchemas[0];
253
+ }
254
+ return z.union(typeSchemas);
255
+ }
256
+ if (!type) {
257
+ // No type specified - empty schema (any)
258
+ return z.any();
259
+ }
260
+ let zodSchema;
261
+ switch (type) {
262
+ case "string": {
263
+ let stringSchema = z.string();
264
+ // Apply format using .check() with Zod format functions
265
+ if (schema.format) {
266
+ const format = schema.format;
267
+ // Map common formats to Zod check functions
268
+ if (format === "email") {
269
+ stringSchema = stringSchema.check(z.email());
270
+ }
271
+ else if (format === "uri" || format === "uri-reference") {
272
+ stringSchema = stringSchema.check(z.url());
273
+ }
274
+ else if (format === "uuid" || format === "guid") {
275
+ stringSchema = stringSchema.check(z.uuid());
276
+ }
277
+ else if (format === "date-time") {
278
+ stringSchema = stringSchema.check(z.iso.datetime({ offset: true }));
279
+ }
280
+ else if (format === "date") {
281
+ stringSchema = stringSchema.check(z.iso.date());
282
+ }
283
+ else if (format === "time") {
284
+ stringSchema = stringSchema.check(z.regex(fullTime));
285
+ }
286
+ else if (format === "duration") {
287
+ stringSchema = stringSchema.check(z.iso.duration());
288
+ }
289
+ else if (format === "hostname") {
290
+ stringSchema = stringSchema.check(z.hostname());
291
+ }
292
+ else if (format === "ipv4") {
293
+ stringSchema = stringSchema.check(z.ipv4());
294
+ }
295
+ else if (format === "ipv6") {
296
+ stringSchema = stringSchema.check(z.ipv6());
297
+ }
298
+ else if (format === "mac") {
299
+ stringSchema = stringSchema.check(z.mac());
300
+ }
301
+ else if (format === "cidr") {
302
+ stringSchema = stringSchema.check(z.cidrv4());
303
+ }
304
+ else if (format === "cidr-v6") {
305
+ stringSchema = stringSchema.check(z.cidrv6());
306
+ }
307
+ else if (format === "base64") {
308
+ stringSchema = stringSchema.check(z.base64());
309
+ }
310
+ else if (format === "base64url") {
311
+ stringSchema = stringSchema.check(z.base64url());
312
+ }
313
+ else if (format === "e164") {
314
+ stringSchema = stringSchema.check(z.e164());
315
+ }
316
+ else if (format === "credit_card") {
317
+ stringSchema = stringSchema.check(z.creditCard());
318
+ }
319
+ else if (format === "jwt") {
320
+ stringSchema = stringSchema.check(z.jwt());
321
+ }
322
+ else if (format === "emoji") {
323
+ stringSchema = stringSchema.check(z.emoji());
324
+ }
325
+ else if (format === "nanoid") {
326
+ stringSchema = stringSchema.check(z.nanoid());
327
+ }
328
+ else if (format === "cuid") {
329
+ stringSchema = stringSchema.check(z.cuid());
330
+ }
331
+ else if (format === "cuid2") {
332
+ stringSchema = stringSchema.check(z.cuid2());
333
+ }
334
+ else if (format === "ulid") {
335
+ stringSchema = stringSchema.check(z.ulid());
336
+ }
337
+ else if (format === "xid") {
338
+ stringSchema = stringSchema.check(z.xid());
339
+ }
340
+ else if (format === "ksuid") {
341
+ stringSchema = stringSchema.check(z.ksuid());
342
+ }
343
+ // Note: json-string format is not currently supported by Zod
344
+ // Custom formats are ignored - keep as plain string
345
+ }
346
+ // Apply constraints
347
+ if (typeof schema.minLength === "number") {
348
+ stringSchema = stringSchema.min(schema.minLength);
349
+ }
350
+ if (typeof schema.maxLength === "number") {
351
+ stringSchema = stringSchema.max(schema.maxLength);
352
+ }
353
+ if (schema.pattern) {
354
+ // JSON Schema patterns are not implicitly anchored (match anywhere in string)
355
+ stringSchema = stringSchema.regex(new RegExp(schema.pattern));
356
+ }
357
+ zodSchema = stringSchema;
358
+ break;
359
+ }
360
+ case "number":
361
+ case "integer": {
362
+ let numberSchema = type === "integer" ? z.number().int() : z.number();
363
+ // Apply constraints
364
+ // In draft-04, `exclusiveMinimum: true` makes the sibling `minimum` exclusive rather than an independent bound, so the inclusive `.min()` is skipped; emitting it too would be dominated by the exclusive check and report a second, weaker issue.
365
+ if (typeof schema.minimum === "number" && schema.exclusiveMinimum !== true) {
366
+ numberSchema = numberSchema.min(schema.minimum);
367
+ }
368
+ if (typeof schema.maximum === "number" && schema.exclusiveMaximum !== true) {
369
+ numberSchema = numberSchema.max(schema.maximum);
370
+ }
371
+ if (typeof schema.exclusiveMinimum === "number") {
372
+ numberSchema = numberSchema.gt(schema.exclusiveMinimum);
373
+ }
374
+ else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
375
+ numberSchema = numberSchema.gt(schema.minimum);
376
+ }
377
+ if (typeof schema.exclusiveMaximum === "number") {
378
+ numberSchema = numberSchema.lt(schema.exclusiveMaximum);
379
+ }
380
+ else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
381
+ numberSchema = numberSchema.lt(schema.maximum);
382
+ }
383
+ if (typeof schema.multipleOf === "number") {
384
+ numberSchema = numberSchema.multipleOf(schema.multipleOf);
385
+ }
386
+ zodSchema = numberSchema;
387
+ break;
388
+ }
389
+ case "boolean": {
390
+ zodSchema = z.boolean();
391
+ break;
392
+ }
393
+ case "null": {
394
+ zodSchema = z.null();
395
+ break;
396
+ }
397
+ case "object": {
398
+ const shape = {};
399
+ const properties = schema.properties || {};
400
+ const requiredSet = new Set(schema.required || []);
401
+ const additionalSchema = typeof schema.additionalProperties === "object"
402
+ ? convertSchema(schema.additionalProperties, ctx)
403
+ : undefined;
404
+ // Convert properties - mark optional ones
405
+ for (const [key, propSchema] of Object.entries(properties)) {
406
+ const propZodSchema = convertSchema(propSchema, ctx);
407
+ // If not in required array, make it optional. assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter
408
+ assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
409
+ }
410
+ // Handle patternProperties
411
+ if (schema.patternProperties) {
412
+ // patternProperties: keys matching pattern must satisfy corresponding schema. Use loose records so non-matching keys pass through
413
+ const patternProps = schema.patternProperties;
414
+ const patternKeys = Object.keys(patternProps);
415
+ const looseRecords = [];
416
+ for (const pattern of patternKeys) {
417
+ const patternValue = convertSchema(patternProps[pattern], ctx);
418
+ const keySchema = z.string().regex(new RegExp(pattern));
419
+ looseRecords.push(z.looseRecord(keySchema, patternValue));
420
+ }
421
+ // Build intersection: object schema + all pattern property records
422
+ const schemasToIntersect = [];
423
+ if (Object.keys(shape).length > 0) {
424
+ // Use passthrough so patternProperties can validate additional keys
425
+ schemasToIntersect.push(z.object(shape).passthrough());
426
+ }
427
+ schemasToIntersect.push(...looseRecords);
428
+ if (schemasToIntersect.length === 0) {
429
+ zodSchema = z.object({}).passthrough();
430
+ }
431
+ else if (schemasToIntersect.length === 1) {
432
+ zodSchema = schemasToIntersect[0];
433
+ }
434
+ else {
435
+ // Chain intersections: (A & B) & C & D ...
436
+ let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
437
+ for (let i = 2; i < schemasToIntersect.length; i++) {
438
+ result = z.intersection(result, schemasToIntersect[i]);
439
+ }
440
+ zodSchema = result;
441
+ }
442
+ // When additionalProperties is false, reject keys that are neither defined in properties nor matched by any patternProperty.
443
+ if (schema.additionalProperties === false) {
444
+ const propertyKeys = Object.keys(shape);
445
+ const patterns = patternKeys.map((p) => new RegExp(p));
446
+ const basePatternSchema = zodSchema;
447
+ zodSchema = zodSchema.check((payload) => {
448
+ if (!isPlainObject(payload.value))
449
+ return;
450
+ const unrecognized = [];
451
+ for (const key of Object.keys(payload.value)) {
452
+ if (propertyKeys.includes(key))
453
+ continue;
454
+ if (patterns.some((regex) => regex.test(key)))
455
+ continue;
456
+ unrecognized.push(key);
457
+ }
458
+ if (unrecognized.length) {
459
+ payload.issues.push({
460
+ code: "unrecognized_keys",
461
+ keys: unrecognized,
462
+ input: payload.value,
463
+ inst: basePatternSchema,
464
+ });
465
+ }
466
+ });
467
+ }
468
+ }
469
+ else {
470
+ // Handle additionalProperties. In JSON Schema, additionalProperties defaults to true (allow any extra properties). In Zod, objects strip unknown keys by default, so we need to handle this explicitly
471
+ const objectSchema = z.object(shape);
472
+ if (schema.additionalProperties === false) {
473
+ // Strict mode - no extra properties allowed
474
+ zodSchema = objectSchema.strict();
475
+ }
476
+ else if (additionalSchema) {
477
+ // Extra properties must match the specified schema
478
+ zodSchema = objectSchema.catchall(additionalSchema);
479
+ }
480
+ else {
481
+ // additionalProperties is true or undefined - allow any extra properties (passthrough)
482
+ zodSchema = objectSchema.passthrough();
483
+ }
484
+ }
485
+ // propertyNames constrains key *names* only, and says nothing about which keys are required or how their values validate. Layering it on top of the result keeps properties/patternProperties/additionalProperties composing underneath. `true` allows every name, so it needs no guard.
486
+ if (schema.propertyNames !== undefined && schema.propertyNames !== true) {
487
+ // Keys are always strings, so a propertyNames subschema that omits `type` still constrains them — without this it would convert to z.any().
488
+ const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === undefined
489
+ ? { type: "string", ...schema.propertyNames }
490
+ : schema.propertyNames;
491
+ zodSchema = checkPropertyNames(zodSchema, convertSchema(keyJSONSchema, ctx));
492
+ }
493
+ break;
494
+ }
495
+ case "array": {
496
+ // TODO: uniqueItems and contains/minContains/maxContains are not supported
497
+ // Check if this is a tuple (prefixItems or items as array)
498
+ const prefixItems = schema.prefixItems;
499
+ const items = schema.items;
500
+ if (prefixItems && Array.isArray(prefixItems)) {
501
+ // Tuple with prefixItems (draft-2020-12)
502
+ const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
503
+ const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
504
+ const positionalItems = applyMinItems(tupleItems, minItems);
505
+ const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : undefined;
506
+ const tupleSchema = z.tuple(positionalItems);
507
+ zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
508
+ // Apply minItems/maxItems constraints to tuples
509
+ if (typeof schema.minItems === "number") {
510
+ zodSchema = zodSchema.check(z.minLength(schema.minItems));
511
+ }
512
+ if (typeof schema.maxItems === "number") {
513
+ zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
514
+ }
515
+ }
516
+ else if (Array.isArray(items)) {
517
+ // Tuple with items array (draft-7)
518
+ const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
519
+ const tupleItems = items.map((item) => convertSchema(item, ctx));
520
+ const positionalItems = applyMinItems(tupleItems, minItems);
521
+ const rest = getTupleRest(schema.additionalItems, ctx);
522
+ const tupleSchema = z.tuple(positionalItems);
523
+ zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
524
+ // Apply minItems/maxItems constraints to tuples
525
+ if (typeof schema.minItems === "number") {
526
+ zodSchema = zodSchema.check(z.minLength(schema.minItems));
527
+ }
528
+ if (typeof schema.maxItems === "number") {
529
+ zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
530
+ }
531
+ }
532
+ else if (items !== undefined) {
533
+ // Regular array
534
+ const element = convertSchema(items, ctx);
535
+ let arraySchema = z.array(element);
536
+ // Apply constraints
537
+ if (typeof schema.minItems === "number") {
538
+ arraySchema = arraySchema.min(schema.minItems);
539
+ }
540
+ if (typeof schema.maxItems === "number") {
541
+ arraySchema = arraySchema.max(schema.maxItems);
542
+ }
543
+ zodSchema = arraySchema;
544
+ }
545
+ else {
546
+ // No items specified - array of any
547
+ zodSchema = z.array(z.any());
548
+ }
549
+ break;
550
+ }
551
+ default:
552
+ throw new Error(`Unsupported type: ${type}`);
553
+ }
554
+ return zodSchema;
555
+ }
556
+ function convertSchema(schema, ctx) {
557
+ if (typeof schema === "boolean") {
558
+ return schema ? z.any() : z.never();
559
+ }
560
+ // Convert base schema first (ignoring composition keywords)
561
+ let baseSchema = convertBaseSchema(schema, ctx);
562
+ const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
563
+ // Process composition keywords LAST (they can appear together)
564
+ // Handle anyOf - wrap base schema with union
565
+ if (schema.anyOf && Array.isArray(schema.anyOf)) {
566
+ const options = schema.anyOf.map((s) => convertSchema(s, ctx));
567
+ const anyOfUnion = z.union(options);
568
+ baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
569
+ }
570
+ // Handle oneOf - exclusive union (exactly one must match)
571
+ if (schema.oneOf && Array.isArray(schema.oneOf)) {
572
+ const options = schema.oneOf.map((s) => convertSchema(s, ctx));
573
+ const oneOfUnion = z.xor(options);
574
+ baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
575
+ }
576
+ // Handle allOf - wrap base schema with intersection
577
+ if (schema.allOf && Array.isArray(schema.allOf)) {
578
+ if (schema.allOf.length === 0) {
579
+ baseSchema = hasExplicitType ? baseSchema : z.any();
580
+ }
581
+ else {
582
+ let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
583
+ const startIdx = hasExplicitType ? 0 : 1;
584
+ for (let i = startIdx; i < schema.allOf.length; i++) {
585
+ result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
586
+ }
587
+ baseSchema = result;
588
+ }
589
+ }
590
+ // Handle nullable (OpenAPI 3.0)
591
+ if (schema.nullable === true && ctx.version === "openapi-3.0") {
592
+ baseSchema = z.nullable(baseSchema);
593
+ }
594
+ // Handle readOnly
595
+ if (schema.readOnly === true) {
596
+ baseSchema = z.readonly(baseSchema);
597
+ }
598
+ // Apply `default` so it wraps the fully-composed schema. This ensures `parse(undefined) -> default` works regardless of which branch of `convertBaseSchema` produced the inner schema (enum/const/not/typed/etc.).
599
+ if (schema.default !== undefined) {
600
+ baseSchema = baseSchema.default(schema.default);
601
+ }
602
+ // Collect non-description annotation metadata into the user-supplied registry. Description is handled separately below via `.describe()` to preserve the contract that `schema.description` reads from globalRegistry.
603
+ const extraMeta = {};
604
+ const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
605
+ for (const key of coreMetadataKeys) {
606
+ if (key in schema) {
607
+ extraMeta[key] = schema[key];
608
+ }
609
+ }
610
+ const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
611
+ for (const key of contentMetadataKeys) {
612
+ if (key in schema) {
613
+ extraMeta[key] = schema[key];
614
+ }
615
+ }
616
+ // `propertyNames` is enforced by a key guard, which `toJSONSchema` cannot infer, so the original keyword is carried as metadata to keep the round-trip lossless. Only where it was actually applied: on any other type it is inert, and on a `$ref` the metadata would land on the target every reference shares.
617
+ if (schema.propertyNames !== undefined && schema.type === "object" && schema.$ref === undefined) {
618
+ extraMeta.propertyNames = schema.propertyNames;
619
+ }
620
+ for (const key of Object.keys(schema)) {
621
+ if (!RECOGNIZED_KEYS.has(key)) {
622
+ assignProp(extraMeta, key, schema[key]);
623
+ }
624
+ }
625
+ if (Object.keys(extraMeta).length > 0) {
626
+ ctx.registry.add(baseSchema, extraMeta);
627
+ }
628
+ // Apply description last. `.describe()` clones the schema and sets `_zod.parent` on the clone, so registry lookups on the returned reference still resolve `extraMeta` via parent inheritance.
629
+ if (schema.description) {
630
+ baseSchema = baseSchema.describe(schema.description);
631
+ }
632
+ return baseSchema;
633
+ }
634
+ /**
635
+ * Converts a JSON Schema to a Zod schema. This function should be considered semi-experimental. It's behavior is liable to change. */
636
+ export function fromJSONSchema(schema, params) {
637
+ // Handle boolean schemas
638
+ if (typeof schema === "boolean") {
639
+ return schema ? z.any() : z.never();
640
+ }
641
+ // Normalize input via a JSON round-trip. This guarantees the converter walks a plain, finite, JSON-valid object graph: cyclic inputs fail here, getter/Proxy-based properties are materialized into static values, and class instances collapse to plain objects.
642
+ let normalized;
643
+ try {
644
+ normalized = JSON.parse(JSON.stringify(schema));
645
+ }
646
+ catch {
647
+ throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
648
+ }
649
+ const version = detectVersion(normalized, params?.defaultTarget);
650
+ const defs = (normalized.$defs || normalized.definitions || {});
651
+ const ctx = {
652
+ version,
653
+ defs,
654
+ refs: new Map(),
655
+ processing: new Set(),
656
+ rootSchema: normalized,
657
+ registry: params?.registry ?? globalRegistry,
658
+ };
659
+ return convertSchema(normalized, ctx);
660
+ }
@@ -0,0 +1,8 @@
1
+ import type * as core from "../core/index.js";
2
+ import * as schemas from "./schemas.js";
3
+ export type input<T> = core.input<T>;
4
+ export type output<T> = core.output<T>;
5
+ /** Returns a copy of the schema with every pipe replaced by its input side. A codec's checks are dropped: they constrain the decoded value the input side never produces. */
6
+ export declare function input<T extends core.$ZodType>(schema: T): schemas.ZodType<core.input<T>, core.input<T>>;
7
+ /** Returns a copy of the schema with every pipe replaced by its output side, carrying over the pipe's own checks. */
8
+ export declare function output<T extends core.$ZodType>(schema: T): schemas.ZodType<core.output<T>, core.output<T>>;