@guru-ai-product/ai-product-kit 0.2.251117192248 → 0.2.251118120602

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 (979) hide show
  1. package/mcp/skills/aipk_init_project/template/AGENTS_TEMPLATE.md +11 -11
  2. package/mcp/src/server.js +10 -10
  3. package/package.json +1 -1
  4. package/skills/aipk_aso-new-release/GURU_AI.md +4 -4
  5. package/skills/aipk_aso-new-release/SKILL.md +15 -1
  6. package/skills/aipk_development/GURU_AI.md +3 -3
  7. package/skills/aipk_development/SKILL.md +15 -1
  8. package/skills/aipk_format-requirement-pages-with-design/GURU_AI.md +3 -3
  9. package/skills/aipk_format-requirement-pages-with-design/SKILL.md +10 -1
  10. package/skills/aipk_init_project/GURU_AI.md +5 -5
  11. package/skills/aipk_init_project/SKILL.md +15 -1
  12. package/skills/aipk_initiative-planning/GURU_AI.md +7 -7
  13. package/skills/aipk_initiative-planning/SKILL.md +17 -1
  14. package/skills/aipk_requirements-changes/GURU_AI.md +6 -6
  15. package/skills/aipk_requirements-changes/SKILL.md +15 -1
  16. package/skills/aipk_requirements-documentation/GURU_AI.md +15 -15
  17. package/skills/aipk_requirements-documentation/SKILL.md +17 -1
  18. package/skills/aipk_requirements-intake/GURU_AI.md +9 -9
  19. package/skills/aipk_requirements-intake/SKILL.md +15 -1
  20. package/skills/aipk_skill_generate/GURU_AI.md +5 -5
  21. package/skills/aipk_skill_generate/SKILL.md +15 -1
  22. package/skills/aipk_tool_prompts/GURU_AI.md +8 -8
  23. package/skills/aipk_tool_prompts/SKILL.md +15 -1
  24. package/skills/aipk_update-requirements-from-design/GURU_AI.md +6 -116
  25. package/skills/aipk_update-requirements-from-design/SKILL.md +15 -1
  26. package/mcp/.doc_cache/04980c3595edbf2d_SKILL.md +0 -218
  27. package/mcp/.doc_cache/04e80f12d73851a2_/346/214/207/345/215/227/346/226/207/346/241/243/346/240/207/345/207/206/346/250/241/346/235/277.md +0 -59
  28. package/mcp/.doc_cache/07cc092c31fd7015_/345/267/245/345/205/267/344/275/277/347/224/250/346/214/207/345/215/227/346/250/241/346/235/277.md +0 -106
  29. package/mcp/.doc_cache/09ac9834a831e8b5_/346/212/200/346/234/257/346/226/271/346/241/210/350/257/204/344/274/260/344/270/216/345/217/257/350/241/214/346/200/247/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -72
  30. package/mcp/.doc_cache/0c0570b87cf4a98a_/351/234/200/346/261/202/350/277/255/344/273/243/346/250/241/346/235/277.md +0 -821
  31. package/mcp/.doc_cache/0c284fc4be48dbd3_/346/267/261/345/272/246/347/224/250/346/210/267/350/241/214/344/270/272/344/270/216/351/234/200/346/261/202/346/264/236/345/257/237/346/250/241/346/235/277.md +0 -59
  32. package/mcp/.doc_cache/0da74fe7b9aad548_K12/346/225/260/345/255/246/345/255/246/344/271/240/345/272/224/347/224/250/346/241/210/344/276/213.md +0 -371
  33. package/mcp/.doc_cache/1546780035ed893b_Draft_/344/272/247/345/223/201/351/234/200/346/261/202/350/215/211/347/250/277.md +0 -60
  34. package/mcp/.doc_cache/16d5f6b79f02c65e_/351/234/200/346/261/202/350/277/255/344/273/243/347/264/242/345/274/225.md +0 -30
  35. package/mcp/.doc_cache/1c631acd2940588e_index.md +0 -83
  36. package/mcp/.doc_cache/1e4a829f0abddb00_/344/272/247/345/223/201/350/247/204/345/210/222/346/250/241/346/235/277.md +0 -322
  37. package/mcp/.doc_cache/24f00280e7b9b2c7_index.md +0 -83
  38. package/mcp/.doc_cache/2767e2d4cd6afd5c_/345/225/206/344/270/232/345/214/226/350/247/204/345/210/222/346/250/241/346/235/277.md +0 -201
  39. package/mcp/.doc_cache/276d12074fd7af7d_SKILL.md +0 -243
  40. package/mcp/.doc_cache/2b6b35389546c3b9_SKILL.md +0 -407
  41. package/mcp/.doc_cache/2f45cddfb05ac32c_/351/234/200/346/261/202/350/277/255/344/273/243/347/264/242/345/274/225.md +0 -30
  42. package/mcp/.doc_cache/3086c6d32a0393da_Draft_/347/224/250/346/210/267/346/227/205/347/250/213/350/215/211/347/250/277.md +0 -84
  43. package/mcp/.doc_cache/33cd96cf79c86eaa_K12/346/225/260/345/255/246/345/255/246/344/271/240/345/272/224/347/224/250/346/241/210/344/276/213.md +0 -371
  44. package/mcp/.doc_cache/341909c063335dd2_/351/234/200/346/261/202/345/217/230/345/212/250/350/257/264/346/230/216/347/224/237/346/210/220Prompt.md +0 -349
  45. package/mcp/.doc_cache/3e0dfd0a1b9f6ce7_/344/272/247/345/223/201/351/234/200/346/261/202/345/217/221/347/216/260/344/270/216/351/252/214/350/257/201/346/250/241/346/235/277.md +0 -53
  46. package/mcp/.doc_cache/3eab19b804522d23_SKILL.md +0 -407
  47. package/mcp/.doc_cache/4b671afde6bb1fa8_/351/234/200/346/261/202/345/217/230/345/212/250/350/257/264/346/230/216/347/224/237/346/210/220/346/214/207/345/215/227.md +0 -292
  48. package/mcp/.doc_cache/4c780724e27f6f94_/351/234/200/346/261/202/350/277/255/344/273/243/346/250/241/346/235/277.md +0 -821
  49. package/mcp/.doc_cache/563de023ffa4a630_/345/237/213/347/202/271/350/247/204/350/214/203/346/226/207/346/241/243.md +0 -372
  50. package/mcp/.doc_cache/56975fb92532ee87_2_/345/212/237/350/203/275/351/234/200/346/261/202.md +0 -67
  51. package/mcp/.doc_cache/5a67e1c18353cfca_/345/270/202/345/234/272/346/234/272/344/274/232/350/257/204/344/274/260/344/270/216/347/253/236/344/272/211/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -53
  52. package/mcp/.doc_cache/5b8ba3d67e39371a_SKILL.md +0 -930
  53. package/mcp/.doc_cache/5b91334295d6ad31_SKILL.md +0 -588
  54. package/mcp/.doc_cache/609688b8b4332a01_/351/234/200/346/261/202/345/217/230/345/212/250/350/257/264/346/230/216/346/226/207/346/241/243/346/250/241/346/235/277.md +0 -576
  55. package/mcp/.doc_cache/61a0859a11a562ca_3_/345/225/206/344/270/232/345/214/226/347/255/226/347/225/245.md +0 -131
  56. package/mcp/.doc_cache/6643f4d546c6a03c_/346/267/261/345/272/246/347/224/250/346/210/267/350/241/214/344/270/272/344/270/216/351/234/200/346/261/202/346/264/236/345/257/237/346/250/241/346/235/277.md +0 -59
  57. package/mcp/.doc_cache/674c69479a90ad15_4_/347/224/250/346/210/267/347/225/214/351/235/242/344/270/216/344/275/223/351/252/214.md +0 -665
  58. package/mcp/.doc_cache/674f8b285658055d_/345/270/202/345/234/272/344/270/216/345/225/206/344/270/232/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -176
  59. package/mcp/.doc_cache/6cfccfda6b0e7641_SWOT/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -381
  60. package/mcp/.doc_cache/6fbc13740044659b_1_/344/272/247/345/223/201/345/256/232/344/275/215/344/270/216/345/210/206/346/236/220.md +0 -86
  61. package/mcp/.doc_cache/7842a4e7fe7a3b91_/346/212/200/346/234/257/350/247/204/345/210/222/346/250/241/346/235/277.md +0 -314
  62. package/mcp/.doc_cache/7db63a8354bf8037_2_/345/212/237/350/203/275/351/234/200/346/261/202.md +0 -67
  63. package/mcp/.doc_cache/81528b4e0b12a881_SKILL.md +0 -196
  64. package/mcp/.doc_cache/83d17bdb48d30903_4_/347/224/250/346/210/267/347/225/214/351/235/242/344/270/216/344/275/223/351/252/214.md +0 -665
  65. package/mcp/.doc_cache/88e1d483f18abd02_/345/237/213/347/202/271/350/247/204/350/214/203/346/226/207/346/241/243.md +0 -372
  66. package/mcp/.doc_cache/8f420425062dcb93_SWOT/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -381
  67. package/mcp/.doc_cache/8f981c56b3d4b17d_/345/225/206/344/270/232/345/214/226/350/247/204/345/210/222/346/250/241/346/235/277.md +0 -201
  68. package/mcp/.doc_cache/a3328dcce1521943_/345/270/202/345/234/272/344/270/216/345/225/206/344/270/232/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -176
  69. package/mcp/.doc_cache/a4ef757633f13133_/346/212/200/346/234/257/346/226/271/346/241/210/350/257/204/344/274/260/344/270/216/345/217/257/350/241/214/346/200/247/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -72
  70. package/mcp/.doc_cache/a90401fc94ca29a3_SKILL.md +0 -260
  71. package/mcp/.doc_cache/bad4b7992748a7a0_/344/272/247/345/223/201/351/234/200/346/261/202/345/217/221/347/216/260/344/270/216/351/252/214/350/257/201/346/250/241/346/235/277.md +0 -53
  72. package/mcp/.doc_cache/baeac26fdbcd25de_/344/272/247/345/223/201/350/247/204/345/210/222/346/250/241/346/235/277.md +0 -322
  73. package/mcp/.doc_cache/c58bcfc199ada118_SKILL.md +0 -196
  74. package/mcp/.doc_cache/c8305789db809e48_SKILL.md +0 -588
  75. package/mcp/.doc_cache/cache_mapping.json +0 -69
  76. package/mcp/.doc_cache/d09142514e6a9de0_/347/224/265/345/225/206/345/271/263/345/217/260/344/274/230/345/214/226/346/241/210/344/276/213.md +0 -426
  77. package/mcp/.doc_cache/d165d35fea568d64_/351/234/200/346/261/202/345/217/230/345/212/250/350/257/264/346/230/216/346/226/207/346/241/243/346/250/241/346/235/277.md +0 -576
  78. package/mcp/.doc_cache/d17b04c82d2497b2_/347/224/265/345/225/206/345/271/263/345/217/260/344/274/230/345/214/226/346/241/210/344/276/213.md +0 -426
  79. package/mcp/.doc_cache/d1cfa2f8882fcdf9_/346/214/207/345/215/227/346/226/207/346/241/243/346/240/207/345/207/206/346/250/241/346/235/277.md +0 -59
  80. package/mcp/.doc_cache/d2585b5df3d21fc9_3_/345/225/206/344/270/232/345/214/226/347/255/226/347/225/245.md +0 -131
  81. package/mcp/.doc_cache/d604a1290099121c_/351/234/200/346/261/202/345/217/230/345/212/250/350/257/264/346/230/216/347/224/237/346/210/220/346/214/207/345/215/227.md +0 -292
  82. package/mcp/.doc_cache/d66edce025de6b82_Draft_/344/272/247/345/223/201/351/234/200/346/261/202/350/215/211/347/250/277.md +0 -60
  83. package/mcp/.doc_cache/d6c3ff791e7da726_SKILL.md +0 -33
  84. package/mcp/.doc_cache/da2c3d4d7b8957af_SKILL.md +0 -218
  85. package/mcp/.doc_cache/da8f4d40a1e8f36a_/346/212/200/346/234/257/350/247/204/345/210/222/346/250/241/346/235/277.md +0 -314
  86. package/mcp/.doc_cache/db70562fc59f1658_SKILL.md +0 -260
  87. package/mcp/.doc_cache/dd61f22b0ec13e10_Draft_/347/224/250/346/210/267/346/227/205/347/250/213/350/215/211/347/250/277.md +0 -84
  88. package/mcp/.doc_cache/e1451d5b65894789_SKILL.md +0 -930
  89. package/mcp/.doc_cache/e4f23de1b5313796_1_/344/272/247/345/223/201/345/256/232/344/275/215/344/270/216/345/210/206/346/236/220.md +0 -86
  90. package/mcp/.doc_cache/e668cf08c5f905ca_/345/267/245/345/205/267/344/275/277/347/224/250/346/214/207/345/215/227/346/250/241/346/235/277.md +0 -106
  91. package/mcp/.doc_cache/e69eeaaf88a175df_/345/270/202/345/234/272/346/234/272/344/274/232/350/257/204/344/274/260/344/270/216/347/253/236/344/272/211/345/210/206/346/236/220/346/250/241/346/235/277.md +0 -53
  92. package/mcp/.doc_cache/ea4c5e5a6254f616_SKILL.md +0 -243
  93. package/mcp/.doc_cache/ec9ad6ce24808f0a_/351/234/200/346/261/202/345/217/230/345/212/250/350/257/264/346/230/216/347/224/237/346/210/220Prompt.md +0 -349
  94. package/mcp/node_modules/.package-lock.json +0 -147
  95. package/mcp/node_modules/@modelcontextprotocol/sdk/LICENSE +0 -7
  96. package/mcp/node_modules/@modelcontextprotocol/sdk/README.md +0 -110
  97. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts +0 -2
  98. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts.map +0 -1
  99. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/cli.js +0 -129
  100. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/cli.js.map +0 -1
  101. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.d.ts +0 -773
  102. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.d.ts.map +0 -1
  103. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.js +0 -206
  104. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.js.map +0 -1
  105. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.d.ts +0 -2
  106. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.d.ts.map +0 -1
  107. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.js +0 -357
  108. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.js.map +0 -1
  109. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/sse.d.ts +0 -22
  110. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/sse.d.ts.map +0 -1
  111. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/sse.js +0 -91
  112. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/sse.js.map +0 -1
  113. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.d.ts +0 -56
  114. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.d.ts.map +0 -1
  115. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.js +0 -135
  116. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.js.map +0 -1
  117. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.d.ts +0 -2
  118. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.d.ts.map +0 -1
  119. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.js +0 -51
  120. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/stdio.test.js.map +0 -1
  121. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.d.ts +0 -17
  122. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.d.ts.map +0 -1
  123. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.js +0 -61
  124. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/client/websocket.js.map +0 -1
  125. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.d.ts +0 -20
  126. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.d.ts.map +0 -1
  127. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.js +0 -47
  128. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.js.map +0 -1
  129. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.d.ts +0 -2
  130. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.d.ts.map +0 -1
  131. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.js +0 -74
  132. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/inMemory.test.js.map +0 -1
  133. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.d.ts +0 -112
  134. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.d.ts.map +0 -1
  135. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.js +0 -182
  136. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.js.map +0 -1
  137. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.d.ts +0 -2
  138. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.d.ts.map +0 -1
  139. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.js +0 -360
  140. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/index.test.js.map +0 -1
  141. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/sse.d.ts +0 -46
  142. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/sse.d.ts.map +0 -1
  143. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/sse.js +0 -116
  144. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/sse.js.map +0 -1
  145. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.d.ts +0 -28
  146. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.d.ts.map +0 -1
  147. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.js +0 -69
  148. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.js.map +0 -1
  149. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.d.ts +0 -2
  150. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.d.ts.map +0 -1
  151. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.js +0 -87
  152. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/server/stdio.test.js.map +0 -1
  153. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.d.ts +0 -149
  154. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.d.ts.map +0 -1
  155. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.js +0 -274
  156. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/protocol.js.map +0 -1
  157. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.d.ts +0 -13
  158. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.d.ts.map +0 -1
  159. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.js +0 -31
  160. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.js.map +0 -1
  161. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.d.ts +0 -2
  162. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.d.ts.map +0 -1
  163. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.js +0 -27
  164. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/stdio.test.js.map +0 -1
  165. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.d.ts +0 -39
  166. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.d.ts.map +0 -1
  167. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.js +0 -2
  168. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/shared/transport.js.map +0 -1
  169. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/types.d.ts +0 -26424
  170. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/types.d.ts.map +0 -1
  171. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/types.js +0 -996
  172. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/types.js.map +0 -1
  173. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.d.ts +0 -5
  174. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.d.ts.map +0 -1
  175. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.js +0 -11
  176. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.js.map +0 -1
  177. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.test.d.ts +0 -2
  178. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.test.d.ts.map +0 -1
  179. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.test.js +0 -14
  180. package/mcp/node_modules/@modelcontextprotocol/sdk/dist/utils.test.js.map +0 -1
  181. package/mcp/node_modules/@modelcontextprotocol/sdk/package.json +0 -61
  182. package/mcp/node_modules/bytes/History.md +0 -97
  183. package/mcp/node_modules/bytes/LICENSE +0 -23
  184. package/mcp/node_modules/bytes/Readme.md +0 -152
  185. package/mcp/node_modules/bytes/index.js +0 -170
  186. package/mcp/node_modules/bytes/package.json +0 -42
  187. package/mcp/node_modules/content-type/HISTORY.md +0 -29
  188. package/mcp/node_modules/content-type/LICENSE +0 -22
  189. package/mcp/node_modules/content-type/README.md +0 -94
  190. package/mcp/node_modules/content-type/index.js +0 -225
  191. package/mcp/node_modules/content-type/package.json +0 -42
  192. package/mcp/node_modules/depd/History.md +0 -103
  193. package/mcp/node_modules/depd/LICENSE +0 -22
  194. package/mcp/node_modules/depd/Readme.md +0 -280
  195. package/mcp/node_modules/depd/index.js +0 -538
  196. package/mcp/node_modules/depd/lib/browser/index.js +0 -77
  197. package/mcp/node_modules/depd/package.json +0 -45
  198. package/mcp/node_modules/http-errors/HISTORY.md +0 -180
  199. package/mcp/node_modules/http-errors/LICENSE +0 -23
  200. package/mcp/node_modules/http-errors/README.md +0 -169
  201. package/mcp/node_modules/http-errors/index.js +0 -289
  202. package/mcp/node_modules/http-errors/package.json +0 -50
  203. package/mcp/node_modules/iconv-lite/Changelog.md +0 -236
  204. package/mcp/node_modules/iconv-lite/LICENSE +0 -21
  205. package/mcp/node_modules/iconv-lite/README.md +0 -138
  206. package/mcp/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -532
  207. package/mcp/node_modules/iconv-lite/encodings/dbcs-data.js +0 -185
  208. package/mcp/node_modules/iconv-lite/encodings/index.js +0 -23
  209. package/mcp/node_modules/iconv-lite/encodings/internal.js +0 -218
  210. package/mcp/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -75
  211. package/mcp/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  212. package/mcp/node_modules/iconv-lite/encodings/sbcs-data.js +0 -178
  213. package/mcp/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  214. package/mcp/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  215. package/mcp/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  216. package/mcp/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  217. package/mcp/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  218. package/mcp/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  219. package/mcp/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  220. package/mcp/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  221. package/mcp/node_modules/iconv-lite/encodings/utf16.js +0 -187
  222. package/mcp/node_modules/iconv-lite/encodings/utf32.js +0 -307
  223. package/mcp/node_modules/iconv-lite/encodings/utf7.js +0 -283
  224. package/mcp/node_modules/iconv-lite/lib/bom-handling.js +0 -48
  225. package/mcp/node_modules/iconv-lite/lib/helpers/merge-exports.js +0 -13
  226. package/mcp/node_modules/iconv-lite/lib/index.d.ts +0 -41
  227. package/mcp/node_modules/iconv-lite/lib/index.js +0 -183
  228. package/mcp/node_modules/iconv-lite/lib/streams.js +0 -105
  229. package/mcp/node_modules/iconv-lite/package.json +0 -59
  230. package/mcp/node_modules/inherits/LICENSE +0 -16
  231. package/mcp/node_modules/inherits/README.md +0 -42
  232. package/mcp/node_modules/inherits/inherits.js +0 -9
  233. package/mcp/node_modules/inherits/inherits_browser.js +0 -27
  234. package/mcp/node_modules/inherits/package.json +0 -29
  235. package/mcp/node_modules/raw-body/HISTORY.md +0 -333
  236. package/mcp/node_modules/raw-body/LICENSE +0 -22
  237. package/mcp/node_modules/raw-body/README.md +0 -223
  238. package/mcp/node_modules/raw-body/SECURITY.md +0 -24
  239. package/mcp/node_modules/raw-body/index.d.ts +0 -85
  240. package/mcp/node_modules/raw-body/index.js +0 -336
  241. package/mcp/node_modules/raw-body/package.json +0 -50
  242. package/mcp/node_modules/safer-buffer/LICENSE +0 -21
  243. package/mcp/node_modules/safer-buffer/Porting-Buffer.md +0 -268
  244. package/mcp/node_modules/safer-buffer/Readme.md +0 -156
  245. package/mcp/node_modules/safer-buffer/dangerous.js +0 -58
  246. package/mcp/node_modules/safer-buffer/package.json +0 -34
  247. package/mcp/node_modules/safer-buffer/safer.js +0 -77
  248. package/mcp/node_modules/safer-buffer/tests.js +0 -406
  249. package/mcp/node_modules/setprototypeof/LICENSE +0 -13
  250. package/mcp/node_modules/setprototypeof/README.md +0 -31
  251. package/mcp/node_modules/setprototypeof/index.d.ts +0 -2
  252. package/mcp/node_modules/setprototypeof/index.js +0 -17
  253. package/mcp/node_modules/setprototypeof/package.json +0 -38
  254. package/mcp/node_modules/setprototypeof/test/index.js +0 -24
  255. package/mcp/node_modules/statuses/HISTORY.md +0 -82
  256. package/mcp/node_modules/statuses/LICENSE +0 -23
  257. package/mcp/node_modules/statuses/README.md +0 -136
  258. package/mcp/node_modules/statuses/codes.json +0 -65
  259. package/mcp/node_modules/statuses/index.js +0 -146
  260. package/mcp/node_modules/statuses/package.json +0 -49
  261. package/mcp/node_modules/toidentifier/HISTORY.md +0 -9
  262. package/mcp/node_modules/toidentifier/LICENSE +0 -21
  263. package/mcp/node_modules/toidentifier/README.md +0 -61
  264. package/mcp/node_modules/toidentifier/index.js +0 -32
  265. package/mcp/node_modules/toidentifier/package.json +0 -38
  266. package/mcp/node_modules/unpipe/HISTORY.md +0 -4
  267. package/mcp/node_modules/unpipe/LICENSE +0 -22
  268. package/mcp/node_modules/unpipe/README.md +0 -43
  269. package/mcp/node_modules/unpipe/index.js +0 -69
  270. package/mcp/node_modules/unpipe/package.json +0 -27
  271. package/mcp/node_modules/zod/LICENSE +0 -21
  272. package/mcp/node_modules/zod/README.md +0 -208
  273. package/mcp/node_modules/zod/index.cjs +0 -33
  274. package/mcp/node_modules/zod/index.d.cts +0 -4
  275. package/mcp/node_modules/zod/index.d.ts +0 -4
  276. package/mcp/node_modules/zod/index.js +0 -4
  277. package/mcp/node_modules/zod/package.json +0 -118
  278. package/mcp/node_modules/zod/src/index.ts +0 -4
  279. package/mcp/node_modules/zod/src/v3/ZodError.ts +0 -330
  280. package/mcp/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  281. package/mcp/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  282. package/mcp/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  283. package/mcp/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  284. package/mcp/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  285. package/mcp/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  286. package/mcp/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  287. package/mcp/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  288. package/mcp/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  289. package/mcp/node_modules/zod/src/v3/errors.ts +0 -13
  290. package/mcp/node_modules/zod/src/v3/external.ts +0 -6
  291. package/mcp/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  292. package/mcp/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  293. package/mcp/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  294. package/mcp/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  295. package/mcp/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  296. package/mcp/node_modules/zod/src/v3/helpers/util.ts +0 -224
  297. package/mcp/node_modules/zod/src/v3/index.ts +0 -4
  298. package/mcp/node_modules/zod/src/v3/locales/en.ts +0 -124
  299. package/mcp/node_modules/zod/src/v3/standard-schema.ts +0 -113
  300. package/mcp/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  301. package/mcp/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  302. package/mcp/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  303. package/mcp/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  304. package/mcp/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  305. package/mcp/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  306. package/mcp/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  307. package/mcp/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  308. package/mcp/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  309. package/mcp/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  310. package/mcp/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  311. package/mcp/node_modules/zod/src/v3/tests/complex.test.ts +0 -56
  312. package/mcp/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  313. package/mcp/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  314. package/mcp/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  315. package/mcp/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  316. package/mcp/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  317. package/mcp/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  318. package/mcp/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  319. package/mcp/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  320. package/mcp/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  321. package/mcp/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  322. package/mcp/node_modules/zod/src/v3/tests/function.test.ts +0 -257
  323. package/mcp/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  324. package/mcp/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  325. package/mcp/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  326. package/mcp/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  327. package/mcp/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  328. package/mcp/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  329. package/mcp/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  330. package/mcp/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  331. package/mcp/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  332. package/mcp/node_modules/zod/src/v3/tests/nan.test.ts +0 -21
  333. package/mcp/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  334. package/mcp/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  335. package/mcp/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  336. package/mcp/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  337. package/mcp/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  338. package/mcp/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  339. package/mcp/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  340. package/mcp/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  341. package/mcp/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  342. package/mcp/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  343. package/mcp/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  344. package/mcp/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  345. package/mcp/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  346. package/mcp/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  347. package/mcp/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  348. package/mcp/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  349. package/mcp/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  350. package/mcp/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  351. package/mcp/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  352. package/mcp/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  353. package/mcp/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  354. package/mcp/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  355. package/mcp/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  356. package/mcp/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  357. package/mcp/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  358. package/mcp/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  359. package/mcp/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  360. package/mcp/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  361. package/mcp/node_modules/zod/src/v3/types.ts +0 -5136
  362. package/mcp/node_modules/zod/src/v4/classic/checks.ts +0 -30
  363. package/mcp/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  364. package/mcp/node_modules/zod/src/v4/classic/compat.ts +0 -66
  365. package/mcp/node_modules/zod/src/v4/classic/errors.ts +0 -75
  366. package/mcp/node_modules/zod/src/v4/classic/external.ts +0 -50
  367. package/mcp/node_modules/zod/src/v4/classic/index.ts +0 -5
  368. package/mcp/node_modules/zod/src/v4/classic/iso.ts +0 -90
  369. package/mcp/node_modules/zod/src/v4/classic/parse.ts +0 -33
  370. package/mcp/node_modules/zod/src/v4/classic/schemas.ts +0 -2054
  371. package/mcp/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  372. package/mcp/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  373. package/mcp/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  374. package/mcp/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  375. package/mcp/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  376. package/mcp/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  377. package/mcp/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  378. package/mcp/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -63
  379. package/mcp/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -252
  380. package/mcp/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  381. package/mcp/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  382. package/mcp/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -352
  383. package/mcp/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  384. package/mcp/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -31
  385. package/mcp/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -296
  386. package/mcp/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -313
  387. package/mcp/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  388. package/mcp/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -619
  389. package/mcp/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  390. package/mcp/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -527
  391. package/mcp/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  392. package/mcp/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -91
  393. package/mcp/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -175
  394. package/mcp/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -268
  395. package/mcp/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  396. package/mcp/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -829
  397. package/mcp/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -34
  398. package/mcp/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -171
  399. package/mcp/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -108
  400. package/mcp/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  401. package/mcp/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -92
  402. package/mcp/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -196
  403. package/mcp/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  404. package/mcp/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  405. package/mcp/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -86
  406. package/mcp/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  407. package/mcp/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -247
  408. package/mcp/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -563
  409. package/mcp/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -123
  410. package/mcp/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -147
  411. package/mcp/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -127
  412. package/mcp/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -81
  413. package/mcp/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -37
  414. package/mcp/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -298
  415. package/mcp/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  416. package/mcp/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  417. package/mcp/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  418. package/mcp/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  419. package/mcp/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -342
  420. package/mcp/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -356
  421. package/mcp/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -532
  422. package/mcp/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -204
  423. package/mcp/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -179
  424. package/mcp/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -57
  425. package/mcp/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -109
  426. package/mcp/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -881
  427. package/mcp/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -66
  428. package/mcp/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -758
  429. package/mcp/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2314
  430. package/mcp/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -250
  431. package/mcp/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -163
  432. package/mcp/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -94
  433. package/mcp/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  434. package/mcp/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  435. package/mcp/node_modules/zod/src/v4/core/api.ts +0 -1594
  436. package/mcp/node_modules/zod/src/v4/core/checks.ts +0 -1283
  437. package/mcp/node_modules/zod/src/v4/core/config.ts +0 -15
  438. package/mcp/node_modules/zod/src/v4/core/core.ts +0 -134
  439. package/mcp/node_modules/zod/src/v4/core/doc.ts +0 -44
  440. package/mcp/node_modules/zod/src/v4/core/errors.ts +0 -424
  441. package/mcp/node_modules/zod/src/v4/core/function.ts +0 -176
  442. package/mcp/node_modules/zod/src/v4/core/index.ts +0 -15
  443. package/mcp/node_modules/zod/src/v4/core/json-schema.ts +0 -143
  444. package/mcp/node_modules/zod/src/v4/core/parse.ts +0 -94
  445. package/mcp/node_modules/zod/src/v4/core/regexes.ts +0 -135
  446. package/mcp/node_modules/zod/src/v4/core/registries.ts +0 -96
  447. package/mcp/node_modules/zod/src/v4/core/schemas.ts +0 -3842
  448. package/mcp/node_modules/zod/src/v4/core/standard-schema.ts +0 -64
  449. package/mcp/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  450. package/mcp/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  451. package/mcp/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  452. package/mcp/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  453. package/mcp/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  454. package/mcp/node_modules/zod/src/v4/core/to-json-schema.ts +0 -977
  455. package/mcp/node_modules/zod/src/v4/core/util.ts +0 -775
  456. package/mcp/node_modules/zod/src/v4/core/versions.ts +0 -5
  457. package/mcp/node_modules/zod/src/v4/core/zsf.ts +0 -323
  458. package/mcp/node_modules/zod/src/v4/index.ts +0 -4
  459. package/mcp/node_modules/zod/src/v4/locales/ar.ts +0 -125
  460. package/mcp/node_modules/zod/src/v4/locales/az.ts +0 -121
  461. package/mcp/node_modules/zod/src/v4/locales/be.ts +0 -184
  462. package/mcp/node_modules/zod/src/v4/locales/ca.ts +0 -127
  463. package/mcp/node_modules/zod/src/v4/locales/cs.ts +0 -142
  464. package/mcp/node_modules/zod/src/v4/locales/de.ts +0 -124
  465. package/mcp/node_modules/zod/src/v4/locales/en.ts +0 -127
  466. package/mcp/node_modules/zod/src/v4/locales/eo.ts +0 -125
  467. package/mcp/node_modules/zod/src/v4/locales/es.ts +0 -125
  468. package/mcp/node_modules/zod/src/v4/locales/fa.ts +0 -134
  469. package/mcp/node_modules/zod/src/v4/locales/fi.ts +0 -131
  470. package/mcp/node_modules/zod/src/v4/locales/fr-CA.ts +0 -126
  471. package/mcp/node_modules/zod/src/v4/locales/fr.ts +0 -124
  472. package/mcp/node_modules/zod/src/v4/locales/he.ts +0 -125
  473. package/mcp/node_modules/zod/src/v4/locales/hu.ts +0 -126
  474. package/mcp/node_modules/zod/src/v4/locales/id.ts +0 -125
  475. package/mcp/node_modules/zod/src/v4/locales/index.ts +0 -39
  476. package/mcp/node_modules/zod/src/v4/locales/it.ts +0 -125
  477. package/mcp/node_modules/zod/src/v4/locales/ja.ts +0 -122
  478. package/mcp/node_modules/zod/src/v4/locales/kh.ts +0 -126
  479. package/mcp/node_modules/zod/src/v4/locales/ko.ts +0 -131
  480. package/mcp/node_modules/zod/src/v4/locales/mk.ts +0 -127
  481. package/mcp/node_modules/zod/src/v4/locales/ms.ts +0 -124
  482. package/mcp/node_modules/zod/src/v4/locales/nl.ts +0 -126
  483. package/mcp/node_modules/zod/src/v4/locales/no.ts +0 -124
  484. package/mcp/node_modules/zod/src/v4/locales/ota.ts +0 -125
  485. package/mcp/node_modules/zod/src/v4/locales/pl.ts +0 -126
  486. package/mcp/node_modules/zod/src/v4/locales/ps.ts +0 -133
  487. package/mcp/node_modules/zod/src/v4/locales/pt.ts +0 -123
  488. package/mcp/node_modules/zod/src/v4/locales/ru.ts +0 -184
  489. package/mcp/node_modules/zod/src/v4/locales/sl.ts +0 -126
  490. package/mcp/node_modules/zod/src/v4/locales/sv.ts +0 -127
  491. package/mcp/node_modules/zod/src/v4/locales/ta.ts +0 -125
  492. package/mcp/node_modules/zod/src/v4/locales/th.ts +0 -126
  493. package/mcp/node_modules/zod/src/v4/locales/tr.ts +0 -121
  494. package/mcp/node_modules/zod/src/v4/locales/ua.ts +0 -126
  495. package/mcp/node_modules/zod/src/v4/locales/ur.ts +0 -126
  496. package/mcp/node_modules/zod/src/v4/locales/vi.ts +0 -125
  497. package/mcp/node_modules/zod/src/v4/locales/zh-CN.ts +0 -123
  498. package/mcp/node_modules/zod/src/v4/locales/zh-TW.ts +0 -125
  499. package/mcp/node_modules/zod/src/v4/mini/checks.ts +0 -32
  500. package/mcp/node_modules/zod/src/v4/mini/coerce.ts +0 -22
  501. package/mcp/node_modules/zod/src/v4/mini/external.ts +0 -40
  502. package/mcp/node_modules/zod/src/v4/mini/index.ts +0 -3
  503. package/mcp/node_modules/zod/src/v4/mini/iso.ts +0 -62
  504. package/mcp/node_modules/zod/src/v4/mini/parse.ts +0 -1
  505. package/mcp/node_modules/zod/src/v4/mini/schemas.ts +0 -1579
  506. package/mcp/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  507. package/mcp/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -51
  508. package/mcp/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  509. package/mcp/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  510. package/mcp/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  511. package/mcp/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -43
  512. package/mcp/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -871
  513. package/mcp/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  514. package/mcp/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -185
  515. package/mcp/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  516. package/mcp/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  517. package/mcp/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -299
  518. package/mcp/node_modules/zod/src/v4-mini/index.ts +0 -1
  519. package/mcp/node_modules/zod/v3/ZodError.cjs +0 -138
  520. package/mcp/node_modules/zod/v3/ZodError.d.cts +0 -164
  521. package/mcp/node_modules/zod/v3/ZodError.d.ts +0 -164
  522. package/mcp/node_modules/zod/v3/ZodError.js +0 -133
  523. package/mcp/node_modules/zod/v3/errors.cjs +0 -17
  524. package/mcp/node_modules/zod/v3/errors.d.cts +0 -5
  525. package/mcp/node_modules/zod/v3/errors.d.ts +0 -5
  526. package/mcp/node_modules/zod/v3/errors.js +0 -9
  527. package/mcp/node_modules/zod/v3/external.cjs +0 -22
  528. package/mcp/node_modules/zod/v3/external.d.cts +0 -6
  529. package/mcp/node_modules/zod/v3/external.d.ts +0 -6
  530. package/mcp/node_modules/zod/v3/external.js +0 -6
  531. package/mcp/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  532. package/mcp/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  533. package/mcp/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  534. package/mcp/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  535. package/mcp/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  536. package/mcp/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  537. package/mcp/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  538. package/mcp/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  539. package/mcp/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  540. package/mcp/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  541. package/mcp/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  542. package/mcp/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  543. package/mcp/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  544. package/mcp/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  545. package/mcp/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  546. package/mcp/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  547. package/mcp/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  548. package/mcp/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  549. package/mcp/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  550. package/mcp/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  551. package/mcp/node_modules/zod/v3/helpers/util.cjs +0 -137
  552. package/mcp/node_modules/zod/v3/helpers/util.d.cts +0 -85
  553. package/mcp/node_modules/zod/v3/helpers/util.d.ts +0 -85
  554. package/mcp/node_modules/zod/v3/helpers/util.js +0 -133
  555. package/mcp/node_modules/zod/v3/index.cjs +0 -33
  556. package/mcp/node_modules/zod/v3/index.d.cts +0 -4
  557. package/mcp/node_modules/zod/v3/index.d.ts +0 -4
  558. package/mcp/node_modules/zod/v3/index.js +0 -4
  559. package/mcp/node_modules/zod/v3/locales/en.cjs +0 -111
  560. package/mcp/node_modules/zod/v3/locales/en.d.cts +0 -3
  561. package/mcp/node_modules/zod/v3/locales/en.d.ts +0 -3
  562. package/mcp/node_modules/zod/v3/locales/en.js +0 -109
  563. package/mcp/node_modules/zod/v3/standard-schema.cjs +0 -2
  564. package/mcp/node_modules/zod/v3/standard-schema.d.cts +0 -102
  565. package/mcp/node_modules/zod/v3/standard-schema.d.ts +0 -102
  566. package/mcp/node_modules/zod/v3/standard-schema.js +0 -1
  567. package/mcp/node_modules/zod/v3/types.cjs +0 -3775
  568. package/mcp/node_modules/zod/v3/types.d.cts +0 -1031
  569. package/mcp/node_modules/zod/v3/types.d.ts +0 -1031
  570. package/mcp/node_modules/zod/v3/types.js +0 -3693
  571. package/mcp/node_modules/zod/v4/classic/checks.cjs +0 -32
  572. package/mcp/node_modules/zod/v4/classic/checks.d.cts +0 -1
  573. package/mcp/node_modules/zod/v4/classic/checks.d.ts +0 -1
  574. package/mcp/node_modules/zod/v4/classic/checks.js +0 -1
  575. package/mcp/node_modules/zod/v4/classic/coerce.cjs +0 -47
  576. package/mcp/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  577. package/mcp/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  578. package/mcp/node_modules/zod/v4/classic/coerce.js +0 -17
  579. package/mcp/node_modules/zod/v4/classic/compat.cjs +0 -57
  580. package/mcp/node_modules/zod/v4/classic/compat.d.cts +0 -46
  581. package/mcp/node_modules/zod/v4/classic/compat.d.ts +0 -46
  582. package/mcp/node_modules/zod/v4/classic/compat.js +0 -27
  583. package/mcp/node_modules/zod/v4/classic/errors.cjs +0 -67
  584. package/mcp/node_modules/zod/v4/classic/errors.d.cts +0 -30
  585. package/mcp/node_modules/zod/v4/classic/errors.d.ts +0 -30
  586. package/mcp/node_modules/zod/v4/classic/errors.js +0 -41
  587. package/mcp/node_modules/zod/v4/classic/external.cjs +0 -70
  588. package/mcp/node_modules/zod/v4/classic/external.d.cts +0 -13
  589. package/mcp/node_modules/zod/v4/classic/external.d.ts +0 -13
  590. package/mcp/node_modules/zod/v4/classic/external.js +0 -18
  591. package/mcp/node_modules/zod/v4/classic/index.cjs +0 -33
  592. package/mcp/node_modules/zod/v4/classic/index.d.cts +0 -4
  593. package/mcp/node_modules/zod/v4/classic/index.d.ts +0 -4
  594. package/mcp/node_modules/zod/v4/classic/index.js +0 -4
  595. package/mcp/node_modules/zod/v4/classic/iso.cjs +0 -60
  596. package/mcp/node_modules/zod/v4/classic/iso.d.cts +0 -22
  597. package/mcp/node_modules/zod/v4/classic/iso.d.ts +0 -22
  598. package/mcp/node_modules/zod/v4/classic/iso.js +0 -30
  599. package/mcp/node_modules/zod/v4/classic/parse.cjs +0 -32
  600. package/mcp/node_modules/zod/v4/classic/parse.d.cts +0 -23
  601. package/mcp/node_modules/zod/v4/classic/parse.d.ts +0 -23
  602. package/mcp/node_modules/zod/v4/classic/parse.js +0 -6
  603. package/mcp/node_modules/zod/v4/classic/schemas.cjs +0 -1109
  604. package/mcp/node_modules/zod/v4/classic/schemas.d.cts +0 -630
  605. package/mcp/node_modules/zod/v4/classic/schemas.d.ts +0 -630
  606. package/mcp/node_modules/zod/v4/classic/schemas.js +0 -1006
  607. package/mcp/node_modules/zod/v4/core/api.cjs +0 -1039
  608. package/mcp/node_modules/zod/v4/core/api.d.cts +0 -284
  609. package/mcp/node_modules/zod/v4/core/api.d.ts +0 -284
  610. package/mcp/node_modules/zod/v4/core/api.js +0 -906
  611. package/mcp/node_modules/zod/v4/core/checks.cjs +0 -591
  612. package/mcp/node_modules/zod/v4/core/checks.d.cts +0 -278
  613. package/mcp/node_modules/zod/v4/core/checks.d.ts +0 -278
  614. package/mcp/node_modules/zod/v4/core/checks.js +0 -565
  615. package/mcp/node_modules/zod/v4/core/core.cjs +0 -67
  616. package/mcp/node_modules/zod/v4/core/core.d.cts +0 -49
  617. package/mcp/node_modules/zod/v4/core/core.d.ts +0 -49
  618. package/mcp/node_modules/zod/v4/core/core.js +0 -61
  619. package/mcp/node_modules/zod/v4/core/doc.cjs +0 -39
  620. package/mcp/node_modules/zod/v4/core/doc.d.cts +0 -14
  621. package/mcp/node_modules/zod/v4/core/doc.d.ts +0 -14
  622. package/mcp/node_modules/zod/v4/core/doc.js +0 -35
  623. package/mcp/node_modules/zod/v4/core/errors.cjs +0 -226
  624. package/mcp/node_modules/zod/v4/core/errors.d.cts +0 -208
  625. package/mcp/node_modules/zod/v4/core/errors.d.ts +0 -208
  626. package/mcp/node_modules/zod/v4/core/errors.js +0 -195
  627. package/mcp/node_modules/zod/v4/core/function.cjs +0 -102
  628. package/mcp/node_modules/zod/v4/core/function.d.cts +0 -52
  629. package/mcp/node_modules/zod/v4/core/function.d.ts +0 -52
  630. package/mcp/node_modules/zod/v4/core/function.js +0 -75
  631. package/mcp/node_modules/zod/v4/core/index.cjs +0 -44
  632. package/mcp/node_modules/zod/v4/core/index.d.cts +0 -15
  633. package/mcp/node_modules/zod/v4/core/index.d.ts +0 -15
  634. package/mcp/node_modules/zod/v4/core/index.js +0 -15
  635. package/mcp/node_modules/zod/v4/core/json-schema.cjs +0 -2
  636. package/mcp/node_modules/zod/v4/core/json-schema.d.cts +0 -87
  637. package/mcp/node_modules/zod/v4/core/json-schema.d.ts +0 -87
  638. package/mcp/node_modules/zod/v4/core/json-schema.js +0 -1
  639. package/mcp/node_modules/zod/v4/core/parse.cjs +0 -87
  640. package/mcp/node_modules/zod/v4/core/parse.d.cts +0 -25
  641. package/mcp/node_modules/zod/v4/core/parse.d.ts +0 -25
  642. package/mcp/node_modules/zod/v4/core/parse.js +0 -57
  643. package/mcp/node_modules/zod/v4/core/regexes.cjs +0 -103
  644. package/mcp/node_modules/zod/v4/core/regexes.d.cts +0 -62
  645. package/mcp/node_modules/zod/v4/core/regexes.d.ts +0 -62
  646. package/mcp/node_modules/zod/v4/core/regexes.js +0 -95
  647. package/mcp/node_modules/zod/v4/core/registries.cjs +0 -56
  648. package/mcp/node_modules/zod/v4/core/registries.d.cts +0 -35
  649. package/mcp/node_modules/zod/v4/core/registries.d.ts +0 -35
  650. package/mcp/node_modules/zod/v4/core/registries.js +0 -51
  651. package/mcp/node_modules/zod/v4/core/schemas.cjs +0 -1748
  652. package/mcp/node_modules/zod/v4/core/schemas.d.cts +0 -1041
  653. package/mcp/node_modules/zod/v4/core/schemas.d.ts +0 -1041
  654. package/mcp/node_modules/zod/v4/core/schemas.js +0 -1717
  655. package/mcp/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  656. package/mcp/node_modules/zod/v4/core/standard-schema.d.cts +0 -55
  657. package/mcp/node_modules/zod/v4/core/standard-schema.d.ts +0 -55
  658. package/mcp/node_modules/zod/v4/core/standard-schema.js +0 -1
  659. package/mcp/node_modules/zod/v4/core/to-json-schema.cjs +0 -854
  660. package/mcp/node_modules/zod/v4/core/to-json-schema.d.cts +0 -88
  661. package/mcp/node_modules/zod/v4/core/to-json-schema.d.ts +0 -88
  662. package/mcp/node_modules/zod/v4/core/to-json-schema.js +0 -849
  663. package/mcp/node_modules/zod/v4/core/util.cjs +0 -539
  664. package/mcp/node_modules/zod/v4/core/util.d.cts +0 -183
  665. package/mcp/node_modules/zod/v4/core/util.d.ts +0 -183
  666. package/mcp/node_modules/zod/v4/core/util.js +0 -493
  667. package/mcp/node_modules/zod/v4/core/versions.cjs +0 -8
  668. package/mcp/node_modules/zod/v4/core/versions.d.cts +0 -5
  669. package/mcp/node_modules/zod/v4/core/versions.d.ts +0 -5
  670. package/mcp/node_modules/zod/v4/core/versions.js +0 -5
  671. package/mcp/node_modules/zod/v4/index.cjs +0 -22
  672. package/mcp/node_modules/zod/v4/index.d.cts +0 -3
  673. package/mcp/node_modules/zod/v4/index.d.ts +0 -3
  674. package/mcp/node_modules/zod/v4/index.js +0 -3
  675. package/mcp/node_modules/zod/v4/locales/ar.cjs +0 -142
  676. package/mcp/node_modules/zod/v4/locales/ar.d.cts +0 -4
  677. package/mcp/node_modules/zod/v4/locales/ar.d.ts +0 -4
  678. package/mcp/node_modules/zod/v4/locales/ar.js +0 -116
  679. package/mcp/node_modules/zod/v4/locales/az.cjs +0 -141
  680. package/mcp/node_modules/zod/v4/locales/az.d.cts +0 -4
  681. package/mcp/node_modules/zod/v4/locales/az.d.ts +0 -4
  682. package/mcp/node_modules/zod/v4/locales/az.js +0 -115
  683. package/mcp/node_modules/zod/v4/locales/be.cjs +0 -190
  684. package/mcp/node_modules/zod/v4/locales/be.d.cts +0 -4
  685. package/mcp/node_modules/zod/v4/locales/be.d.ts +0 -4
  686. package/mcp/node_modules/zod/v4/locales/be.js +0 -164
  687. package/mcp/node_modules/zod/v4/locales/ca.cjs +0 -144
  688. package/mcp/node_modules/zod/v4/locales/ca.d.cts +0 -4
  689. package/mcp/node_modules/zod/v4/locales/ca.d.ts +0 -4
  690. package/mcp/node_modules/zod/v4/locales/ca.js +0 -118
  691. package/mcp/node_modules/zod/v4/locales/cs.cjs +0 -161
  692. package/mcp/node_modules/zod/v4/locales/cs.d.cts +0 -4
  693. package/mcp/node_modules/zod/v4/locales/cs.d.ts +0 -4
  694. package/mcp/node_modules/zod/v4/locales/cs.js +0 -135
  695. package/mcp/node_modules/zod/v4/locales/de.cjs +0 -142
  696. package/mcp/node_modules/zod/v4/locales/de.d.cts +0 -4
  697. package/mcp/node_modules/zod/v4/locales/de.d.ts +0 -4
  698. package/mcp/node_modules/zod/v4/locales/de.js +0 -116
  699. package/mcp/node_modules/zod/v4/locales/en.cjs +0 -145
  700. package/mcp/node_modules/zod/v4/locales/en.d.cts +0 -5
  701. package/mcp/node_modules/zod/v4/locales/en.d.ts +0 -5
  702. package/mcp/node_modules/zod/v4/locales/en.js +0 -117
  703. package/mcp/node_modules/zod/v4/locales/eo.cjs +0 -144
  704. package/mcp/node_modules/zod/v4/locales/eo.d.cts +0 -5
  705. package/mcp/node_modules/zod/v4/locales/eo.d.ts +0 -5
  706. package/mcp/node_modules/zod/v4/locales/eo.js +0 -116
  707. package/mcp/node_modules/zod/v4/locales/es.cjs +0 -143
  708. package/mcp/node_modules/zod/v4/locales/es.d.cts +0 -4
  709. package/mcp/node_modules/zod/v4/locales/es.d.ts +0 -4
  710. package/mcp/node_modules/zod/v4/locales/es.js +0 -117
  711. package/mcp/node_modules/zod/v4/locales/fa.cjs +0 -148
  712. package/mcp/node_modules/zod/v4/locales/fa.d.cts +0 -4
  713. package/mcp/node_modules/zod/v4/locales/fa.d.ts +0 -4
  714. package/mcp/node_modules/zod/v4/locales/fa.js +0 -122
  715. package/mcp/node_modules/zod/v4/locales/fi.cjs +0 -148
  716. package/mcp/node_modules/zod/v4/locales/fi.d.cts +0 -4
  717. package/mcp/node_modules/zod/v4/locales/fi.d.ts +0 -4
  718. package/mcp/node_modules/zod/v4/locales/fi.js +0 -122
  719. package/mcp/node_modules/zod/v4/locales/fr-CA.cjs +0 -143
  720. package/mcp/node_modules/zod/v4/locales/fr-CA.d.cts +0 -4
  721. package/mcp/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  722. package/mcp/node_modules/zod/v4/locales/fr-CA.js +0 -117
  723. package/mcp/node_modules/zod/v4/locales/fr.cjs +0 -142
  724. package/mcp/node_modules/zod/v4/locales/fr.d.cts +0 -4
  725. package/mcp/node_modules/zod/v4/locales/fr.d.ts +0 -4
  726. package/mcp/node_modules/zod/v4/locales/fr.js +0 -116
  727. package/mcp/node_modules/zod/v4/locales/he.cjs +0 -143
  728. package/mcp/node_modules/zod/v4/locales/he.d.cts +0 -4
  729. package/mcp/node_modules/zod/v4/locales/he.d.ts +0 -4
  730. package/mcp/node_modules/zod/v4/locales/he.js +0 -117
  731. package/mcp/node_modules/zod/v4/locales/hu.cjs +0 -143
  732. package/mcp/node_modules/zod/v4/locales/hu.d.cts +0 -4
  733. package/mcp/node_modules/zod/v4/locales/hu.d.ts +0 -4
  734. package/mcp/node_modules/zod/v4/locales/hu.js +0 -117
  735. package/mcp/node_modules/zod/v4/locales/id.cjs +0 -142
  736. package/mcp/node_modules/zod/v4/locales/id.d.cts +0 -4
  737. package/mcp/node_modules/zod/v4/locales/id.d.ts +0 -4
  738. package/mcp/node_modules/zod/v4/locales/id.js +0 -116
  739. package/mcp/node_modules/zod/v4/locales/index.cjs +0 -84
  740. package/mcp/node_modules/zod/v4/locales/index.d.cts +0 -39
  741. package/mcp/node_modules/zod/v4/locales/index.d.ts +0 -39
  742. package/mcp/node_modules/zod/v4/locales/index.js +0 -39
  743. package/mcp/node_modules/zod/v4/locales/it.cjs +0 -143
  744. package/mcp/node_modules/zod/v4/locales/it.d.cts +0 -4
  745. package/mcp/node_modules/zod/v4/locales/it.d.ts +0 -4
  746. package/mcp/node_modules/zod/v4/locales/it.js +0 -117
  747. package/mcp/node_modules/zod/v4/locales/ja.cjs +0 -141
  748. package/mcp/node_modules/zod/v4/locales/ja.d.cts +0 -4
  749. package/mcp/node_modules/zod/v4/locales/ja.d.ts +0 -4
  750. package/mcp/node_modules/zod/v4/locales/ja.js +0 -115
  751. package/mcp/node_modules/zod/v4/locales/kh.cjs +0 -143
  752. package/mcp/node_modules/zod/v4/locales/kh.d.cts +0 -4
  753. package/mcp/node_modules/zod/v4/locales/kh.d.ts +0 -4
  754. package/mcp/node_modules/zod/v4/locales/kh.js +0 -117
  755. package/mcp/node_modules/zod/v4/locales/ko.cjs +0 -147
  756. package/mcp/node_modules/zod/v4/locales/ko.d.cts +0 -4
  757. package/mcp/node_modules/zod/v4/locales/ko.d.ts +0 -4
  758. package/mcp/node_modules/zod/v4/locales/ko.js +0 -121
  759. package/mcp/node_modules/zod/v4/locales/mk.cjs +0 -144
  760. package/mcp/node_modules/zod/v4/locales/mk.d.cts +0 -4
  761. package/mcp/node_modules/zod/v4/locales/mk.d.ts +0 -4
  762. package/mcp/node_modules/zod/v4/locales/mk.js +0 -118
  763. package/mcp/node_modules/zod/v4/locales/ms.cjs +0 -142
  764. package/mcp/node_modules/zod/v4/locales/ms.d.cts +0 -4
  765. package/mcp/node_modules/zod/v4/locales/ms.d.ts +0 -4
  766. package/mcp/node_modules/zod/v4/locales/ms.js +0 -116
  767. package/mcp/node_modules/zod/v4/locales/nl.cjs +0 -143
  768. package/mcp/node_modules/zod/v4/locales/nl.d.cts +0 -4
  769. package/mcp/node_modules/zod/v4/locales/nl.d.ts +0 -4
  770. package/mcp/node_modules/zod/v4/locales/nl.js +0 -117
  771. package/mcp/node_modules/zod/v4/locales/no.cjs +0 -142
  772. package/mcp/node_modules/zod/v4/locales/no.d.cts +0 -4
  773. package/mcp/node_modules/zod/v4/locales/no.d.ts +0 -4
  774. package/mcp/node_modules/zod/v4/locales/no.js +0 -116
  775. package/mcp/node_modules/zod/v4/locales/ota.cjs +0 -143
  776. package/mcp/node_modules/zod/v4/locales/ota.d.cts +0 -4
  777. package/mcp/node_modules/zod/v4/locales/ota.d.ts +0 -4
  778. package/mcp/node_modules/zod/v4/locales/ota.js +0 -117
  779. package/mcp/node_modules/zod/v4/locales/pl.cjs +0 -143
  780. package/mcp/node_modules/zod/v4/locales/pl.d.cts +0 -4
  781. package/mcp/node_modules/zod/v4/locales/pl.d.ts +0 -4
  782. package/mcp/node_modules/zod/v4/locales/pl.js +0 -117
  783. package/mcp/node_modules/zod/v4/locales/ps.cjs +0 -148
  784. package/mcp/node_modules/zod/v4/locales/ps.d.cts +0 -4
  785. package/mcp/node_modules/zod/v4/locales/ps.d.ts +0 -4
  786. package/mcp/node_modules/zod/v4/locales/ps.js +0 -122
  787. package/mcp/node_modules/zod/v4/locales/pt.cjs +0 -142
  788. package/mcp/node_modules/zod/v4/locales/pt.d.cts +0 -4
  789. package/mcp/node_modules/zod/v4/locales/pt.d.ts +0 -4
  790. package/mcp/node_modules/zod/v4/locales/pt.js +0 -116
  791. package/mcp/node_modules/zod/v4/locales/ru.cjs +0 -190
  792. package/mcp/node_modules/zod/v4/locales/ru.d.cts +0 -4
  793. package/mcp/node_modules/zod/v4/locales/ru.d.ts +0 -4
  794. package/mcp/node_modules/zod/v4/locales/ru.js +0 -164
  795. package/mcp/node_modules/zod/v4/locales/sl.cjs +0 -143
  796. package/mcp/node_modules/zod/v4/locales/sl.d.cts +0 -4
  797. package/mcp/node_modules/zod/v4/locales/sl.d.ts +0 -4
  798. package/mcp/node_modules/zod/v4/locales/sl.js +0 -117
  799. package/mcp/node_modules/zod/v4/locales/sv.cjs +0 -144
  800. package/mcp/node_modules/zod/v4/locales/sv.d.cts +0 -4
  801. package/mcp/node_modules/zod/v4/locales/sv.d.ts +0 -4
  802. package/mcp/node_modules/zod/v4/locales/sv.js +0 -118
  803. package/mcp/node_modules/zod/v4/locales/ta.cjs +0 -143
  804. package/mcp/node_modules/zod/v4/locales/ta.d.cts +0 -4
  805. package/mcp/node_modules/zod/v4/locales/ta.d.ts +0 -4
  806. package/mcp/node_modules/zod/v4/locales/ta.js +0 -117
  807. package/mcp/node_modules/zod/v4/locales/th.cjs +0 -143
  808. package/mcp/node_modules/zod/v4/locales/th.d.cts +0 -4
  809. package/mcp/node_modules/zod/v4/locales/th.d.ts +0 -4
  810. package/mcp/node_modules/zod/v4/locales/th.js +0 -117
  811. package/mcp/node_modules/zod/v4/locales/tr.cjs +0 -143
  812. package/mcp/node_modules/zod/v4/locales/tr.d.cts +0 -5
  813. package/mcp/node_modules/zod/v4/locales/tr.d.ts +0 -5
  814. package/mcp/node_modules/zod/v4/locales/tr.js +0 -115
  815. package/mcp/node_modules/zod/v4/locales/ua.cjs +0 -143
  816. package/mcp/node_modules/zod/v4/locales/ua.d.cts +0 -4
  817. package/mcp/node_modules/zod/v4/locales/ua.d.ts +0 -4
  818. package/mcp/node_modules/zod/v4/locales/ua.js +0 -117
  819. package/mcp/node_modules/zod/v4/locales/ur.cjs +0 -143
  820. package/mcp/node_modules/zod/v4/locales/ur.d.cts +0 -4
  821. package/mcp/node_modules/zod/v4/locales/ur.d.ts +0 -4
  822. package/mcp/node_modules/zod/v4/locales/ur.js +0 -117
  823. package/mcp/node_modules/zod/v4/locales/vi.cjs +0 -142
  824. package/mcp/node_modules/zod/v4/locales/vi.d.cts +0 -4
  825. package/mcp/node_modules/zod/v4/locales/vi.d.ts +0 -4
  826. package/mcp/node_modules/zod/v4/locales/vi.js +0 -116
  827. package/mcp/node_modules/zod/v4/locales/zh-CN.cjs +0 -142
  828. package/mcp/node_modules/zod/v4/locales/zh-CN.d.cts +0 -4
  829. package/mcp/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  830. package/mcp/node_modules/zod/v4/locales/zh-CN.js +0 -116
  831. package/mcp/node_modules/zod/v4/locales/zh-TW.cjs +0 -143
  832. package/mcp/node_modules/zod/v4/locales/zh-TW.d.cts +0 -4
  833. package/mcp/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  834. package/mcp/node_modules/zod/v4/locales/zh-TW.js +0 -117
  835. package/mcp/node_modules/zod/v4/mini/checks.cjs +0 -34
  836. package/mcp/node_modules/zod/v4/mini/checks.d.cts +0 -1
  837. package/mcp/node_modules/zod/v4/mini/checks.d.ts +0 -1
  838. package/mcp/node_modules/zod/v4/mini/checks.js +0 -1
  839. package/mcp/node_modules/zod/v4/mini/coerce.cjs +0 -47
  840. package/mcp/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  841. package/mcp/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  842. package/mcp/node_modules/zod/v4/mini/coerce.js +0 -17
  843. package/mcp/node_modules/zod/v4/mini/external.cjs +0 -62
  844. package/mcp/node_modules/zod/v4/mini/external.d.cts +0 -11
  845. package/mcp/node_modules/zod/v4/mini/external.d.ts +0 -11
  846. package/mcp/node_modules/zod/v4/mini/external.js +0 -13
  847. package/mcp/node_modules/zod/v4/mini/index.cjs +0 -32
  848. package/mcp/node_modules/zod/v4/mini/index.d.cts +0 -3
  849. package/mcp/node_modules/zod/v4/mini/index.d.ts +0 -3
  850. package/mcp/node_modules/zod/v4/mini/index.js +0 -3
  851. package/mcp/node_modules/zod/v4/mini/iso.cjs +0 -60
  852. package/mcp/node_modules/zod/v4/mini/iso.d.cts +0 -22
  853. package/mcp/node_modules/zod/v4/mini/iso.d.ts +0 -22
  854. package/mcp/node_modules/zod/v4/mini/iso.js +0 -30
  855. package/mcp/node_modules/zod/v4/mini/parse.cjs +0 -8
  856. package/mcp/node_modules/zod/v4/mini/parse.d.cts +0 -1
  857. package/mcp/node_modules/zod/v4/mini/parse.d.ts +0 -1
  858. package/mcp/node_modules/zod/v4/mini/parse.js +0 -1
  859. package/mcp/node_modules/zod/v4/mini/schemas.cjs +0 -839
  860. package/mcp/node_modules/zod/v4/mini/schemas.d.cts +0 -356
  861. package/mcp/node_modules/zod/v4/mini/schemas.d.ts +0 -356
  862. package/mcp/node_modules/zod/v4/mini/schemas.js +0 -732
  863. package/mcp/node_modules/zod/v4-mini/index.cjs +0 -17
  864. package/mcp/node_modules/zod/v4-mini/index.d.cts +0 -1
  865. package/mcp/node_modules/zod/v4-mini/index.d.ts +0 -1
  866. package/mcp/node_modules/zod/v4-mini/index.js +0 -1
  867. package/mcp/src/__pycache__/server.cpython-312.pyc +0 -0
  868. package/mcp/src/__pycache__/server_core.cpython-312.pyc +0 -0
  869. package/mcp/test/__pycache__/test_server.cpython-312-pytest-8.4.1.pyc +0 -0
  870. package/mcp/test/__pycache__/test_server.cpython-312.pyc +0 -0
  871. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/.package-lock.json +0 -113
  872. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/colour/LICENSE.md +0 -82
  873. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/colour/README.md +0 -15
  874. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/colour/color.cjs +0 -1594
  875. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/colour/index.cjs +0 -1
  876. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/colour/package.json +0 -45
  877. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-darwin-arm64/LICENSE +0 -191
  878. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-darwin-arm64/README.md +0 -18
  879. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
  880. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-darwin-arm64/package.json +0 -40
  881. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-libvips-darwin-arm64/README.md +0 -46
  882. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-libvips-darwin-arm64/lib/glib-2.0/include/glibconfig.h +0 -220
  883. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-libvips-darwin-arm64/lib/index.js +0 -1
  884. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib +0 -0
  885. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-libvips-darwin-arm64/package.json +0 -36
  886. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +0 -30
  887. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/LICENSE +0 -201
  888. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/README.md +0 -163
  889. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/index.d.ts +0 -14
  890. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/lib/detect-libc.js +0 -313
  891. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/lib/elf.js +0 -39
  892. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/lib/filesystem.js +0 -51
  893. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/lib/process.js +0 -24
  894. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/detect-libc/package.json +0 -44
  895. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/LICENSE +0 -15
  896. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/README.md +0 -664
  897. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/bin/semver.js +0 -191
  898. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/classes/comparator.js +0 -143
  899. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/classes/index.js +0 -7
  900. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/classes/range.js +0 -557
  901. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/classes/semver.js +0 -333
  902. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/clean.js +0 -8
  903. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/cmp.js +0 -54
  904. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/coerce.js +0 -62
  905. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/compare-build.js +0 -9
  906. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/compare-loose.js +0 -5
  907. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/compare.js +0 -7
  908. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/diff.js +0 -60
  909. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/eq.js +0 -5
  910. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/gt.js +0 -5
  911. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/gte.js +0 -5
  912. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/inc.js +0 -21
  913. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/lt.js +0 -5
  914. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/lte.js +0 -5
  915. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/major.js +0 -5
  916. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/minor.js +0 -5
  917. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/neq.js +0 -5
  918. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/parse.js +0 -18
  919. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/patch.js +0 -5
  920. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/prerelease.js +0 -8
  921. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/rcompare.js +0 -5
  922. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/rsort.js +0 -5
  923. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/satisfies.js +0 -12
  924. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/sort.js +0 -5
  925. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/functions/valid.js +0 -8
  926. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/index.js +0 -91
  927. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/internal/constants.js +0 -37
  928. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/internal/debug.js +0 -11
  929. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/internal/identifiers.js +0 -29
  930. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/internal/lrucache.js +0 -42
  931. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/internal/parse-options.js +0 -17
  932. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/internal/re.js +0 -223
  933. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/package.json +0 -78
  934. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/preload.js +0 -4
  935. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/range.bnf +0 -16
  936. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/gtr.js +0 -6
  937. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/intersects.js +0 -9
  938. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/ltr.js +0 -6
  939. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/max-satisfying.js +0 -27
  940. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/min-satisfying.js +0 -26
  941. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/min-version.js +0 -63
  942. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/outside.js +0 -82
  943. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/simplify.js +0 -49
  944. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/subset.js +0 -249
  945. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/to-comparators.js +0 -10
  946. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/semver/ranges/valid.js +0 -13
  947. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/LICENSE +0 -191
  948. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/README.md +0 -118
  949. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/install/build.js +0 -38
  950. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/install/check.js +0 -14
  951. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/channel.js +0 -177
  952. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/colour.js +0 -195
  953. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/composite.js +0 -212
  954. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/constructor.js +0 -499
  955. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/index.d.ts +0 -1971
  956. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/index.js +0 -16
  957. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/input.js +0 -809
  958. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/is.js +0 -143
  959. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/libvips.js +0 -207
  960. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/operation.js +0 -1016
  961. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/output.js +0 -1666
  962. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/resize.js +0 -595
  963. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/sharp.js +0 -121
  964. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/lib/utility.js +0 -291
  965. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/package.json +0 -202
  966. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/binding.gyp +0 -298
  967. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/common.cc +0 -1130
  968. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/common.h +0 -402
  969. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/metadata.cc +0 -346
  970. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/metadata.h +0 -90
  971. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/operations.cc +0 -499
  972. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/operations.h +0 -137
  973. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/pipeline.cc +0 -1814
  974. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/pipeline.h +0 -408
  975. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/sharp.cc +0 -43
  976. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/stats.cc +0 -186
  977. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/stats.h +0 -62
  978. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/utilities.cc +0 -288
  979. package/skills/aipk_update-requirements-from-design/scripts/sharp-runtime/node_modules/sharp/src/utilities.h +0 -22
@@ -1,3775 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
4
- exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = void 0;
5
- exports.datetimeRegex = datetimeRegex;
6
- exports.custom = custom;
7
- const ZodError_js_1 = require("./ZodError.cjs");
8
- const errors_js_1 = require("./errors.cjs");
9
- const errorUtil_js_1 = require("./helpers/errorUtil.cjs");
10
- const parseUtil_js_1 = require("./helpers/parseUtil.cjs");
11
- const util_js_1 = require("./helpers/util.cjs");
12
- class ParseInputLazyPath {
13
- constructor(parent, value, path, key) {
14
- this._cachedPath = [];
15
- this.parent = parent;
16
- this.data = value;
17
- this._path = path;
18
- this._key = key;
19
- }
20
- get path() {
21
- if (!this._cachedPath.length) {
22
- if (Array.isArray(this._key)) {
23
- this._cachedPath.push(...this._path, ...this._key);
24
- }
25
- else {
26
- this._cachedPath.push(...this._path, this._key);
27
- }
28
- }
29
- return this._cachedPath;
30
- }
31
- }
32
- const handleResult = (ctx, result) => {
33
- if ((0, parseUtil_js_1.isValid)(result)) {
34
- return { success: true, data: result.value };
35
- }
36
- else {
37
- if (!ctx.common.issues.length) {
38
- throw new Error("Validation failed but no issues detected.");
39
- }
40
- return {
41
- success: false,
42
- get error() {
43
- if (this._error)
44
- return this._error;
45
- const error = new ZodError_js_1.ZodError(ctx.common.issues);
46
- this._error = error;
47
- return this._error;
48
- },
49
- };
50
- }
51
- };
52
- function processCreateParams(params) {
53
- if (!params)
54
- return {};
55
- const { errorMap, invalid_type_error, required_error, description } = params;
56
- if (errorMap && (invalid_type_error || required_error)) {
57
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
58
- }
59
- if (errorMap)
60
- return { errorMap: errorMap, description };
61
- const customMap = (iss, ctx) => {
62
- const { message } = params;
63
- if (iss.code === "invalid_enum_value") {
64
- return { message: message ?? ctx.defaultError };
65
- }
66
- if (typeof ctx.data === "undefined") {
67
- return { message: message ?? required_error ?? ctx.defaultError };
68
- }
69
- if (iss.code !== "invalid_type")
70
- return { message: ctx.defaultError };
71
- return { message: message ?? invalid_type_error ?? ctx.defaultError };
72
- };
73
- return { errorMap: customMap, description };
74
- }
75
- class ZodType {
76
- get description() {
77
- return this._def.description;
78
- }
79
- _getType(input) {
80
- return (0, util_js_1.getParsedType)(input.data);
81
- }
82
- _getOrReturnCtx(input, ctx) {
83
- return (ctx || {
84
- common: input.parent.common,
85
- data: input.data,
86
- parsedType: (0, util_js_1.getParsedType)(input.data),
87
- schemaErrorMap: this._def.errorMap,
88
- path: input.path,
89
- parent: input.parent,
90
- });
91
- }
92
- _processInputParams(input) {
93
- return {
94
- status: new parseUtil_js_1.ParseStatus(),
95
- ctx: {
96
- common: input.parent.common,
97
- data: input.data,
98
- parsedType: (0, util_js_1.getParsedType)(input.data),
99
- schemaErrorMap: this._def.errorMap,
100
- path: input.path,
101
- parent: input.parent,
102
- },
103
- };
104
- }
105
- _parseSync(input) {
106
- const result = this._parse(input);
107
- if ((0, parseUtil_js_1.isAsync)(result)) {
108
- throw new Error("Synchronous parse encountered promise.");
109
- }
110
- return result;
111
- }
112
- _parseAsync(input) {
113
- const result = this._parse(input);
114
- return Promise.resolve(result);
115
- }
116
- parse(data, params) {
117
- const result = this.safeParse(data, params);
118
- if (result.success)
119
- return result.data;
120
- throw result.error;
121
- }
122
- safeParse(data, params) {
123
- const ctx = {
124
- common: {
125
- issues: [],
126
- async: params?.async ?? false,
127
- contextualErrorMap: params?.errorMap,
128
- },
129
- path: params?.path || [],
130
- schemaErrorMap: this._def.errorMap,
131
- parent: null,
132
- data,
133
- parsedType: (0, util_js_1.getParsedType)(data),
134
- };
135
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
136
- return handleResult(ctx, result);
137
- }
138
- "~validate"(data) {
139
- const ctx = {
140
- common: {
141
- issues: [],
142
- async: !!this["~standard"].async,
143
- },
144
- path: [],
145
- schemaErrorMap: this._def.errorMap,
146
- parent: null,
147
- data,
148
- parsedType: (0, util_js_1.getParsedType)(data),
149
- };
150
- if (!this["~standard"].async) {
151
- try {
152
- const result = this._parseSync({ data, path: [], parent: ctx });
153
- return (0, parseUtil_js_1.isValid)(result)
154
- ? {
155
- value: result.value,
156
- }
157
- : {
158
- issues: ctx.common.issues,
159
- };
160
- }
161
- catch (err) {
162
- if (err?.message?.toLowerCase()?.includes("encountered")) {
163
- this["~standard"].async = true;
164
- }
165
- ctx.common = {
166
- issues: [],
167
- async: true,
168
- };
169
- }
170
- }
171
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_js_1.isValid)(result)
172
- ? {
173
- value: result.value,
174
- }
175
- : {
176
- issues: ctx.common.issues,
177
- });
178
- }
179
- async parseAsync(data, params) {
180
- const result = await this.safeParseAsync(data, params);
181
- if (result.success)
182
- return result.data;
183
- throw result.error;
184
- }
185
- async safeParseAsync(data, params) {
186
- const ctx = {
187
- common: {
188
- issues: [],
189
- contextualErrorMap: params?.errorMap,
190
- async: true,
191
- },
192
- path: params?.path || [],
193
- schemaErrorMap: this._def.errorMap,
194
- parent: null,
195
- data,
196
- parsedType: (0, util_js_1.getParsedType)(data),
197
- };
198
- const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
199
- const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
200
- return handleResult(ctx, result);
201
- }
202
- refine(check, message) {
203
- const getIssueProperties = (val) => {
204
- if (typeof message === "string" || typeof message === "undefined") {
205
- return { message };
206
- }
207
- else if (typeof message === "function") {
208
- return message(val);
209
- }
210
- else {
211
- return message;
212
- }
213
- };
214
- return this._refinement((val, ctx) => {
215
- const result = check(val);
216
- const setError = () => ctx.addIssue({
217
- code: ZodError_js_1.ZodIssueCode.custom,
218
- ...getIssueProperties(val),
219
- });
220
- if (typeof Promise !== "undefined" && result instanceof Promise) {
221
- return result.then((data) => {
222
- if (!data) {
223
- setError();
224
- return false;
225
- }
226
- else {
227
- return true;
228
- }
229
- });
230
- }
231
- if (!result) {
232
- setError();
233
- return false;
234
- }
235
- else {
236
- return true;
237
- }
238
- });
239
- }
240
- refinement(check, refinementData) {
241
- return this._refinement((val, ctx) => {
242
- if (!check(val)) {
243
- ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
244
- return false;
245
- }
246
- else {
247
- return true;
248
- }
249
- });
250
- }
251
- _refinement(refinement) {
252
- return new ZodEffects({
253
- schema: this,
254
- typeName: ZodFirstPartyTypeKind.ZodEffects,
255
- effect: { type: "refinement", refinement },
256
- });
257
- }
258
- superRefine(refinement) {
259
- return this._refinement(refinement);
260
- }
261
- constructor(def) {
262
- /** Alias of safeParseAsync */
263
- this.spa = this.safeParseAsync;
264
- this._def = def;
265
- this.parse = this.parse.bind(this);
266
- this.safeParse = this.safeParse.bind(this);
267
- this.parseAsync = this.parseAsync.bind(this);
268
- this.safeParseAsync = this.safeParseAsync.bind(this);
269
- this.spa = this.spa.bind(this);
270
- this.refine = this.refine.bind(this);
271
- this.refinement = this.refinement.bind(this);
272
- this.superRefine = this.superRefine.bind(this);
273
- this.optional = this.optional.bind(this);
274
- this.nullable = this.nullable.bind(this);
275
- this.nullish = this.nullish.bind(this);
276
- this.array = this.array.bind(this);
277
- this.promise = this.promise.bind(this);
278
- this.or = this.or.bind(this);
279
- this.and = this.and.bind(this);
280
- this.transform = this.transform.bind(this);
281
- this.brand = this.brand.bind(this);
282
- this.default = this.default.bind(this);
283
- this.catch = this.catch.bind(this);
284
- this.describe = this.describe.bind(this);
285
- this.pipe = this.pipe.bind(this);
286
- this.readonly = this.readonly.bind(this);
287
- this.isNullable = this.isNullable.bind(this);
288
- this.isOptional = this.isOptional.bind(this);
289
- this["~standard"] = {
290
- version: 1,
291
- vendor: "zod",
292
- validate: (data) => this["~validate"](data),
293
- };
294
- }
295
- optional() {
296
- return ZodOptional.create(this, this._def);
297
- }
298
- nullable() {
299
- return ZodNullable.create(this, this._def);
300
- }
301
- nullish() {
302
- return this.nullable().optional();
303
- }
304
- array() {
305
- return ZodArray.create(this);
306
- }
307
- promise() {
308
- return ZodPromise.create(this, this._def);
309
- }
310
- or(option) {
311
- return ZodUnion.create([this, option], this._def);
312
- }
313
- and(incoming) {
314
- return ZodIntersection.create(this, incoming, this._def);
315
- }
316
- transform(transform) {
317
- return new ZodEffects({
318
- ...processCreateParams(this._def),
319
- schema: this,
320
- typeName: ZodFirstPartyTypeKind.ZodEffects,
321
- effect: { type: "transform", transform },
322
- });
323
- }
324
- default(def) {
325
- const defaultValueFunc = typeof def === "function" ? def : () => def;
326
- return new ZodDefault({
327
- ...processCreateParams(this._def),
328
- innerType: this,
329
- defaultValue: defaultValueFunc,
330
- typeName: ZodFirstPartyTypeKind.ZodDefault,
331
- });
332
- }
333
- brand() {
334
- return new ZodBranded({
335
- typeName: ZodFirstPartyTypeKind.ZodBranded,
336
- type: this,
337
- ...processCreateParams(this._def),
338
- });
339
- }
340
- catch(def) {
341
- const catchValueFunc = typeof def === "function" ? def : () => def;
342
- return new ZodCatch({
343
- ...processCreateParams(this._def),
344
- innerType: this,
345
- catchValue: catchValueFunc,
346
- typeName: ZodFirstPartyTypeKind.ZodCatch,
347
- });
348
- }
349
- describe(description) {
350
- const This = this.constructor;
351
- return new This({
352
- ...this._def,
353
- description,
354
- });
355
- }
356
- pipe(target) {
357
- return ZodPipeline.create(this, target);
358
- }
359
- readonly() {
360
- return ZodReadonly.create(this);
361
- }
362
- isOptional() {
363
- return this.safeParse(undefined).success;
364
- }
365
- isNullable() {
366
- return this.safeParse(null).success;
367
- }
368
- }
369
- exports.ZodType = ZodType;
370
- exports.Schema = ZodType;
371
- exports.ZodSchema = ZodType;
372
- const cuidRegex = /^c[^\s-]{8,}$/i;
373
- const cuid2Regex = /^[0-9a-z]+$/;
374
- const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
375
- // const uuidRegex =
376
- // /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
377
- const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
378
- const nanoidRegex = /^[a-z0-9_-]{21}$/i;
379
- const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
380
- const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
381
- // from https://stackoverflow.com/a/46181/1550155
382
- // old version: too slow, didn't support unicode
383
- // const emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
384
- //old email regex
385
- // const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((?!-)([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{1,})[^-<>()[\].,;:\s@"]$/i;
386
- // eslint-disable-next-line
387
- // const emailRegex =
388
- // /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
389
- // const emailRegex =
390
- // /^[a-zA-Z0-9\.\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
391
- // const emailRegex =
392
- // /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
393
- const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
394
- // const emailRegex =
395
- // /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
396
- // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
397
- const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
398
- let emojiRegex;
399
- // faster, simpler, safer
400
- const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
401
- const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
402
- // const ipv6Regex =
403
- // /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
404
- const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
405
- const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
406
- // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
407
- const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
408
- // https://base64.guru/standards/base64url
409
- const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
410
- // simple
411
- // const dateRegexSource = `\\d{4}-\\d{2}-\\d{2}`;
412
- // no leap year validation
413
- // const dateRegexSource = `\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\d|2\\d))`;
414
- // with leap year validation
415
- const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
416
- const dateRegex = new RegExp(`^${dateRegexSource}$`);
417
- function timeRegexSource(args) {
418
- let secondsRegexSource = `[0-5]\\d`;
419
- if (args.precision) {
420
- secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
421
- }
422
- else if (args.precision == null) {
423
- secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
424
- }
425
- const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
426
- return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
427
- }
428
- function timeRegex(args) {
429
- return new RegExp(`^${timeRegexSource(args)}$`);
430
- }
431
- // Adapted from https://stackoverflow.com/a/3143231
432
- function datetimeRegex(args) {
433
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
434
- const opts = [];
435
- opts.push(args.local ? `Z?` : `Z`);
436
- if (args.offset)
437
- opts.push(`([+-]\\d{2}:?\\d{2})`);
438
- regex = `${regex}(${opts.join("|")})`;
439
- return new RegExp(`^${regex}$`);
440
- }
441
- function isValidIP(ip, version) {
442
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
443
- return true;
444
- }
445
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
446
- return true;
447
- }
448
- return false;
449
- }
450
- function isValidJWT(jwt, alg) {
451
- if (!jwtRegex.test(jwt))
452
- return false;
453
- try {
454
- const [header] = jwt.split(".");
455
- if (!header)
456
- return false;
457
- // Convert base64url to base64
458
- const base64 = header
459
- .replace(/-/g, "+")
460
- .replace(/_/g, "/")
461
- .padEnd(header.length + ((4 - (header.length % 4)) % 4), "=");
462
- const decoded = JSON.parse(atob(base64));
463
- if (typeof decoded !== "object" || decoded === null)
464
- return false;
465
- if ("typ" in decoded && decoded?.typ !== "JWT")
466
- return false;
467
- if (!decoded.alg)
468
- return false;
469
- if (alg && decoded.alg !== alg)
470
- return false;
471
- return true;
472
- }
473
- catch {
474
- return false;
475
- }
476
- }
477
- function isValidCidr(ip, version) {
478
- if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
479
- return true;
480
- }
481
- if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
482
- return true;
483
- }
484
- return false;
485
- }
486
- class ZodString extends ZodType {
487
- _parse(input) {
488
- if (this._def.coerce) {
489
- input.data = String(input.data);
490
- }
491
- const parsedType = this._getType(input);
492
- if (parsedType !== util_js_1.ZodParsedType.string) {
493
- const ctx = this._getOrReturnCtx(input);
494
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
495
- code: ZodError_js_1.ZodIssueCode.invalid_type,
496
- expected: util_js_1.ZodParsedType.string,
497
- received: ctx.parsedType,
498
- });
499
- return parseUtil_js_1.INVALID;
500
- }
501
- const status = new parseUtil_js_1.ParseStatus();
502
- let ctx = undefined;
503
- for (const check of this._def.checks) {
504
- if (check.kind === "min") {
505
- if (input.data.length < check.value) {
506
- ctx = this._getOrReturnCtx(input, ctx);
507
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
508
- code: ZodError_js_1.ZodIssueCode.too_small,
509
- minimum: check.value,
510
- type: "string",
511
- inclusive: true,
512
- exact: false,
513
- message: check.message,
514
- });
515
- status.dirty();
516
- }
517
- }
518
- else if (check.kind === "max") {
519
- if (input.data.length > check.value) {
520
- ctx = this._getOrReturnCtx(input, ctx);
521
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
522
- code: ZodError_js_1.ZodIssueCode.too_big,
523
- maximum: check.value,
524
- type: "string",
525
- inclusive: true,
526
- exact: false,
527
- message: check.message,
528
- });
529
- status.dirty();
530
- }
531
- }
532
- else if (check.kind === "length") {
533
- const tooBig = input.data.length > check.value;
534
- const tooSmall = input.data.length < check.value;
535
- if (tooBig || tooSmall) {
536
- ctx = this._getOrReturnCtx(input, ctx);
537
- if (tooBig) {
538
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
539
- code: ZodError_js_1.ZodIssueCode.too_big,
540
- maximum: check.value,
541
- type: "string",
542
- inclusive: true,
543
- exact: true,
544
- message: check.message,
545
- });
546
- }
547
- else if (tooSmall) {
548
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
549
- code: ZodError_js_1.ZodIssueCode.too_small,
550
- minimum: check.value,
551
- type: "string",
552
- inclusive: true,
553
- exact: true,
554
- message: check.message,
555
- });
556
- }
557
- status.dirty();
558
- }
559
- }
560
- else if (check.kind === "email") {
561
- if (!emailRegex.test(input.data)) {
562
- ctx = this._getOrReturnCtx(input, ctx);
563
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
564
- validation: "email",
565
- code: ZodError_js_1.ZodIssueCode.invalid_string,
566
- message: check.message,
567
- });
568
- status.dirty();
569
- }
570
- }
571
- else if (check.kind === "emoji") {
572
- if (!emojiRegex) {
573
- emojiRegex = new RegExp(_emojiRegex, "u");
574
- }
575
- if (!emojiRegex.test(input.data)) {
576
- ctx = this._getOrReturnCtx(input, ctx);
577
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
578
- validation: "emoji",
579
- code: ZodError_js_1.ZodIssueCode.invalid_string,
580
- message: check.message,
581
- });
582
- status.dirty();
583
- }
584
- }
585
- else if (check.kind === "uuid") {
586
- if (!uuidRegex.test(input.data)) {
587
- ctx = this._getOrReturnCtx(input, ctx);
588
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
589
- validation: "uuid",
590
- code: ZodError_js_1.ZodIssueCode.invalid_string,
591
- message: check.message,
592
- });
593
- status.dirty();
594
- }
595
- }
596
- else if (check.kind === "nanoid") {
597
- if (!nanoidRegex.test(input.data)) {
598
- ctx = this._getOrReturnCtx(input, ctx);
599
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
600
- validation: "nanoid",
601
- code: ZodError_js_1.ZodIssueCode.invalid_string,
602
- message: check.message,
603
- });
604
- status.dirty();
605
- }
606
- }
607
- else if (check.kind === "cuid") {
608
- if (!cuidRegex.test(input.data)) {
609
- ctx = this._getOrReturnCtx(input, ctx);
610
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
611
- validation: "cuid",
612
- code: ZodError_js_1.ZodIssueCode.invalid_string,
613
- message: check.message,
614
- });
615
- status.dirty();
616
- }
617
- }
618
- else if (check.kind === "cuid2") {
619
- if (!cuid2Regex.test(input.data)) {
620
- ctx = this._getOrReturnCtx(input, ctx);
621
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
622
- validation: "cuid2",
623
- code: ZodError_js_1.ZodIssueCode.invalid_string,
624
- message: check.message,
625
- });
626
- status.dirty();
627
- }
628
- }
629
- else if (check.kind === "ulid") {
630
- if (!ulidRegex.test(input.data)) {
631
- ctx = this._getOrReturnCtx(input, ctx);
632
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
633
- validation: "ulid",
634
- code: ZodError_js_1.ZodIssueCode.invalid_string,
635
- message: check.message,
636
- });
637
- status.dirty();
638
- }
639
- }
640
- else if (check.kind === "url") {
641
- try {
642
- new URL(input.data);
643
- }
644
- catch {
645
- ctx = this._getOrReturnCtx(input, ctx);
646
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
647
- validation: "url",
648
- code: ZodError_js_1.ZodIssueCode.invalid_string,
649
- message: check.message,
650
- });
651
- status.dirty();
652
- }
653
- }
654
- else if (check.kind === "regex") {
655
- check.regex.lastIndex = 0;
656
- const testResult = check.regex.test(input.data);
657
- if (!testResult) {
658
- ctx = this._getOrReturnCtx(input, ctx);
659
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
660
- validation: "regex",
661
- code: ZodError_js_1.ZodIssueCode.invalid_string,
662
- message: check.message,
663
- });
664
- status.dirty();
665
- }
666
- }
667
- else if (check.kind === "trim") {
668
- input.data = input.data.trim();
669
- }
670
- else if (check.kind === "includes") {
671
- if (!input.data.includes(check.value, check.position)) {
672
- ctx = this._getOrReturnCtx(input, ctx);
673
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
674
- code: ZodError_js_1.ZodIssueCode.invalid_string,
675
- validation: { includes: check.value, position: check.position },
676
- message: check.message,
677
- });
678
- status.dirty();
679
- }
680
- }
681
- else if (check.kind === "toLowerCase") {
682
- input.data = input.data.toLowerCase();
683
- }
684
- else if (check.kind === "toUpperCase") {
685
- input.data = input.data.toUpperCase();
686
- }
687
- else if (check.kind === "startsWith") {
688
- if (!input.data.startsWith(check.value)) {
689
- ctx = this._getOrReturnCtx(input, ctx);
690
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
691
- code: ZodError_js_1.ZodIssueCode.invalid_string,
692
- validation: { startsWith: check.value },
693
- message: check.message,
694
- });
695
- status.dirty();
696
- }
697
- }
698
- else if (check.kind === "endsWith") {
699
- if (!input.data.endsWith(check.value)) {
700
- ctx = this._getOrReturnCtx(input, ctx);
701
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
702
- code: ZodError_js_1.ZodIssueCode.invalid_string,
703
- validation: { endsWith: check.value },
704
- message: check.message,
705
- });
706
- status.dirty();
707
- }
708
- }
709
- else if (check.kind === "datetime") {
710
- const regex = datetimeRegex(check);
711
- if (!regex.test(input.data)) {
712
- ctx = this._getOrReturnCtx(input, ctx);
713
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
714
- code: ZodError_js_1.ZodIssueCode.invalid_string,
715
- validation: "datetime",
716
- message: check.message,
717
- });
718
- status.dirty();
719
- }
720
- }
721
- else if (check.kind === "date") {
722
- const regex = dateRegex;
723
- if (!regex.test(input.data)) {
724
- ctx = this._getOrReturnCtx(input, ctx);
725
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
726
- code: ZodError_js_1.ZodIssueCode.invalid_string,
727
- validation: "date",
728
- message: check.message,
729
- });
730
- status.dirty();
731
- }
732
- }
733
- else if (check.kind === "time") {
734
- const regex = timeRegex(check);
735
- if (!regex.test(input.data)) {
736
- ctx = this._getOrReturnCtx(input, ctx);
737
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
738
- code: ZodError_js_1.ZodIssueCode.invalid_string,
739
- validation: "time",
740
- message: check.message,
741
- });
742
- status.dirty();
743
- }
744
- }
745
- else if (check.kind === "duration") {
746
- if (!durationRegex.test(input.data)) {
747
- ctx = this._getOrReturnCtx(input, ctx);
748
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
749
- validation: "duration",
750
- code: ZodError_js_1.ZodIssueCode.invalid_string,
751
- message: check.message,
752
- });
753
- status.dirty();
754
- }
755
- }
756
- else if (check.kind === "ip") {
757
- if (!isValidIP(input.data, check.version)) {
758
- ctx = this._getOrReturnCtx(input, ctx);
759
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
760
- validation: "ip",
761
- code: ZodError_js_1.ZodIssueCode.invalid_string,
762
- message: check.message,
763
- });
764
- status.dirty();
765
- }
766
- }
767
- else if (check.kind === "jwt") {
768
- if (!isValidJWT(input.data, check.alg)) {
769
- ctx = this._getOrReturnCtx(input, ctx);
770
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
771
- validation: "jwt",
772
- code: ZodError_js_1.ZodIssueCode.invalid_string,
773
- message: check.message,
774
- });
775
- status.dirty();
776
- }
777
- }
778
- else if (check.kind === "cidr") {
779
- if (!isValidCidr(input.data, check.version)) {
780
- ctx = this._getOrReturnCtx(input, ctx);
781
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
782
- validation: "cidr",
783
- code: ZodError_js_1.ZodIssueCode.invalid_string,
784
- message: check.message,
785
- });
786
- status.dirty();
787
- }
788
- }
789
- else if (check.kind === "base64") {
790
- if (!base64Regex.test(input.data)) {
791
- ctx = this._getOrReturnCtx(input, ctx);
792
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
793
- validation: "base64",
794
- code: ZodError_js_1.ZodIssueCode.invalid_string,
795
- message: check.message,
796
- });
797
- status.dirty();
798
- }
799
- }
800
- else if (check.kind === "base64url") {
801
- if (!base64urlRegex.test(input.data)) {
802
- ctx = this._getOrReturnCtx(input, ctx);
803
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
804
- validation: "base64url",
805
- code: ZodError_js_1.ZodIssueCode.invalid_string,
806
- message: check.message,
807
- });
808
- status.dirty();
809
- }
810
- }
811
- else {
812
- util_js_1.util.assertNever(check);
813
- }
814
- }
815
- return { status: status.value, value: input.data };
816
- }
817
- _regex(regex, validation, message) {
818
- return this.refinement((data) => regex.test(data), {
819
- validation,
820
- code: ZodError_js_1.ZodIssueCode.invalid_string,
821
- ...errorUtil_js_1.errorUtil.errToObj(message),
822
- });
823
- }
824
- _addCheck(check) {
825
- return new ZodString({
826
- ...this._def,
827
- checks: [...this._def.checks, check],
828
- });
829
- }
830
- email(message) {
831
- return this._addCheck({ kind: "email", ...errorUtil_js_1.errorUtil.errToObj(message) });
832
- }
833
- url(message) {
834
- return this._addCheck({ kind: "url", ...errorUtil_js_1.errorUtil.errToObj(message) });
835
- }
836
- emoji(message) {
837
- return this._addCheck({ kind: "emoji", ...errorUtil_js_1.errorUtil.errToObj(message) });
838
- }
839
- uuid(message) {
840
- return this._addCheck({ kind: "uuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
841
- }
842
- nanoid(message) {
843
- return this._addCheck({ kind: "nanoid", ...errorUtil_js_1.errorUtil.errToObj(message) });
844
- }
845
- cuid(message) {
846
- return this._addCheck({ kind: "cuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
847
- }
848
- cuid2(message) {
849
- return this._addCheck({ kind: "cuid2", ...errorUtil_js_1.errorUtil.errToObj(message) });
850
- }
851
- ulid(message) {
852
- return this._addCheck({ kind: "ulid", ...errorUtil_js_1.errorUtil.errToObj(message) });
853
- }
854
- base64(message) {
855
- return this._addCheck({ kind: "base64", ...errorUtil_js_1.errorUtil.errToObj(message) });
856
- }
857
- base64url(message) {
858
- // base64url encoding is a modification of base64 that can safely be used in URLs and filenames
859
- return this._addCheck({
860
- kind: "base64url",
861
- ...errorUtil_js_1.errorUtil.errToObj(message),
862
- });
863
- }
864
- jwt(options) {
865
- return this._addCheck({ kind: "jwt", ...errorUtil_js_1.errorUtil.errToObj(options) });
866
- }
867
- ip(options) {
868
- return this._addCheck({ kind: "ip", ...errorUtil_js_1.errorUtil.errToObj(options) });
869
- }
870
- cidr(options) {
871
- return this._addCheck({ kind: "cidr", ...errorUtil_js_1.errorUtil.errToObj(options) });
872
- }
873
- datetime(options) {
874
- if (typeof options === "string") {
875
- return this._addCheck({
876
- kind: "datetime",
877
- precision: null,
878
- offset: false,
879
- local: false,
880
- message: options,
881
- });
882
- }
883
- return this._addCheck({
884
- kind: "datetime",
885
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
886
- offset: options?.offset ?? false,
887
- local: options?.local ?? false,
888
- ...errorUtil_js_1.errorUtil.errToObj(options?.message),
889
- });
890
- }
891
- date(message) {
892
- return this._addCheck({ kind: "date", message });
893
- }
894
- time(options) {
895
- if (typeof options === "string") {
896
- return this._addCheck({
897
- kind: "time",
898
- precision: null,
899
- message: options,
900
- });
901
- }
902
- return this._addCheck({
903
- kind: "time",
904
- precision: typeof options?.precision === "undefined" ? null : options?.precision,
905
- ...errorUtil_js_1.errorUtil.errToObj(options?.message),
906
- });
907
- }
908
- duration(message) {
909
- return this._addCheck({ kind: "duration", ...errorUtil_js_1.errorUtil.errToObj(message) });
910
- }
911
- regex(regex, message) {
912
- return this._addCheck({
913
- kind: "regex",
914
- regex: regex,
915
- ...errorUtil_js_1.errorUtil.errToObj(message),
916
- });
917
- }
918
- includes(value, options) {
919
- return this._addCheck({
920
- kind: "includes",
921
- value: value,
922
- position: options?.position,
923
- ...errorUtil_js_1.errorUtil.errToObj(options?.message),
924
- });
925
- }
926
- startsWith(value, message) {
927
- return this._addCheck({
928
- kind: "startsWith",
929
- value: value,
930
- ...errorUtil_js_1.errorUtil.errToObj(message),
931
- });
932
- }
933
- endsWith(value, message) {
934
- return this._addCheck({
935
- kind: "endsWith",
936
- value: value,
937
- ...errorUtil_js_1.errorUtil.errToObj(message),
938
- });
939
- }
940
- min(minLength, message) {
941
- return this._addCheck({
942
- kind: "min",
943
- value: minLength,
944
- ...errorUtil_js_1.errorUtil.errToObj(message),
945
- });
946
- }
947
- max(maxLength, message) {
948
- return this._addCheck({
949
- kind: "max",
950
- value: maxLength,
951
- ...errorUtil_js_1.errorUtil.errToObj(message),
952
- });
953
- }
954
- length(len, message) {
955
- return this._addCheck({
956
- kind: "length",
957
- value: len,
958
- ...errorUtil_js_1.errorUtil.errToObj(message),
959
- });
960
- }
961
- /**
962
- * Equivalent to `.min(1)`
963
- */
964
- nonempty(message) {
965
- return this.min(1, errorUtil_js_1.errorUtil.errToObj(message));
966
- }
967
- trim() {
968
- return new ZodString({
969
- ...this._def,
970
- checks: [...this._def.checks, { kind: "trim" }],
971
- });
972
- }
973
- toLowerCase() {
974
- return new ZodString({
975
- ...this._def,
976
- checks: [...this._def.checks, { kind: "toLowerCase" }],
977
- });
978
- }
979
- toUpperCase() {
980
- return new ZodString({
981
- ...this._def,
982
- checks: [...this._def.checks, { kind: "toUpperCase" }],
983
- });
984
- }
985
- get isDatetime() {
986
- return !!this._def.checks.find((ch) => ch.kind === "datetime");
987
- }
988
- get isDate() {
989
- return !!this._def.checks.find((ch) => ch.kind === "date");
990
- }
991
- get isTime() {
992
- return !!this._def.checks.find((ch) => ch.kind === "time");
993
- }
994
- get isDuration() {
995
- return !!this._def.checks.find((ch) => ch.kind === "duration");
996
- }
997
- get isEmail() {
998
- return !!this._def.checks.find((ch) => ch.kind === "email");
999
- }
1000
- get isURL() {
1001
- return !!this._def.checks.find((ch) => ch.kind === "url");
1002
- }
1003
- get isEmoji() {
1004
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
1005
- }
1006
- get isUUID() {
1007
- return !!this._def.checks.find((ch) => ch.kind === "uuid");
1008
- }
1009
- get isNANOID() {
1010
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1011
- }
1012
- get isCUID() {
1013
- return !!this._def.checks.find((ch) => ch.kind === "cuid");
1014
- }
1015
- get isCUID2() {
1016
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1017
- }
1018
- get isULID() {
1019
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
1020
- }
1021
- get isIP() {
1022
- return !!this._def.checks.find((ch) => ch.kind === "ip");
1023
- }
1024
- get isCIDR() {
1025
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
1026
- }
1027
- get isBase64() {
1028
- return !!this._def.checks.find((ch) => ch.kind === "base64");
1029
- }
1030
- get isBase64url() {
1031
- // base64url encoding is a modification of base64 that can safely be used in URLs and filenames
1032
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
1033
- }
1034
- get minLength() {
1035
- let min = null;
1036
- for (const ch of this._def.checks) {
1037
- if (ch.kind === "min") {
1038
- if (min === null || ch.value > min)
1039
- min = ch.value;
1040
- }
1041
- }
1042
- return min;
1043
- }
1044
- get maxLength() {
1045
- let max = null;
1046
- for (const ch of this._def.checks) {
1047
- if (ch.kind === "max") {
1048
- if (max === null || ch.value < max)
1049
- max = ch.value;
1050
- }
1051
- }
1052
- return max;
1053
- }
1054
- }
1055
- exports.ZodString = ZodString;
1056
- ZodString.create = (params) => {
1057
- return new ZodString({
1058
- checks: [],
1059
- typeName: ZodFirstPartyTypeKind.ZodString,
1060
- coerce: params?.coerce ?? false,
1061
- ...processCreateParams(params),
1062
- });
1063
- };
1064
- // https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034
1065
- function floatSafeRemainder(val, step) {
1066
- const valDecCount = (val.toString().split(".")[1] || "").length;
1067
- const stepDecCount = (step.toString().split(".")[1] || "").length;
1068
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1069
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1070
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1071
- return (valInt % stepInt) / 10 ** decCount;
1072
- }
1073
- class ZodNumber extends ZodType {
1074
- constructor() {
1075
- super(...arguments);
1076
- this.min = this.gte;
1077
- this.max = this.lte;
1078
- this.step = this.multipleOf;
1079
- }
1080
- _parse(input) {
1081
- if (this._def.coerce) {
1082
- input.data = Number(input.data);
1083
- }
1084
- const parsedType = this._getType(input);
1085
- if (parsedType !== util_js_1.ZodParsedType.number) {
1086
- const ctx = this._getOrReturnCtx(input);
1087
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1088
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1089
- expected: util_js_1.ZodParsedType.number,
1090
- received: ctx.parsedType,
1091
- });
1092
- return parseUtil_js_1.INVALID;
1093
- }
1094
- let ctx = undefined;
1095
- const status = new parseUtil_js_1.ParseStatus();
1096
- for (const check of this._def.checks) {
1097
- if (check.kind === "int") {
1098
- if (!util_js_1.util.isInteger(input.data)) {
1099
- ctx = this._getOrReturnCtx(input, ctx);
1100
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1101
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1102
- expected: "integer",
1103
- received: "float",
1104
- message: check.message,
1105
- });
1106
- status.dirty();
1107
- }
1108
- }
1109
- else if (check.kind === "min") {
1110
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1111
- if (tooSmall) {
1112
- ctx = this._getOrReturnCtx(input, ctx);
1113
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1114
- code: ZodError_js_1.ZodIssueCode.too_small,
1115
- minimum: check.value,
1116
- type: "number",
1117
- inclusive: check.inclusive,
1118
- exact: false,
1119
- message: check.message,
1120
- });
1121
- status.dirty();
1122
- }
1123
- }
1124
- else if (check.kind === "max") {
1125
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1126
- if (tooBig) {
1127
- ctx = this._getOrReturnCtx(input, ctx);
1128
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1129
- code: ZodError_js_1.ZodIssueCode.too_big,
1130
- maximum: check.value,
1131
- type: "number",
1132
- inclusive: check.inclusive,
1133
- exact: false,
1134
- message: check.message,
1135
- });
1136
- status.dirty();
1137
- }
1138
- }
1139
- else if (check.kind === "multipleOf") {
1140
- if (floatSafeRemainder(input.data, check.value) !== 0) {
1141
- ctx = this._getOrReturnCtx(input, ctx);
1142
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1143
- code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1144
- multipleOf: check.value,
1145
- message: check.message,
1146
- });
1147
- status.dirty();
1148
- }
1149
- }
1150
- else if (check.kind === "finite") {
1151
- if (!Number.isFinite(input.data)) {
1152
- ctx = this._getOrReturnCtx(input, ctx);
1153
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1154
- code: ZodError_js_1.ZodIssueCode.not_finite,
1155
- message: check.message,
1156
- });
1157
- status.dirty();
1158
- }
1159
- }
1160
- else {
1161
- util_js_1.util.assertNever(check);
1162
- }
1163
- }
1164
- return { status: status.value, value: input.data };
1165
- }
1166
- gte(value, message) {
1167
- return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1168
- }
1169
- gt(value, message) {
1170
- return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1171
- }
1172
- lte(value, message) {
1173
- return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1174
- }
1175
- lt(value, message) {
1176
- return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1177
- }
1178
- setLimit(kind, value, inclusive, message) {
1179
- return new ZodNumber({
1180
- ...this._def,
1181
- checks: [
1182
- ...this._def.checks,
1183
- {
1184
- kind,
1185
- value,
1186
- inclusive,
1187
- message: errorUtil_js_1.errorUtil.toString(message),
1188
- },
1189
- ],
1190
- });
1191
- }
1192
- _addCheck(check) {
1193
- return new ZodNumber({
1194
- ...this._def,
1195
- checks: [...this._def.checks, check],
1196
- });
1197
- }
1198
- int(message) {
1199
- return this._addCheck({
1200
- kind: "int",
1201
- message: errorUtil_js_1.errorUtil.toString(message),
1202
- });
1203
- }
1204
- positive(message) {
1205
- return this._addCheck({
1206
- kind: "min",
1207
- value: 0,
1208
- inclusive: false,
1209
- message: errorUtil_js_1.errorUtil.toString(message),
1210
- });
1211
- }
1212
- negative(message) {
1213
- return this._addCheck({
1214
- kind: "max",
1215
- value: 0,
1216
- inclusive: false,
1217
- message: errorUtil_js_1.errorUtil.toString(message),
1218
- });
1219
- }
1220
- nonpositive(message) {
1221
- return this._addCheck({
1222
- kind: "max",
1223
- value: 0,
1224
- inclusive: true,
1225
- message: errorUtil_js_1.errorUtil.toString(message),
1226
- });
1227
- }
1228
- nonnegative(message) {
1229
- return this._addCheck({
1230
- kind: "min",
1231
- value: 0,
1232
- inclusive: true,
1233
- message: errorUtil_js_1.errorUtil.toString(message),
1234
- });
1235
- }
1236
- multipleOf(value, message) {
1237
- return this._addCheck({
1238
- kind: "multipleOf",
1239
- value: value,
1240
- message: errorUtil_js_1.errorUtil.toString(message),
1241
- });
1242
- }
1243
- finite(message) {
1244
- return this._addCheck({
1245
- kind: "finite",
1246
- message: errorUtil_js_1.errorUtil.toString(message),
1247
- });
1248
- }
1249
- safe(message) {
1250
- return this._addCheck({
1251
- kind: "min",
1252
- inclusive: true,
1253
- value: Number.MIN_SAFE_INTEGER,
1254
- message: errorUtil_js_1.errorUtil.toString(message),
1255
- })._addCheck({
1256
- kind: "max",
1257
- inclusive: true,
1258
- value: Number.MAX_SAFE_INTEGER,
1259
- message: errorUtil_js_1.errorUtil.toString(message),
1260
- });
1261
- }
1262
- get minValue() {
1263
- let min = null;
1264
- for (const ch of this._def.checks) {
1265
- if (ch.kind === "min") {
1266
- if (min === null || ch.value > min)
1267
- min = ch.value;
1268
- }
1269
- }
1270
- return min;
1271
- }
1272
- get maxValue() {
1273
- let max = null;
1274
- for (const ch of this._def.checks) {
1275
- if (ch.kind === "max") {
1276
- if (max === null || ch.value < max)
1277
- max = ch.value;
1278
- }
1279
- }
1280
- return max;
1281
- }
1282
- get isInt() {
1283
- return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util_js_1.util.isInteger(ch.value)));
1284
- }
1285
- get isFinite() {
1286
- let max = null;
1287
- let min = null;
1288
- for (const ch of this._def.checks) {
1289
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
1290
- return true;
1291
- }
1292
- else if (ch.kind === "min") {
1293
- if (min === null || ch.value > min)
1294
- min = ch.value;
1295
- }
1296
- else if (ch.kind === "max") {
1297
- if (max === null || ch.value < max)
1298
- max = ch.value;
1299
- }
1300
- }
1301
- return Number.isFinite(min) && Number.isFinite(max);
1302
- }
1303
- }
1304
- exports.ZodNumber = ZodNumber;
1305
- ZodNumber.create = (params) => {
1306
- return new ZodNumber({
1307
- checks: [],
1308
- typeName: ZodFirstPartyTypeKind.ZodNumber,
1309
- coerce: params?.coerce || false,
1310
- ...processCreateParams(params),
1311
- });
1312
- };
1313
- class ZodBigInt extends ZodType {
1314
- constructor() {
1315
- super(...arguments);
1316
- this.min = this.gte;
1317
- this.max = this.lte;
1318
- }
1319
- _parse(input) {
1320
- if (this._def.coerce) {
1321
- try {
1322
- input.data = BigInt(input.data);
1323
- }
1324
- catch {
1325
- return this._getInvalidInput(input);
1326
- }
1327
- }
1328
- const parsedType = this._getType(input);
1329
- if (parsedType !== util_js_1.ZodParsedType.bigint) {
1330
- return this._getInvalidInput(input);
1331
- }
1332
- let ctx = undefined;
1333
- const status = new parseUtil_js_1.ParseStatus();
1334
- for (const check of this._def.checks) {
1335
- if (check.kind === "min") {
1336
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1337
- if (tooSmall) {
1338
- ctx = this._getOrReturnCtx(input, ctx);
1339
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1340
- code: ZodError_js_1.ZodIssueCode.too_small,
1341
- type: "bigint",
1342
- minimum: check.value,
1343
- inclusive: check.inclusive,
1344
- message: check.message,
1345
- });
1346
- status.dirty();
1347
- }
1348
- }
1349
- else if (check.kind === "max") {
1350
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1351
- if (tooBig) {
1352
- ctx = this._getOrReturnCtx(input, ctx);
1353
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1354
- code: ZodError_js_1.ZodIssueCode.too_big,
1355
- type: "bigint",
1356
- maximum: check.value,
1357
- inclusive: check.inclusive,
1358
- message: check.message,
1359
- });
1360
- status.dirty();
1361
- }
1362
- }
1363
- else if (check.kind === "multipleOf") {
1364
- if (input.data % check.value !== BigInt(0)) {
1365
- ctx = this._getOrReturnCtx(input, ctx);
1366
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1367
- code: ZodError_js_1.ZodIssueCode.not_multiple_of,
1368
- multipleOf: check.value,
1369
- message: check.message,
1370
- });
1371
- status.dirty();
1372
- }
1373
- }
1374
- else {
1375
- util_js_1.util.assertNever(check);
1376
- }
1377
- }
1378
- return { status: status.value, value: input.data };
1379
- }
1380
- _getInvalidInput(input) {
1381
- const ctx = this._getOrReturnCtx(input);
1382
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1383
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1384
- expected: util_js_1.ZodParsedType.bigint,
1385
- received: ctx.parsedType,
1386
- });
1387
- return parseUtil_js_1.INVALID;
1388
- }
1389
- gte(value, message) {
1390
- return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
1391
- }
1392
- gt(value, message) {
1393
- return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
1394
- }
1395
- lte(value, message) {
1396
- return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
1397
- }
1398
- lt(value, message) {
1399
- return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
1400
- }
1401
- setLimit(kind, value, inclusive, message) {
1402
- return new ZodBigInt({
1403
- ...this._def,
1404
- checks: [
1405
- ...this._def.checks,
1406
- {
1407
- kind,
1408
- value,
1409
- inclusive,
1410
- message: errorUtil_js_1.errorUtil.toString(message),
1411
- },
1412
- ],
1413
- });
1414
- }
1415
- _addCheck(check) {
1416
- return new ZodBigInt({
1417
- ...this._def,
1418
- checks: [...this._def.checks, check],
1419
- });
1420
- }
1421
- positive(message) {
1422
- return this._addCheck({
1423
- kind: "min",
1424
- value: BigInt(0),
1425
- inclusive: false,
1426
- message: errorUtil_js_1.errorUtil.toString(message),
1427
- });
1428
- }
1429
- negative(message) {
1430
- return this._addCheck({
1431
- kind: "max",
1432
- value: BigInt(0),
1433
- inclusive: false,
1434
- message: errorUtil_js_1.errorUtil.toString(message),
1435
- });
1436
- }
1437
- nonpositive(message) {
1438
- return this._addCheck({
1439
- kind: "max",
1440
- value: BigInt(0),
1441
- inclusive: true,
1442
- message: errorUtil_js_1.errorUtil.toString(message),
1443
- });
1444
- }
1445
- nonnegative(message) {
1446
- return this._addCheck({
1447
- kind: "min",
1448
- value: BigInt(0),
1449
- inclusive: true,
1450
- message: errorUtil_js_1.errorUtil.toString(message),
1451
- });
1452
- }
1453
- multipleOf(value, message) {
1454
- return this._addCheck({
1455
- kind: "multipleOf",
1456
- value,
1457
- message: errorUtil_js_1.errorUtil.toString(message),
1458
- });
1459
- }
1460
- get minValue() {
1461
- let min = null;
1462
- for (const ch of this._def.checks) {
1463
- if (ch.kind === "min") {
1464
- if (min === null || ch.value > min)
1465
- min = ch.value;
1466
- }
1467
- }
1468
- return min;
1469
- }
1470
- get maxValue() {
1471
- let max = null;
1472
- for (const ch of this._def.checks) {
1473
- if (ch.kind === "max") {
1474
- if (max === null || ch.value < max)
1475
- max = ch.value;
1476
- }
1477
- }
1478
- return max;
1479
- }
1480
- }
1481
- exports.ZodBigInt = ZodBigInt;
1482
- ZodBigInt.create = (params) => {
1483
- return new ZodBigInt({
1484
- checks: [],
1485
- typeName: ZodFirstPartyTypeKind.ZodBigInt,
1486
- coerce: params?.coerce ?? false,
1487
- ...processCreateParams(params),
1488
- });
1489
- };
1490
- class ZodBoolean extends ZodType {
1491
- _parse(input) {
1492
- if (this._def.coerce) {
1493
- input.data = Boolean(input.data);
1494
- }
1495
- const parsedType = this._getType(input);
1496
- if (parsedType !== util_js_1.ZodParsedType.boolean) {
1497
- const ctx = this._getOrReturnCtx(input);
1498
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1499
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1500
- expected: util_js_1.ZodParsedType.boolean,
1501
- received: ctx.parsedType,
1502
- });
1503
- return parseUtil_js_1.INVALID;
1504
- }
1505
- return (0, parseUtil_js_1.OK)(input.data);
1506
- }
1507
- }
1508
- exports.ZodBoolean = ZodBoolean;
1509
- ZodBoolean.create = (params) => {
1510
- return new ZodBoolean({
1511
- typeName: ZodFirstPartyTypeKind.ZodBoolean,
1512
- coerce: params?.coerce || false,
1513
- ...processCreateParams(params),
1514
- });
1515
- };
1516
- class ZodDate extends ZodType {
1517
- _parse(input) {
1518
- if (this._def.coerce) {
1519
- input.data = new Date(input.data);
1520
- }
1521
- const parsedType = this._getType(input);
1522
- if (parsedType !== util_js_1.ZodParsedType.date) {
1523
- const ctx = this._getOrReturnCtx(input);
1524
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1525
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1526
- expected: util_js_1.ZodParsedType.date,
1527
- received: ctx.parsedType,
1528
- });
1529
- return parseUtil_js_1.INVALID;
1530
- }
1531
- if (Number.isNaN(input.data.getTime())) {
1532
- const ctx = this._getOrReturnCtx(input);
1533
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1534
- code: ZodError_js_1.ZodIssueCode.invalid_date,
1535
- });
1536
- return parseUtil_js_1.INVALID;
1537
- }
1538
- const status = new parseUtil_js_1.ParseStatus();
1539
- let ctx = undefined;
1540
- for (const check of this._def.checks) {
1541
- if (check.kind === "min") {
1542
- if (input.data.getTime() < check.value) {
1543
- ctx = this._getOrReturnCtx(input, ctx);
1544
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1545
- code: ZodError_js_1.ZodIssueCode.too_small,
1546
- message: check.message,
1547
- inclusive: true,
1548
- exact: false,
1549
- minimum: check.value,
1550
- type: "date",
1551
- });
1552
- status.dirty();
1553
- }
1554
- }
1555
- else if (check.kind === "max") {
1556
- if (input.data.getTime() > check.value) {
1557
- ctx = this._getOrReturnCtx(input, ctx);
1558
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1559
- code: ZodError_js_1.ZodIssueCode.too_big,
1560
- message: check.message,
1561
- inclusive: true,
1562
- exact: false,
1563
- maximum: check.value,
1564
- type: "date",
1565
- });
1566
- status.dirty();
1567
- }
1568
- }
1569
- else {
1570
- util_js_1.util.assertNever(check);
1571
- }
1572
- }
1573
- return {
1574
- status: status.value,
1575
- value: new Date(input.data.getTime()),
1576
- };
1577
- }
1578
- _addCheck(check) {
1579
- return new ZodDate({
1580
- ...this._def,
1581
- checks: [...this._def.checks, check],
1582
- });
1583
- }
1584
- min(minDate, message) {
1585
- return this._addCheck({
1586
- kind: "min",
1587
- value: minDate.getTime(),
1588
- message: errorUtil_js_1.errorUtil.toString(message),
1589
- });
1590
- }
1591
- max(maxDate, message) {
1592
- return this._addCheck({
1593
- kind: "max",
1594
- value: maxDate.getTime(),
1595
- message: errorUtil_js_1.errorUtil.toString(message),
1596
- });
1597
- }
1598
- get minDate() {
1599
- let min = null;
1600
- for (const ch of this._def.checks) {
1601
- if (ch.kind === "min") {
1602
- if (min === null || ch.value > min)
1603
- min = ch.value;
1604
- }
1605
- }
1606
- return min != null ? new Date(min) : null;
1607
- }
1608
- get maxDate() {
1609
- let max = null;
1610
- for (const ch of this._def.checks) {
1611
- if (ch.kind === "max") {
1612
- if (max === null || ch.value < max)
1613
- max = ch.value;
1614
- }
1615
- }
1616
- return max != null ? new Date(max) : null;
1617
- }
1618
- }
1619
- exports.ZodDate = ZodDate;
1620
- ZodDate.create = (params) => {
1621
- return new ZodDate({
1622
- checks: [],
1623
- coerce: params?.coerce || false,
1624
- typeName: ZodFirstPartyTypeKind.ZodDate,
1625
- ...processCreateParams(params),
1626
- });
1627
- };
1628
- class ZodSymbol extends ZodType {
1629
- _parse(input) {
1630
- const parsedType = this._getType(input);
1631
- if (parsedType !== util_js_1.ZodParsedType.symbol) {
1632
- const ctx = this._getOrReturnCtx(input);
1633
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1634
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1635
- expected: util_js_1.ZodParsedType.symbol,
1636
- received: ctx.parsedType,
1637
- });
1638
- return parseUtil_js_1.INVALID;
1639
- }
1640
- return (0, parseUtil_js_1.OK)(input.data);
1641
- }
1642
- }
1643
- exports.ZodSymbol = ZodSymbol;
1644
- ZodSymbol.create = (params) => {
1645
- return new ZodSymbol({
1646
- typeName: ZodFirstPartyTypeKind.ZodSymbol,
1647
- ...processCreateParams(params),
1648
- });
1649
- };
1650
- class ZodUndefined extends ZodType {
1651
- _parse(input) {
1652
- const parsedType = this._getType(input);
1653
- if (parsedType !== util_js_1.ZodParsedType.undefined) {
1654
- const ctx = this._getOrReturnCtx(input);
1655
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1656
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1657
- expected: util_js_1.ZodParsedType.undefined,
1658
- received: ctx.parsedType,
1659
- });
1660
- return parseUtil_js_1.INVALID;
1661
- }
1662
- return (0, parseUtil_js_1.OK)(input.data);
1663
- }
1664
- }
1665
- exports.ZodUndefined = ZodUndefined;
1666
- ZodUndefined.create = (params) => {
1667
- return new ZodUndefined({
1668
- typeName: ZodFirstPartyTypeKind.ZodUndefined,
1669
- ...processCreateParams(params),
1670
- });
1671
- };
1672
- class ZodNull extends ZodType {
1673
- _parse(input) {
1674
- const parsedType = this._getType(input);
1675
- if (parsedType !== util_js_1.ZodParsedType.null) {
1676
- const ctx = this._getOrReturnCtx(input);
1677
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1678
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1679
- expected: util_js_1.ZodParsedType.null,
1680
- received: ctx.parsedType,
1681
- });
1682
- return parseUtil_js_1.INVALID;
1683
- }
1684
- return (0, parseUtil_js_1.OK)(input.data);
1685
- }
1686
- }
1687
- exports.ZodNull = ZodNull;
1688
- ZodNull.create = (params) => {
1689
- return new ZodNull({
1690
- typeName: ZodFirstPartyTypeKind.ZodNull,
1691
- ...processCreateParams(params),
1692
- });
1693
- };
1694
- class ZodAny extends ZodType {
1695
- constructor() {
1696
- super(...arguments);
1697
- // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.
1698
- this._any = true;
1699
- }
1700
- _parse(input) {
1701
- return (0, parseUtil_js_1.OK)(input.data);
1702
- }
1703
- }
1704
- exports.ZodAny = ZodAny;
1705
- ZodAny.create = (params) => {
1706
- return new ZodAny({
1707
- typeName: ZodFirstPartyTypeKind.ZodAny,
1708
- ...processCreateParams(params),
1709
- });
1710
- };
1711
- class ZodUnknown extends ZodType {
1712
- constructor() {
1713
- super(...arguments);
1714
- // required
1715
- this._unknown = true;
1716
- }
1717
- _parse(input) {
1718
- return (0, parseUtil_js_1.OK)(input.data);
1719
- }
1720
- }
1721
- exports.ZodUnknown = ZodUnknown;
1722
- ZodUnknown.create = (params) => {
1723
- return new ZodUnknown({
1724
- typeName: ZodFirstPartyTypeKind.ZodUnknown,
1725
- ...processCreateParams(params),
1726
- });
1727
- };
1728
- class ZodNever extends ZodType {
1729
- _parse(input) {
1730
- const ctx = this._getOrReturnCtx(input);
1731
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1732
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1733
- expected: util_js_1.ZodParsedType.never,
1734
- received: ctx.parsedType,
1735
- });
1736
- return parseUtil_js_1.INVALID;
1737
- }
1738
- }
1739
- exports.ZodNever = ZodNever;
1740
- ZodNever.create = (params) => {
1741
- return new ZodNever({
1742
- typeName: ZodFirstPartyTypeKind.ZodNever,
1743
- ...processCreateParams(params),
1744
- });
1745
- };
1746
- class ZodVoid extends ZodType {
1747
- _parse(input) {
1748
- const parsedType = this._getType(input);
1749
- if (parsedType !== util_js_1.ZodParsedType.undefined) {
1750
- const ctx = this._getOrReturnCtx(input);
1751
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1752
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1753
- expected: util_js_1.ZodParsedType.void,
1754
- received: ctx.parsedType,
1755
- });
1756
- return parseUtil_js_1.INVALID;
1757
- }
1758
- return (0, parseUtil_js_1.OK)(input.data);
1759
- }
1760
- }
1761
- exports.ZodVoid = ZodVoid;
1762
- ZodVoid.create = (params) => {
1763
- return new ZodVoid({
1764
- typeName: ZodFirstPartyTypeKind.ZodVoid,
1765
- ...processCreateParams(params),
1766
- });
1767
- };
1768
- class ZodArray extends ZodType {
1769
- _parse(input) {
1770
- const { ctx, status } = this._processInputParams(input);
1771
- const def = this._def;
1772
- if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
1773
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1774
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1775
- expected: util_js_1.ZodParsedType.array,
1776
- received: ctx.parsedType,
1777
- });
1778
- return parseUtil_js_1.INVALID;
1779
- }
1780
- if (def.exactLength !== null) {
1781
- const tooBig = ctx.data.length > def.exactLength.value;
1782
- const tooSmall = ctx.data.length < def.exactLength.value;
1783
- if (tooBig || tooSmall) {
1784
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1785
- code: tooBig ? ZodError_js_1.ZodIssueCode.too_big : ZodError_js_1.ZodIssueCode.too_small,
1786
- minimum: (tooSmall ? def.exactLength.value : undefined),
1787
- maximum: (tooBig ? def.exactLength.value : undefined),
1788
- type: "array",
1789
- inclusive: true,
1790
- exact: true,
1791
- message: def.exactLength.message,
1792
- });
1793
- status.dirty();
1794
- }
1795
- }
1796
- if (def.minLength !== null) {
1797
- if (ctx.data.length < def.minLength.value) {
1798
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1799
- code: ZodError_js_1.ZodIssueCode.too_small,
1800
- minimum: def.minLength.value,
1801
- type: "array",
1802
- inclusive: true,
1803
- exact: false,
1804
- message: def.minLength.message,
1805
- });
1806
- status.dirty();
1807
- }
1808
- }
1809
- if (def.maxLength !== null) {
1810
- if (ctx.data.length > def.maxLength.value) {
1811
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1812
- code: ZodError_js_1.ZodIssueCode.too_big,
1813
- maximum: def.maxLength.value,
1814
- type: "array",
1815
- inclusive: true,
1816
- exact: false,
1817
- message: def.maxLength.message,
1818
- });
1819
- status.dirty();
1820
- }
1821
- }
1822
- if (ctx.common.async) {
1823
- return Promise.all([...ctx.data].map((item, i) => {
1824
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1825
- })).then((result) => {
1826
- return parseUtil_js_1.ParseStatus.mergeArray(status, result);
1827
- });
1828
- }
1829
- const result = [...ctx.data].map((item, i) => {
1830
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1831
- });
1832
- return parseUtil_js_1.ParseStatus.mergeArray(status, result);
1833
- }
1834
- get element() {
1835
- return this._def.type;
1836
- }
1837
- min(minLength, message) {
1838
- return new ZodArray({
1839
- ...this._def,
1840
- minLength: { value: minLength, message: errorUtil_js_1.errorUtil.toString(message) },
1841
- });
1842
- }
1843
- max(maxLength, message) {
1844
- return new ZodArray({
1845
- ...this._def,
1846
- maxLength: { value: maxLength, message: errorUtil_js_1.errorUtil.toString(message) },
1847
- });
1848
- }
1849
- length(len, message) {
1850
- return new ZodArray({
1851
- ...this._def,
1852
- exactLength: { value: len, message: errorUtil_js_1.errorUtil.toString(message) },
1853
- });
1854
- }
1855
- nonempty(message) {
1856
- return this.min(1, message);
1857
- }
1858
- }
1859
- exports.ZodArray = ZodArray;
1860
- ZodArray.create = (schema, params) => {
1861
- return new ZodArray({
1862
- type: schema,
1863
- minLength: null,
1864
- maxLength: null,
1865
- exactLength: null,
1866
- typeName: ZodFirstPartyTypeKind.ZodArray,
1867
- ...processCreateParams(params),
1868
- });
1869
- };
1870
- function deepPartialify(schema) {
1871
- if (schema instanceof ZodObject) {
1872
- const newShape = {};
1873
- for (const key in schema.shape) {
1874
- const fieldSchema = schema.shape[key];
1875
- newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
1876
- }
1877
- return new ZodObject({
1878
- ...schema._def,
1879
- shape: () => newShape,
1880
- });
1881
- }
1882
- else if (schema instanceof ZodArray) {
1883
- return new ZodArray({
1884
- ...schema._def,
1885
- type: deepPartialify(schema.element),
1886
- });
1887
- }
1888
- else if (schema instanceof ZodOptional) {
1889
- return ZodOptional.create(deepPartialify(schema.unwrap()));
1890
- }
1891
- else if (schema instanceof ZodNullable) {
1892
- return ZodNullable.create(deepPartialify(schema.unwrap()));
1893
- }
1894
- else if (schema instanceof ZodTuple) {
1895
- return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
1896
- }
1897
- else {
1898
- return schema;
1899
- }
1900
- }
1901
- class ZodObject extends ZodType {
1902
- constructor() {
1903
- super(...arguments);
1904
- this._cached = null;
1905
- /**
1906
- * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
1907
- * If you want to pass through unknown properties, use `.passthrough()` instead.
1908
- */
1909
- this.nonstrict = this.passthrough;
1910
- // extend<
1911
- // Augmentation extends ZodRawShape,
1912
- // NewOutput extends util.flatten<{
1913
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1914
- // ? Augmentation[k]["_output"]
1915
- // : k extends keyof Output
1916
- // ? Output[k]
1917
- // : never;
1918
- // }>,
1919
- // NewInput extends util.flatten<{
1920
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1921
- // ? Augmentation[k]["_input"]
1922
- // : k extends keyof Input
1923
- // ? Input[k]
1924
- // : never;
1925
- // }>
1926
- // >(
1927
- // augmentation: Augmentation
1928
- // ): ZodObject<
1929
- // extendShape<T, Augmentation>,
1930
- // UnknownKeys,
1931
- // Catchall,
1932
- // NewOutput,
1933
- // NewInput
1934
- // > {
1935
- // return new ZodObject({
1936
- // ...this._def,
1937
- // shape: () => ({
1938
- // ...this._def.shape(),
1939
- // ...augmentation,
1940
- // }),
1941
- // }) as any;
1942
- // }
1943
- /**
1944
- * @deprecated Use `.extend` instead
1945
- * */
1946
- this.augment = this.extend;
1947
- }
1948
- _getCached() {
1949
- if (this._cached !== null)
1950
- return this._cached;
1951
- const shape = this._def.shape();
1952
- const keys = util_js_1.util.objectKeys(shape);
1953
- this._cached = { shape, keys };
1954
- return this._cached;
1955
- }
1956
- _parse(input) {
1957
- const parsedType = this._getType(input);
1958
- if (parsedType !== util_js_1.ZodParsedType.object) {
1959
- const ctx = this._getOrReturnCtx(input);
1960
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
1961
- code: ZodError_js_1.ZodIssueCode.invalid_type,
1962
- expected: util_js_1.ZodParsedType.object,
1963
- received: ctx.parsedType,
1964
- });
1965
- return parseUtil_js_1.INVALID;
1966
- }
1967
- const { status, ctx } = this._processInputParams(input);
1968
- const { shape, keys: shapeKeys } = this._getCached();
1969
- const extraKeys = [];
1970
- if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
1971
- for (const key in ctx.data) {
1972
- if (!shapeKeys.includes(key)) {
1973
- extraKeys.push(key);
1974
- }
1975
- }
1976
- }
1977
- const pairs = [];
1978
- for (const key of shapeKeys) {
1979
- const keyValidator = shape[key];
1980
- const value = ctx.data[key];
1981
- pairs.push({
1982
- key: { status: "valid", value: key },
1983
- value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
1984
- alwaysSet: key in ctx.data,
1985
- });
1986
- }
1987
- if (this._def.catchall instanceof ZodNever) {
1988
- const unknownKeys = this._def.unknownKeys;
1989
- if (unknownKeys === "passthrough") {
1990
- for (const key of extraKeys) {
1991
- pairs.push({
1992
- key: { status: "valid", value: key },
1993
- value: { status: "valid", value: ctx.data[key] },
1994
- });
1995
- }
1996
- }
1997
- else if (unknownKeys === "strict") {
1998
- if (extraKeys.length > 0) {
1999
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2000
- code: ZodError_js_1.ZodIssueCode.unrecognized_keys,
2001
- keys: extraKeys,
2002
- });
2003
- status.dirty();
2004
- }
2005
- }
2006
- else if (unknownKeys === "strip") {
2007
- }
2008
- else {
2009
- throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2010
- }
2011
- }
2012
- else {
2013
- // run catchall validation
2014
- const catchall = this._def.catchall;
2015
- for (const key of extraKeys) {
2016
- const value = ctx.data[key];
2017
- pairs.push({
2018
- key: { status: "valid", value: key },
2019
- value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)
2020
- ),
2021
- alwaysSet: key in ctx.data,
2022
- });
2023
- }
2024
- }
2025
- if (ctx.common.async) {
2026
- return Promise.resolve()
2027
- .then(async () => {
2028
- const syncPairs = [];
2029
- for (const pair of pairs) {
2030
- const key = await pair.key;
2031
- const value = await pair.value;
2032
- syncPairs.push({
2033
- key,
2034
- value,
2035
- alwaysSet: pair.alwaysSet,
2036
- });
2037
- }
2038
- return syncPairs;
2039
- })
2040
- .then((syncPairs) => {
2041
- return parseUtil_js_1.ParseStatus.mergeObjectSync(status, syncPairs);
2042
- });
2043
- }
2044
- else {
2045
- return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
2046
- }
2047
- }
2048
- get shape() {
2049
- return this._def.shape();
2050
- }
2051
- strict(message) {
2052
- errorUtil_js_1.errorUtil.errToObj;
2053
- return new ZodObject({
2054
- ...this._def,
2055
- unknownKeys: "strict",
2056
- ...(message !== undefined
2057
- ? {
2058
- errorMap: (issue, ctx) => {
2059
- const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2060
- if (issue.code === "unrecognized_keys")
2061
- return {
2062
- message: errorUtil_js_1.errorUtil.errToObj(message).message ?? defaultError,
2063
- };
2064
- return {
2065
- message: defaultError,
2066
- };
2067
- },
2068
- }
2069
- : {}),
2070
- });
2071
- }
2072
- strip() {
2073
- return new ZodObject({
2074
- ...this._def,
2075
- unknownKeys: "strip",
2076
- });
2077
- }
2078
- passthrough() {
2079
- return new ZodObject({
2080
- ...this._def,
2081
- unknownKeys: "passthrough",
2082
- });
2083
- }
2084
- // const AugmentFactory =
2085
- // <Def extends ZodObjectDef>(def: Def) =>
2086
- // <Augmentation extends ZodRawShape>(
2087
- // augmentation: Augmentation
2088
- // ): ZodObject<
2089
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2090
- // Def["unknownKeys"],
2091
- // Def["catchall"]
2092
- // > => {
2093
- // return new ZodObject({
2094
- // ...def,
2095
- // shape: () => ({
2096
- // ...def.shape(),
2097
- // ...augmentation,
2098
- // }),
2099
- // }) as any;
2100
- // };
2101
- extend(augmentation) {
2102
- return new ZodObject({
2103
- ...this._def,
2104
- shape: () => ({
2105
- ...this._def.shape(),
2106
- ...augmentation,
2107
- }),
2108
- });
2109
- }
2110
- /**
2111
- * Prior to zod@1.0.12 there was a bug in the
2112
- * inferred type of merged objects. Please
2113
- * upgrade if you are experiencing issues.
2114
- */
2115
- merge(merging) {
2116
- const merged = new ZodObject({
2117
- unknownKeys: merging._def.unknownKeys,
2118
- catchall: merging._def.catchall,
2119
- shape: () => ({
2120
- ...this._def.shape(),
2121
- ...merging._def.shape(),
2122
- }),
2123
- typeName: ZodFirstPartyTypeKind.ZodObject,
2124
- });
2125
- return merged;
2126
- }
2127
- // merge<
2128
- // Incoming extends AnyZodObject,
2129
- // Augmentation extends Incoming["shape"],
2130
- // NewOutput extends {
2131
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2132
- // ? Augmentation[k]["_output"]
2133
- // : k extends keyof Output
2134
- // ? Output[k]
2135
- // : never;
2136
- // },
2137
- // NewInput extends {
2138
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2139
- // ? Augmentation[k]["_input"]
2140
- // : k extends keyof Input
2141
- // ? Input[k]
2142
- // : never;
2143
- // }
2144
- // >(
2145
- // merging: Incoming
2146
- // ): ZodObject<
2147
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2148
- // Incoming["_def"]["unknownKeys"],
2149
- // Incoming["_def"]["catchall"],
2150
- // NewOutput,
2151
- // NewInput
2152
- // > {
2153
- // const merged: any = new ZodObject({
2154
- // unknownKeys: merging._def.unknownKeys,
2155
- // catchall: merging._def.catchall,
2156
- // shape: () =>
2157
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2158
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2159
- // }) as any;
2160
- // return merged;
2161
- // }
2162
- setKey(key, schema) {
2163
- return this.augment({ [key]: schema });
2164
- }
2165
- // merge<Incoming extends AnyZodObject>(
2166
- // merging: Incoming
2167
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2168
- // ZodObject<
2169
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2170
- // Incoming["_def"]["unknownKeys"],
2171
- // Incoming["_def"]["catchall"]
2172
- // > {
2173
- // // const mergedShape = objectUtil.mergeShapes(
2174
- // // this._def.shape(),
2175
- // // merging._def.shape()
2176
- // // );
2177
- // const merged: any = new ZodObject({
2178
- // unknownKeys: merging._def.unknownKeys,
2179
- // catchall: merging._def.catchall,
2180
- // shape: () =>
2181
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2182
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2183
- // }) as any;
2184
- // return merged;
2185
- // }
2186
- catchall(index) {
2187
- return new ZodObject({
2188
- ...this._def,
2189
- catchall: index,
2190
- });
2191
- }
2192
- pick(mask) {
2193
- const shape = {};
2194
- for (const key of util_js_1.util.objectKeys(mask)) {
2195
- if (mask[key] && this.shape[key]) {
2196
- shape[key] = this.shape[key];
2197
- }
2198
- }
2199
- return new ZodObject({
2200
- ...this._def,
2201
- shape: () => shape,
2202
- });
2203
- }
2204
- omit(mask) {
2205
- const shape = {};
2206
- for (const key of util_js_1.util.objectKeys(this.shape)) {
2207
- if (!mask[key]) {
2208
- shape[key] = this.shape[key];
2209
- }
2210
- }
2211
- return new ZodObject({
2212
- ...this._def,
2213
- shape: () => shape,
2214
- });
2215
- }
2216
- /**
2217
- * @deprecated
2218
- */
2219
- deepPartial() {
2220
- return deepPartialify(this);
2221
- }
2222
- partial(mask) {
2223
- const newShape = {};
2224
- for (const key of util_js_1.util.objectKeys(this.shape)) {
2225
- const fieldSchema = this.shape[key];
2226
- if (mask && !mask[key]) {
2227
- newShape[key] = fieldSchema;
2228
- }
2229
- else {
2230
- newShape[key] = fieldSchema.optional();
2231
- }
2232
- }
2233
- return new ZodObject({
2234
- ...this._def,
2235
- shape: () => newShape,
2236
- });
2237
- }
2238
- required(mask) {
2239
- const newShape = {};
2240
- for (const key of util_js_1.util.objectKeys(this.shape)) {
2241
- if (mask && !mask[key]) {
2242
- newShape[key] = this.shape[key];
2243
- }
2244
- else {
2245
- const fieldSchema = this.shape[key];
2246
- let newField = fieldSchema;
2247
- while (newField instanceof ZodOptional) {
2248
- newField = newField._def.innerType;
2249
- }
2250
- newShape[key] = newField;
2251
- }
2252
- }
2253
- return new ZodObject({
2254
- ...this._def,
2255
- shape: () => newShape,
2256
- });
2257
- }
2258
- keyof() {
2259
- return createZodEnum(util_js_1.util.objectKeys(this.shape));
2260
- }
2261
- }
2262
- exports.ZodObject = ZodObject;
2263
- ZodObject.create = (shape, params) => {
2264
- return new ZodObject({
2265
- shape: () => shape,
2266
- unknownKeys: "strip",
2267
- catchall: ZodNever.create(),
2268
- typeName: ZodFirstPartyTypeKind.ZodObject,
2269
- ...processCreateParams(params),
2270
- });
2271
- };
2272
- ZodObject.strictCreate = (shape, params) => {
2273
- return new ZodObject({
2274
- shape: () => shape,
2275
- unknownKeys: "strict",
2276
- catchall: ZodNever.create(),
2277
- typeName: ZodFirstPartyTypeKind.ZodObject,
2278
- ...processCreateParams(params),
2279
- });
2280
- };
2281
- ZodObject.lazycreate = (shape, params) => {
2282
- return new ZodObject({
2283
- shape,
2284
- unknownKeys: "strip",
2285
- catchall: ZodNever.create(),
2286
- typeName: ZodFirstPartyTypeKind.ZodObject,
2287
- ...processCreateParams(params),
2288
- });
2289
- };
2290
- class ZodUnion extends ZodType {
2291
- _parse(input) {
2292
- const { ctx } = this._processInputParams(input);
2293
- const options = this._def.options;
2294
- function handleResults(results) {
2295
- // return first issue-free validation if it exists
2296
- for (const result of results) {
2297
- if (result.result.status === "valid") {
2298
- return result.result;
2299
- }
2300
- }
2301
- for (const result of results) {
2302
- if (result.result.status === "dirty") {
2303
- // add issues from dirty option
2304
- ctx.common.issues.push(...result.ctx.common.issues);
2305
- return result.result;
2306
- }
2307
- }
2308
- // return invalid
2309
- const unionErrors = results.map((result) => new ZodError_js_1.ZodError(result.ctx.common.issues));
2310
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2311
- code: ZodError_js_1.ZodIssueCode.invalid_union,
2312
- unionErrors,
2313
- });
2314
- return parseUtil_js_1.INVALID;
2315
- }
2316
- if (ctx.common.async) {
2317
- return Promise.all(options.map(async (option) => {
2318
- const childCtx = {
2319
- ...ctx,
2320
- common: {
2321
- ...ctx.common,
2322
- issues: [],
2323
- },
2324
- parent: null,
2325
- };
2326
- return {
2327
- result: await option._parseAsync({
2328
- data: ctx.data,
2329
- path: ctx.path,
2330
- parent: childCtx,
2331
- }),
2332
- ctx: childCtx,
2333
- };
2334
- })).then(handleResults);
2335
- }
2336
- else {
2337
- let dirty = undefined;
2338
- const issues = [];
2339
- for (const option of options) {
2340
- const childCtx = {
2341
- ...ctx,
2342
- common: {
2343
- ...ctx.common,
2344
- issues: [],
2345
- },
2346
- parent: null,
2347
- };
2348
- const result = option._parseSync({
2349
- data: ctx.data,
2350
- path: ctx.path,
2351
- parent: childCtx,
2352
- });
2353
- if (result.status === "valid") {
2354
- return result;
2355
- }
2356
- else if (result.status === "dirty" && !dirty) {
2357
- dirty = { result, ctx: childCtx };
2358
- }
2359
- if (childCtx.common.issues.length) {
2360
- issues.push(childCtx.common.issues);
2361
- }
2362
- }
2363
- if (dirty) {
2364
- ctx.common.issues.push(...dirty.ctx.common.issues);
2365
- return dirty.result;
2366
- }
2367
- const unionErrors = issues.map((issues) => new ZodError_js_1.ZodError(issues));
2368
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2369
- code: ZodError_js_1.ZodIssueCode.invalid_union,
2370
- unionErrors,
2371
- });
2372
- return parseUtil_js_1.INVALID;
2373
- }
2374
- }
2375
- get options() {
2376
- return this._def.options;
2377
- }
2378
- }
2379
- exports.ZodUnion = ZodUnion;
2380
- ZodUnion.create = (types, params) => {
2381
- return new ZodUnion({
2382
- options: types,
2383
- typeName: ZodFirstPartyTypeKind.ZodUnion,
2384
- ...processCreateParams(params),
2385
- });
2386
- };
2387
- /////////////////////////////////////////////////////
2388
- /////////////////////////////////////////////////////
2389
- ////////// //////////
2390
- ////////// ZodDiscriminatedUnion //////////
2391
- ////////// //////////
2392
- /////////////////////////////////////////////////////
2393
- /////////////////////////////////////////////////////
2394
- const getDiscriminator = (type) => {
2395
- if (type instanceof ZodLazy) {
2396
- return getDiscriminator(type.schema);
2397
- }
2398
- else if (type instanceof ZodEffects) {
2399
- return getDiscriminator(type.innerType());
2400
- }
2401
- else if (type instanceof ZodLiteral) {
2402
- return [type.value];
2403
- }
2404
- else if (type instanceof ZodEnum) {
2405
- return type.options;
2406
- }
2407
- else if (type instanceof ZodNativeEnum) {
2408
- // eslint-disable-next-line ban/ban
2409
- return util_js_1.util.objectValues(type.enum);
2410
- }
2411
- else if (type instanceof ZodDefault) {
2412
- return getDiscriminator(type._def.innerType);
2413
- }
2414
- else if (type instanceof ZodUndefined) {
2415
- return [undefined];
2416
- }
2417
- else if (type instanceof ZodNull) {
2418
- return [null];
2419
- }
2420
- else if (type instanceof ZodOptional) {
2421
- return [undefined, ...getDiscriminator(type.unwrap())];
2422
- }
2423
- else if (type instanceof ZodNullable) {
2424
- return [null, ...getDiscriminator(type.unwrap())];
2425
- }
2426
- else if (type instanceof ZodBranded) {
2427
- return getDiscriminator(type.unwrap());
2428
- }
2429
- else if (type instanceof ZodReadonly) {
2430
- return getDiscriminator(type.unwrap());
2431
- }
2432
- else if (type instanceof ZodCatch) {
2433
- return getDiscriminator(type._def.innerType);
2434
- }
2435
- else {
2436
- return [];
2437
- }
2438
- };
2439
- class ZodDiscriminatedUnion extends ZodType {
2440
- _parse(input) {
2441
- const { ctx } = this._processInputParams(input);
2442
- if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
2443
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2444
- code: ZodError_js_1.ZodIssueCode.invalid_type,
2445
- expected: util_js_1.ZodParsedType.object,
2446
- received: ctx.parsedType,
2447
- });
2448
- return parseUtil_js_1.INVALID;
2449
- }
2450
- const discriminator = this.discriminator;
2451
- const discriminatorValue = ctx.data[discriminator];
2452
- const option = this.optionsMap.get(discriminatorValue);
2453
- if (!option) {
2454
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2455
- code: ZodError_js_1.ZodIssueCode.invalid_union_discriminator,
2456
- options: Array.from(this.optionsMap.keys()),
2457
- path: [discriminator],
2458
- });
2459
- return parseUtil_js_1.INVALID;
2460
- }
2461
- if (ctx.common.async) {
2462
- return option._parseAsync({
2463
- data: ctx.data,
2464
- path: ctx.path,
2465
- parent: ctx,
2466
- });
2467
- }
2468
- else {
2469
- return option._parseSync({
2470
- data: ctx.data,
2471
- path: ctx.path,
2472
- parent: ctx,
2473
- });
2474
- }
2475
- }
2476
- get discriminator() {
2477
- return this._def.discriminator;
2478
- }
2479
- get options() {
2480
- return this._def.options;
2481
- }
2482
- get optionsMap() {
2483
- return this._def.optionsMap;
2484
- }
2485
- /**
2486
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2487
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2488
- * have a different value for each object in the union.
2489
- * @param discriminator the name of the discriminator property
2490
- * @param types an array of object schemas
2491
- * @param params
2492
- */
2493
- static create(discriminator, options, params) {
2494
- // Get all the valid discriminator values
2495
- const optionsMap = new Map();
2496
- // try {
2497
- for (const type of options) {
2498
- const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2499
- if (!discriminatorValues.length) {
2500
- throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2501
- }
2502
- for (const value of discriminatorValues) {
2503
- if (optionsMap.has(value)) {
2504
- throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2505
- }
2506
- optionsMap.set(value, type);
2507
- }
2508
- }
2509
- return new ZodDiscriminatedUnion({
2510
- typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2511
- discriminator,
2512
- options,
2513
- optionsMap,
2514
- ...processCreateParams(params),
2515
- });
2516
- }
2517
- }
2518
- exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
2519
- function mergeValues(a, b) {
2520
- const aType = (0, util_js_1.getParsedType)(a);
2521
- const bType = (0, util_js_1.getParsedType)(b);
2522
- if (a === b) {
2523
- return { valid: true, data: a };
2524
- }
2525
- else if (aType === util_js_1.ZodParsedType.object && bType === util_js_1.ZodParsedType.object) {
2526
- const bKeys = util_js_1.util.objectKeys(b);
2527
- const sharedKeys = util_js_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2528
- const newObj = { ...a, ...b };
2529
- for (const key of sharedKeys) {
2530
- const sharedValue = mergeValues(a[key], b[key]);
2531
- if (!sharedValue.valid) {
2532
- return { valid: false };
2533
- }
2534
- newObj[key] = sharedValue.data;
2535
- }
2536
- return { valid: true, data: newObj };
2537
- }
2538
- else if (aType === util_js_1.ZodParsedType.array && bType === util_js_1.ZodParsedType.array) {
2539
- if (a.length !== b.length) {
2540
- return { valid: false };
2541
- }
2542
- const newArray = [];
2543
- for (let index = 0; index < a.length; index++) {
2544
- const itemA = a[index];
2545
- const itemB = b[index];
2546
- const sharedValue = mergeValues(itemA, itemB);
2547
- if (!sharedValue.valid) {
2548
- return { valid: false };
2549
- }
2550
- newArray.push(sharedValue.data);
2551
- }
2552
- return { valid: true, data: newArray };
2553
- }
2554
- else if (aType === util_js_1.ZodParsedType.date && bType === util_js_1.ZodParsedType.date && +a === +b) {
2555
- return { valid: true, data: a };
2556
- }
2557
- else {
2558
- return { valid: false };
2559
- }
2560
- }
2561
- class ZodIntersection extends ZodType {
2562
- _parse(input) {
2563
- const { status, ctx } = this._processInputParams(input);
2564
- const handleParsed = (parsedLeft, parsedRight) => {
2565
- if ((0, parseUtil_js_1.isAborted)(parsedLeft) || (0, parseUtil_js_1.isAborted)(parsedRight)) {
2566
- return parseUtil_js_1.INVALID;
2567
- }
2568
- const merged = mergeValues(parsedLeft.value, parsedRight.value);
2569
- if (!merged.valid) {
2570
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2571
- code: ZodError_js_1.ZodIssueCode.invalid_intersection_types,
2572
- });
2573
- return parseUtil_js_1.INVALID;
2574
- }
2575
- if ((0, parseUtil_js_1.isDirty)(parsedLeft) || (0, parseUtil_js_1.isDirty)(parsedRight)) {
2576
- status.dirty();
2577
- }
2578
- return { status: status.value, value: merged.data };
2579
- };
2580
- if (ctx.common.async) {
2581
- return Promise.all([
2582
- this._def.left._parseAsync({
2583
- data: ctx.data,
2584
- path: ctx.path,
2585
- parent: ctx,
2586
- }),
2587
- this._def.right._parseAsync({
2588
- data: ctx.data,
2589
- path: ctx.path,
2590
- parent: ctx,
2591
- }),
2592
- ]).then(([left, right]) => handleParsed(left, right));
2593
- }
2594
- else {
2595
- return handleParsed(this._def.left._parseSync({
2596
- data: ctx.data,
2597
- path: ctx.path,
2598
- parent: ctx,
2599
- }), this._def.right._parseSync({
2600
- data: ctx.data,
2601
- path: ctx.path,
2602
- parent: ctx,
2603
- }));
2604
- }
2605
- }
2606
- }
2607
- exports.ZodIntersection = ZodIntersection;
2608
- ZodIntersection.create = (left, right, params) => {
2609
- return new ZodIntersection({
2610
- left: left,
2611
- right: right,
2612
- typeName: ZodFirstPartyTypeKind.ZodIntersection,
2613
- ...processCreateParams(params),
2614
- });
2615
- };
2616
- // type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
2617
- class ZodTuple extends ZodType {
2618
- _parse(input) {
2619
- const { status, ctx } = this._processInputParams(input);
2620
- if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
2621
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2622
- code: ZodError_js_1.ZodIssueCode.invalid_type,
2623
- expected: util_js_1.ZodParsedType.array,
2624
- received: ctx.parsedType,
2625
- });
2626
- return parseUtil_js_1.INVALID;
2627
- }
2628
- if (ctx.data.length < this._def.items.length) {
2629
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2630
- code: ZodError_js_1.ZodIssueCode.too_small,
2631
- minimum: this._def.items.length,
2632
- inclusive: true,
2633
- exact: false,
2634
- type: "array",
2635
- });
2636
- return parseUtil_js_1.INVALID;
2637
- }
2638
- const rest = this._def.rest;
2639
- if (!rest && ctx.data.length > this._def.items.length) {
2640
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2641
- code: ZodError_js_1.ZodIssueCode.too_big,
2642
- maximum: this._def.items.length,
2643
- inclusive: true,
2644
- exact: false,
2645
- type: "array",
2646
- });
2647
- status.dirty();
2648
- }
2649
- const items = [...ctx.data]
2650
- .map((item, itemIndex) => {
2651
- const schema = this._def.items[itemIndex] || this._def.rest;
2652
- if (!schema)
2653
- return null;
2654
- return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2655
- })
2656
- .filter((x) => !!x); // filter nulls
2657
- if (ctx.common.async) {
2658
- return Promise.all(items).then((results) => {
2659
- return parseUtil_js_1.ParseStatus.mergeArray(status, results);
2660
- });
2661
- }
2662
- else {
2663
- return parseUtil_js_1.ParseStatus.mergeArray(status, items);
2664
- }
2665
- }
2666
- get items() {
2667
- return this._def.items;
2668
- }
2669
- rest(rest) {
2670
- return new ZodTuple({
2671
- ...this._def,
2672
- rest,
2673
- });
2674
- }
2675
- }
2676
- exports.ZodTuple = ZodTuple;
2677
- ZodTuple.create = (schemas, params) => {
2678
- if (!Array.isArray(schemas)) {
2679
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2680
- }
2681
- return new ZodTuple({
2682
- items: schemas,
2683
- typeName: ZodFirstPartyTypeKind.ZodTuple,
2684
- rest: null,
2685
- ...processCreateParams(params),
2686
- });
2687
- };
2688
- class ZodRecord extends ZodType {
2689
- get keySchema() {
2690
- return this._def.keyType;
2691
- }
2692
- get valueSchema() {
2693
- return this._def.valueType;
2694
- }
2695
- _parse(input) {
2696
- const { status, ctx } = this._processInputParams(input);
2697
- if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
2698
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2699
- code: ZodError_js_1.ZodIssueCode.invalid_type,
2700
- expected: util_js_1.ZodParsedType.object,
2701
- received: ctx.parsedType,
2702
- });
2703
- return parseUtil_js_1.INVALID;
2704
- }
2705
- const pairs = [];
2706
- const keyType = this._def.keyType;
2707
- const valueType = this._def.valueType;
2708
- for (const key in ctx.data) {
2709
- pairs.push({
2710
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2711
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2712
- alwaysSet: key in ctx.data,
2713
- });
2714
- }
2715
- if (ctx.common.async) {
2716
- return parseUtil_js_1.ParseStatus.mergeObjectAsync(status, pairs);
2717
- }
2718
- else {
2719
- return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
2720
- }
2721
- }
2722
- get element() {
2723
- return this._def.valueType;
2724
- }
2725
- static create(first, second, third) {
2726
- if (second instanceof ZodType) {
2727
- return new ZodRecord({
2728
- keyType: first,
2729
- valueType: second,
2730
- typeName: ZodFirstPartyTypeKind.ZodRecord,
2731
- ...processCreateParams(third),
2732
- });
2733
- }
2734
- return new ZodRecord({
2735
- keyType: ZodString.create(),
2736
- valueType: first,
2737
- typeName: ZodFirstPartyTypeKind.ZodRecord,
2738
- ...processCreateParams(second),
2739
- });
2740
- }
2741
- }
2742
- exports.ZodRecord = ZodRecord;
2743
- class ZodMap extends ZodType {
2744
- get keySchema() {
2745
- return this._def.keyType;
2746
- }
2747
- get valueSchema() {
2748
- return this._def.valueType;
2749
- }
2750
- _parse(input) {
2751
- const { status, ctx } = this._processInputParams(input);
2752
- if (ctx.parsedType !== util_js_1.ZodParsedType.map) {
2753
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2754
- code: ZodError_js_1.ZodIssueCode.invalid_type,
2755
- expected: util_js_1.ZodParsedType.map,
2756
- received: ctx.parsedType,
2757
- });
2758
- return parseUtil_js_1.INVALID;
2759
- }
2760
- const keyType = this._def.keyType;
2761
- const valueType = this._def.valueType;
2762
- const pairs = [...ctx.data.entries()].map(([key, value], index) => {
2763
- return {
2764
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2765
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])),
2766
- };
2767
- });
2768
- if (ctx.common.async) {
2769
- const finalMap = new Map();
2770
- return Promise.resolve().then(async () => {
2771
- for (const pair of pairs) {
2772
- const key = await pair.key;
2773
- const value = await pair.value;
2774
- if (key.status === "aborted" || value.status === "aborted") {
2775
- return parseUtil_js_1.INVALID;
2776
- }
2777
- if (key.status === "dirty" || value.status === "dirty") {
2778
- status.dirty();
2779
- }
2780
- finalMap.set(key.value, value.value);
2781
- }
2782
- return { status: status.value, value: finalMap };
2783
- });
2784
- }
2785
- else {
2786
- const finalMap = new Map();
2787
- for (const pair of pairs) {
2788
- const key = pair.key;
2789
- const value = pair.value;
2790
- if (key.status === "aborted" || value.status === "aborted") {
2791
- return parseUtil_js_1.INVALID;
2792
- }
2793
- if (key.status === "dirty" || value.status === "dirty") {
2794
- status.dirty();
2795
- }
2796
- finalMap.set(key.value, value.value);
2797
- }
2798
- return { status: status.value, value: finalMap };
2799
- }
2800
- }
2801
- }
2802
- exports.ZodMap = ZodMap;
2803
- ZodMap.create = (keyType, valueType, params) => {
2804
- return new ZodMap({
2805
- valueType,
2806
- keyType,
2807
- typeName: ZodFirstPartyTypeKind.ZodMap,
2808
- ...processCreateParams(params),
2809
- });
2810
- };
2811
- class ZodSet extends ZodType {
2812
- _parse(input) {
2813
- const { status, ctx } = this._processInputParams(input);
2814
- if (ctx.parsedType !== util_js_1.ZodParsedType.set) {
2815
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2816
- code: ZodError_js_1.ZodIssueCode.invalid_type,
2817
- expected: util_js_1.ZodParsedType.set,
2818
- received: ctx.parsedType,
2819
- });
2820
- return parseUtil_js_1.INVALID;
2821
- }
2822
- const def = this._def;
2823
- if (def.minSize !== null) {
2824
- if (ctx.data.size < def.minSize.value) {
2825
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2826
- code: ZodError_js_1.ZodIssueCode.too_small,
2827
- minimum: def.minSize.value,
2828
- type: "set",
2829
- inclusive: true,
2830
- exact: false,
2831
- message: def.minSize.message,
2832
- });
2833
- status.dirty();
2834
- }
2835
- }
2836
- if (def.maxSize !== null) {
2837
- if (ctx.data.size > def.maxSize.value) {
2838
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2839
- code: ZodError_js_1.ZodIssueCode.too_big,
2840
- maximum: def.maxSize.value,
2841
- type: "set",
2842
- inclusive: true,
2843
- exact: false,
2844
- message: def.maxSize.message,
2845
- });
2846
- status.dirty();
2847
- }
2848
- }
2849
- const valueType = this._def.valueType;
2850
- function finalizeSet(elements) {
2851
- const parsedSet = new Set();
2852
- for (const element of elements) {
2853
- if (element.status === "aborted")
2854
- return parseUtil_js_1.INVALID;
2855
- if (element.status === "dirty")
2856
- status.dirty();
2857
- parsedSet.add(element.value);
2858
- }
2859
- return { status: status.value, value: parsedSet };
2860
- }
2861
- const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2862
- if (ctx.common.async) {
2863
- return Promise.all(elements).then((elements) => finalizeSet(elements));
2864
- }
2865
- else {
2866
- return finalizeSet(elements);
2867
- }
2868
- }
2869
- min(minSize, message) {
2870
- return new ZodSet({
2871
- ...this._def,
2872
- minSize: { value: minSize, message: errorUtil_js_1.errorUtil.toString(message) },
2873
- });
2874
- }
2875
- max(maxSize, message) {
2876
- return new ZodSet({
2877
- ...this._def,
2878
- maxSize: { value: maxSize, message: errorUtil_js_1.errorUtil.toString(message) },
2879
- });
2880
- }
2881
- size(size, message) {
2882
- return this.min(size, message).max(size, message);
2883
- }
2884
- nonempty(message) {
2885
- return this.min(1, message);
2886
- }
2887
- }
2888
- exports.ZodSet = ZodSet;
2889
- ZodSet.create = (valueType, params) => {
2890
- return new ZodSet({
2891
- valueType,
2892
- minSize: null,
2893
- maxSize: null,
2894
- typeName: ZodFirstPartyTypeKind.ZodSet,
2895
- ...processCreateParams(params),
2896
- });
2897
- };
2898
- class ZodFunction extends ZodType {
2899
- constructor() {
2900
- super(...arguments);
2901
- this.validate = this.implement;
2902
- }
2903
- _parse(input) {
2904
- const { ctx } = this._processInputParams(input);
2905
- if (ctx.parsedType !== util_js_1.ZodParsedType.function) {
2906
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
2907
- code: ZodError_js_1.ZodIssueCode.invalid_type,
2908
- expected: util_js_1.ZodParsedType.function,
2909
- received: ctx.parsedType,
2910
- });
2911
- return parseUtil_js_1.INVALID;
2912
- }
2913
- function makeArgsIssue(args, error) {
2914
- return (0, parseUtil_js_1.makeIssue)({
2915
- data: args,
2916
- path: ctx.path,
2917
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
2918
- issueData: {
2919
- code: ZodError_js_1.ZodIssueCode.invalid_arguments,
2920
- argumentsError: error,
2921
- },
2922
- });
2923
- }
2924
- function makeReturnsIssue(returns, error) {
2925
- return (0, parseUtil_js_1.makeIssue)({
2926
- data: returns,
2927
- path: ctx.path,
2928
- errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
2929
- issueData: {
2930
- code: ZodError_js_1.ZodIssueCode.invalid_return_type,
2931
- returnTypeError: error,
2932
- },
2933
- });
2934
- }
2935
- const params = { errorMap: ctx.common.contextualErrorMap };
2936
- const fn = ctx.data;
2937
- if (this._def.returns instanceof ZodPromise) {
2938
- // Would love a way to avoid disabling this rule, but we need
2939
- // an alias (using an arrow function was what caused 2651).
2940
- // eslint-disable-next-line @typescript-eslint/no-this-alias
2941
- const me = this;
2942
- return (0, parseUtil_js_1.OK)(async function (...args) {
2943
- const error = new ZodError_js_1.ZodError([]);
2944
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2945
- error.addIssue(makeArgsIssue(args, e));
2946
- throw error;
2947
- });
2948
- const result = await Reflect.apply(fn, this, parsedArgs);
2949
- const parsedReturns = await me._def.returns._def.type
2950
- .parseAsync(result, params)
2951
- .catch((e) => {
2952
- error.addIssue(makeReturnsIssue(result, e));
2953
- throw error;
2954
- });
2955
- return parsedReturns;
2956
- });
2957
- }
2958
- else {
2959
- // Would love a way to avoid disabling this rule, but we need
2960
- // an alias (using an arrow function was what caused 2651).
2961
- // eslint-disable-next-line @typescript-eslint/no-this-alias
2962
- const me = this;
2963
- return (0, parseUtil_js_1.OK)(function (...args) {
2964
- const parsedArgs = me._def.args.safeParse(args, params);
2965
- if (!parsedArgs.success) {
2966
- throw new ZodError_js_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
2967
- }
2968
- const result = Reflect.apply(fn, this, parsedArgs.data);
2969
- const parsedReturns = me._def.returns.safeParse(result, params);
2970
- if (!parsedReturns.success) {
2971
- throw new ZodError_js_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2972
- }
2973
- return parsedReturns.data;
2974
- });
2975
- }
2976
- }
2977
- parameters() {
2978
- return this._def.args;
2979
- }
2980
- returnType() {
2981
- return this._def.returns;
2982
- }
2983
- args(...items) {
2984
- return new ZodFunction({
2985
- ...this._def,
2986
- args: ZodTuple.create(items).rest(ZodUnknown.create()),
2987
- });
2988
- }
2989
- returns(returnType) {
2990
- return new ZodFunction({
2991
- ...this._def,
2992
- returns: returnType,
2993
- });
2994
- }
2995
- implement(func) {
2996
- const validatedFunc = this.parse(func);
2997
- return validatedFunc;
2998
- }
2999
- strictImplement(func) {
3000
- const validatedFunc = this.parse(func);
3001
- return validatedFunc;
3002
- }
3003
- static create(args, returns, params) {
3004
- return new ZodFunction({
3005
- args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
3006
- returns: returns || ZodUnknown.create(),
3007
- typeName: ZodFirstPartyTypeKind.ZodFunction,
3008
- ...processCreateParams(params),
3009
- });
3010
- }
3011
- }
3012
- exports.ZodFunction = ZodFunction;
3013
- class ZodLazy extends ZodType {
3014
- get schema() {
3015
- return this._def.getter();
3016
- }
3017
- _parse(input) {
3018
- const { ctx } = this._processInputParams(input);
3019
- const lazySchema = this._def.getter();
3020
- return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3021
- }
3022
- }
3023
- exports.ZodLazy = ZodLazy;
3024
- ZodLazy.create = (getter, params) => {
3025
- return new ZodLazy({
3026
- getter: getter,
3027
- typeName: ZodFirstPartyTypeKind.ZodLazy,
3028
- ...processCreateParams(params),
3029
- });
3030
- };
3031
- class ZodLiteral extends ZodType {
3032
- _parse(input) {
3033
- if (input.data !== this._def.value) {
3034
- const ctx = this._getOrReturnCtx(input);
3035
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3036
- received: ctx.data,
3037
- code: ZodError_js_1.ZodIssueCode.invalid_literal,
3038
- expected: this._def.value,
3039
- });
3040
- return parseUtil_js_1.INVALID;
3041
- }
3042
- return { status: "valid", value: input.data };
3043
- }
3044
- get value() {
3045
- return this._def.value;
3046
- }
3047
- }
3048
- exports.ZodLiteral = ZodLiteral;
3049
- ZodLiteral.create = (value, params) => {
3050
- return new ZodLiteral({
3051
- value: value,
3052
- typeName: ZodFirstPartyTypeKind.ZodLiteral,
3053
- ...processCreateParams(params),
3054
- });
3055
- };
3056
- function createZodEnum(values, params) {
3057
- return new ZodEnum({
3058
- values,
3059
- typeName: ZodFirstPartyTypeKind.ZodEnum,
3060
- ...processCreateParams(params),
3061
- });
3062
- }
3063
- class ZodEnum extends ZodType {
3064
- _parse(input) {
3065
- if (typeof input.data !== "string") {
3066
- const ctx = this._getOrReturnCtx(input);
3067
- const expectedValues = this._def.values;
3068
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3069
- expected: util_js_1.util.joinValues(expectedValues),
3070
- received: ctx.parsedType,
3071
- code: ZodError_js_1.ZodIssueCode.invalid_type,
3072
- });
3073
- return parseUtil_js_1.INVALID;
3074
- }
3075
- if (!this._cache) {
3076
- this._cache = new Set(this._def.values);
3077
- }
3078
- if (!this._cache.has(input.data)) {
3079
- const ctx = this._getOrReturnCtx(input);
3080
- const expectedValues = this._def.values;
3081
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3082
- received: ctx.data,
3083
- code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3084
- options: expectedValues,
3085
- });
3086
- return parseUtil_js_1.INVALID;
3087
- }
3088
- return (0, parseUtil_js_1.OK)(input.data);
3089
- }
3090
- get options() {
3091
- return this._def.values;
3092
- }
3093
- get enum() {
3094
- const enumValues = {};
3095
- for (const val of this._def.values) {
3096
- enumValues[val] = val;
3097
- }
3098
- return enumValues;
3099
- }
3100
- get Values() {
3101
- const enumValues = {};
3102
- for (const val of this._def.values) {
3103
- enumValues[val] = val;
3104
- }
3105
- return enumValues;
3106
- }
3107
- get Enum() {
3108
- const enumValues = {};
3109
- for (const val of this._def.values) {
3110
- enumValues[val] = val;
3111
- }
3112
- return enumValues;
3113
- }
3114
- extract(values, newDef = this._def) {
3115
- return ZodEnum.create(values, {
3116
- ...this._def,
3117
- ...newDef,
3118
- });
3119
- }
3120
- exclude(values, newDef = this._def) {
3121
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3122
- ...this._def,
3123
- ...newDef,
3124
- });
3125
- }
3126
- }
3127
- exports.ZodEnum = ZodEnum;
3128
- ZodEnum.create = createZodEnum;
3129
- class ZodNativeEnum extends ZodType {
3130
- _parse(input) {
3131
- const nativeEnumValues = util_js_1.util.getValidEnumValues(this._def.values);
3132
- const ctx = this._getOrReturnCtx(input);
3133
- if (ctx.parsedType !== util_js_1.ZodParsedType.string && ctx.parsedType !== util_js_1.ZodParsedType.number) {
3134
- const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3135
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3136
- expected: util_js_1.util.joinValues(expectedValues),
3137
- received: ctx.parsedType,
3138
- code: ZodError_js_1.ZodIssueCode.invalid_type,
3139
- });
3140
- return parseUtil_js_1.INVALID;
3141
- }
3142
- if (!this._cache) {
3143
- this._cache = new Set(util_js_1.util.getValidEnumValues(this._def.values));
3144
- }
3145
- if (!this._cache.has(input.data)) {
3146
- const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
3147
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3148
- received: ctx.data,
3149
- code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
3150
- options: expectedValues,
3151
- });
3152
- return parseUtil_js_1.INVALID;
3153
- }
3154
- return (0, parseUtil_js_1.OK)(input.data);
3155
- }
3156
- get enum() {
3157
- return this._def.values;
3158
- }
3159
- }
3160
- exports.ZodNativeEnum = ZodNativeEnum;
3161
- ZodNativeEnum.create = (values, params) => {
3162
- return new ZodNativeEnum({
3163
- values: values,
3164
- typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3165
- ...processCreateParams(params),
3166
- });
3167
- };
3168
- class ZodPromise extends ZodType {
3169
- unwrap() {
3170
- return this._def.type;
3171
- }
3172
- _parse(input) {
3173
- const { ctx } = this._processInputParams(input);
3174
- if (ctx.parsedType !== util_js_1.ZodParsedType.promise && ctx.common.async === false) {
3175
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3176
- code: ZodError_js_1.ZodIssueCode.invalid_type,
3177
- expected: util_js_1.ZodParsedType.promise,
3178
- received: ctx.parsedType,
3179
- });
3180
- return parseUtil_js_1.INVALID;
3181
- }
3182
- const promisified = ctx.parsedType === util_js_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3183
- return (0, parseUtil_js_1.OK)(promisified.then((data) => {
3184
- return this._def.type.parseAsync(data, {
3185
- path: ctx.path,
3186
- errorMap: ctx.common.contextualErrorMap,
3187
- });
3188
- }));
3189
- }
3190
- }
3191
- exports.ZodPromise = ZodPromise;
3192
- ZodPromise.create = (schema, params) => {
3193
- return new ZodPromise({
3194
- type: schema,
3195
- typeName: ZodFirstPartyTypeKind.ZodPromise,
3196
- ...processCreateParams(params),
3197
- });
3198
- };
3199
- class ZodEffects extends ZodType {
3200
- innerType() {
3201
- return this._def.schema;
3202
- }
3203
- sourceType() {
3204
- return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects
3205
- ? this._def.schema.sourceType()
3206
- : this._def.schema;
3207
- }
3208
- _parse(input) {
3209
- const { status, ctx } = this._processInputParams(input);
3210
- const effect = this._def.effect || null;
3211
- const checkCtx = {
3212
- addIssue: (arg) => {
3213
- (0, parseUtil_js_1.addIssueToContext)(ctx, arg);
3214
- if (arg.fatal) {
3215
- status.abort();
3216
- }
3217
- else {
3218
- status.dirty();
3219
- }
3220
- },
3221
- get path() {
3222
- return ctx.path;
3223
- },
3224
- };
3225
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3226
- if (effect.type === "preprocess") {
3227
- const processed = effect.transform(ctx.data, checkCtx);
3228
- if (ctx.common.async) {
3229
- return Promise.resolve(processed).then(async (processed) => {
3230
- if (status.value === "aborted")
3231
- return parseUtil_js_1.INVALID;
3232
- const result = await this._def.schema._parseAsync({
3233
- data: processed,
3234
- path: ctx.path,
3235
- parent: ctx,
3236
- });
3237
- if (result.status === "aborted")
3238
- return parseUtil_js_1.INVALID;
3239
- if (result.status === "dirty")
3240
- return (0, parseUtil_js_1.DIRTY)(result.value);
3241
- if (status.value === "dirty")
3242
- return (0, parseUtil_js_1.DIRTY)(result.value);
3243
- return result;
3244
- });
3245
- }
3246
- else {
3247
- if (status.value === "aborted")
3248
- return parseUtil_js_1.INVALID;
3249
- const result = this._def.schema._parseSync({
3250
- data: processed,
3251
- path: ctx.path,
3252
- parent: ctx,
3253
- });
3254
- if (result.status === "aborted")
3255
- return parseUtil_js_1.INVALID;
3256
- if (result.status === "dirty")
3257
- return (0, parseUtil_js_1.DIRTY)(result.value);
3258
- if (status.value === "dirty")
3259
- return (0, parseUtil_js_1.DIRTY)(result.value);
3260
- return result;
3261
- }
3262
- }
3263
- if (effect.type === "refinement") {
3264
- const executeRefinement = (acc) => {
3265
- const result = effect.refinement(acc, checkCtx);
3266
- if (ctx.common.async) {
3267
- return Promise.resolve(result);
3268
- }
3269
- if (result instanceof Promise) {
3270
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3271
- }
3272
- return acc;
3273
- };
3274
- if (ctx.common.async === false) {
3275
- const inner = this._def.schema._parseSync({
3276
- data: ctx.data,
3277
- path: ctx.path,
3278
- parent: ctx,
3279
- });
3280
- if (inner.status === "aborted")
3281
- return parseUtil_js_1.INVALID;
3282
- if (inner.status === "dirty")
3283
- status.dirty();
3284
- // return value is ignored
3285
- executeRefinement(inner.value);
3286
- return { status: status.value, value: inner.value };
3287
- }
3288
- else {
3289
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3290
- if (inner.status === "aborted")
3291
- return parseUtil_js_1.INVALID;
3292
- if (inner.status === "dirty")
3293
- status.dirty();
3294
- return executeRefinement(inner.value).then(() => {
3295
- return { status: status.value, value: inner.value };
3296
- });
3297
- });
3298
- }
3299
- }
3300
- if (effect.type === "transform") {
3301
- if (ctx.common.async === false) {
3302
- const base = this._def.schema._parseSync({
3303
- data: ctx.data,
3304
- path: ctx.path,
3305
- parent: ctx,
3306
- });
3307
- if (!(0, parseUtil_js_1.isValid)(base))
3308
- return parseUtil_js_1.INVALID;
3309
- const result = effect.transform(base.value, checkCtx);
3310
- if (result instanceof Promise) {
3311
- throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3312
- }
3313
- return { status: status.value, value: result };
3314
- }
3315
- else {
3316
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3317
- if (!(0, parseUtil_js_1.isValid)(base))
3318
- return parseUtil_js_1.INVALID;
3319
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3320
- status: status.value,
3321
- value: result,
3322
- }));
3323
- });
3324
- }
3325
- }
3326
- util_js_1.util.assertNever(effect);
3327
- }
3328
- }
3329
- exports.ZodEffects = ZodEffects;
3330
- exports.ZodTransformer = ZodEffects;
3331
- ZodEffects.create = (schema, effect, params) => {
3332
- return new ZodEffects({
3333
- schema,
3334
- typeName: ZodFirstPartyTypeKind.ZodEffects,
3335
- effect,
3336
- ...processCreateParams(params),
3337
- });
3338
- };
3339
- ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3340
- return new ZodEffects({
3341
- schema,
3342
- effect: { type: "preprocess", transform: preprocess },
3343
- typeName: ZodFirstPartyTypeKind.ZodEffects,
3344
- ...processCreateParams(params),
3345
- });
3346
- };
3347
- class ZodOptional extends ZodType {
3348
- _parse(input) {
3349
- const parsedType = this._getType(input);
3350
- if (parsedType === util_js_1.ZodParsedType.undefined) {
3351
- return (0, parseUtil_js_1.OK)(undefined);
3352
- }
3353
- return this._def.innerType._parse(input);
3354
- }
3355
- unwrap() {
3356
- return this._def.innerType;
3357
- }
3358
- }
3359
- exports.ZodOptional = ZodOptional;
3360
- ZodOptional.create = (type, params) => {
3361
- return new ZodOptional({
3362
- innerType: type,
3363
- typeName: ZodFirstPartyTypeKind.ZodOptional,
3364
- ...processCreateParams(params),
3365
- });
3366
- };
3367
- class ZodNullable extends ZodType {
3368
- _parse(input) {
3369
- const parsedType = this._getType(input);
3370
- if (parsedType === util_js_1.ZodParsedType.null) {
3371
- return (0, parseUtil_js_1.OK)(null);
3372
- }
3373
- return this._def.innerType._parse(input);
3374
- }
3375
- unwrap() {
3376
- return this._def.innerType;
3377
- }
3378
- }
3379
- exports.ZodNullable = ZodNullable;
3380
- ZodNullable.create = (type, params) => {
3381
- return new ZodNullable({
3382
- innerType: type,
3383
- typeName: ZodFirstPartyTypeKind.ZodNullable,
3384
- ...processCreateParams(params),
3385
- });
3386
- };
3387
- class ZodDefault extends ZodType {
3388
- _parse(input) {
3389
- const { ctx } = this._processInputParams(input);
3390
- let data = ctx.data;
3391
- if (ctx.parsedType === util_js_1.ZodParsedType.undefined) {
3392
- data = this._def.defaultValue();
3393
- }
3394
- return this._def.innerType._parse({
3395
- data,
3396
- path: ctx.path,
3397
- parent: ctx,
3398
- });
3399
- }
3400
- removeDefault() {
3401
- return this._def.innerType;
3402
- }
3403
- }
3404
- exports.ZodDefault = ZodDefault;
3405
- ZodDefault.create = (type, params) => {
3406
- return new ZodDefault({
3407
- innerType: type,
3408
- typeName: ZodFirstPartyTypeKind.ZodDefault,
3409
- defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3410
- ...processCreateParams(params),
3411
- });
3412
- };
3413
- class ZodCatch extends ZodType {
3414
- _parse(input) {
3415
- const { ctx } = this._processInputParams(input);
3416
- // newCtx is used to not collect issues from inner types in ctx
3417
- const newCtx = {
3418
- ...ctx,
3419
- common: {
3420
- ...ctx.common,
3421
- issues: [],
3422
- },
3423
- };
3424
- const result = this._def.innerType._parse({
3425
- data: newCtx.data,
3426
- path: newCtx.path,
3427
- parent: {
3428
- ...newCtx,
3429
- },
3430
- });
3431
- if ((0, parseUtil_js_1.isAsync)(result)) {
3432
- return result.then((result) => {
3433
- return {
3434
- status: "valid",
3435
- value: result.status === "valid"
3436
- ? result.value
3437
- : this._def.catchValue({
3438
- get error() {
3439
- return new ZodError_js_1.ZodError(newCtx.common.issues);
3440
- },
3441
- input: newCtx.data,
3442
- }),
3443
- };
3444
- });
3445
- }
3446
- else {
3447
- return {
3448
- status: "valid",
3449
- value: result.status === "valid"
3450
- ? result.value
3451
- : this._def.catchValue({
3452
- get error() {
3453
- return new ZodError_js_1.ZodError(newCtx.common.issues);
3454
- },
3455
- input: newCtx.data,
3456
- }),
3457
- };
3458
- }
3459
- }
3460
- removeCatch() {
3461
- return this._def.innerType;
3462
- }
3463
- }
3464
- exports.ZodCatch = ZodCatch;
3465
- ZodCatch.create = (type, params) => {
3466
- return new ZodCatch({
3467
- innerType: type,
3468
- typeName: ZodFirstPartyTypeKind.ZodCatch,
3469
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3470
- ...processCreateParams(params),
3471
- });
3472
- };
3473
- class ZodNaN extends ZodType {
3474
- _parse(input) {
3475
- const parsedType = this._getType(input);
3476
- if (parsedType !== util_js_1.ZodParsedType.nan) {
3477
- const ctx = this._getOrReturnCtx(input);
3478
- (0, parseUtil_js_1.addIssueToContext)(ctx, {
3479
- code: ZodError_js_1.ZodIssueCode.invalid_type,
3480
- expected: util_js_1.ZodParsedType.nan,
3481
- received: ctx.parsedType,
3482
- });
3483
- return parseUtil_js_1.INVALID;
3484
- }
3485
- return { status: "valid", value: input.data };
3486
- }
3487
- }
3488
- exports.ZodNaN = ZodNaN;
3489
- ZodNaN.create = (params) => {
3490
- return new ZodNaN({
3491
- typeName: ZodFirstPartyTypeKind.ZodNaN,
3492
- ...processCreateParams(params),
3493
- });
3494
- };
3495
- exports.BRAND = Symbol("zod_brand");
3496
- class ZodBranded extends ZodType {
3497
- _parse(input) {
3498
- const { ctx } = this._processInputParams(input);
3499
- const data = ctx.data;
3500
- return this._def.type._parse({
3501
- data,
3502
- path: ctx.path,
3503
- parent: ctx,
3504
- });
3505
- }
3506
- unwrap() {
3507
- return this._def.type;
3508
- }
3509
- }
3510
- exports.ZodBranded = ZodBranded;
3511
- class ZodPipeline extends ZodType {
3512
- _parse(input) {
3513
- const { status, ctx } = this._processInputParams(input);
3514
- if (ctx.common.async) {
3515
- const handleAsync = async () => {
3516
- const inResult = await this._def.in._parseAsync({
3517
- data: ctx.data,
3518
- path: ctx.path,
3519
- parent: ctx,
3520
- });
3521
- if (inResult.status === "aborted")
3522
- return parseUtil_js_1.INVALID;
3523
- if (inResult.status === "dirty") {
3524
- status.dirty();
3525
- return (0, parseUtil_js_1.DIRTY)(inResult.value);
3526
- }
3527
- else {
3528
- return this._def.out._parseAsync({
3529
- data: inResult.value,
3530
- path: ctx.path,
3531
- parent: ctx,
3532
- });
3533
- }
3534
- };
3535
- return handleAsync();
3536
- }
3537
- else {
3538
- const inResult = this._def.in._parseSync({
3539
- data: ctx.data,
3540
- path: ctx.path,
3541
- parent: ctx,
3542
- });
3543
- if (inResult.status === "aborted")
3544
- return parseUtil_js_1.INVALID;
3545
- if (inResult.status === "dirty") {
3546
- status.dirty();
3547
- return {
3548
- status: "dirty",
3549
- value: inResult.value,
3550
- };
3551
- }
3552
- else {
3553
- return this._def.out._parseSync({
3554
- data: inResult.value,
3555
- path: ctx.path,
3556
- parent: ctx,
3557
- });
3558
- }
3559
- }
3560
- }
3561
- static create(a, b) {
3562
- return new ZodPipeline({
3563
- in: a,
3564
- out: b,
3565
- typeName: ZodFirstPartyTypeKind.ZodPipeline,
3566
- });
3567
- }
3568
- }
3569
- exports.ZodPipeline = ZodPipeline;
3570
- class ZodReadonly extends ZodType {
3571
- _parse(input) {
3572
- const result = this._def.innerType._parse(input);
3573
- const freeze = (data) => {
3574
- if ((0, parseUtil_js_1.isValid)(data)) {
3575
- data.value = Object.freeze(data.value);
3576
- }
3577
- return data;
3578
- };
3579
- return (0, parseUtil_js_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
3580
- }
3581
- unwrap() {
3582
- return this._def.innerType;
3583
- }
3584
- }
3585
- exports.ZodReadonly = ZodReadonly;
3586
- ZodReadonly.create = (type, params) => {
3587
- return new ZodReadonly({
3588
- innerType: type,
3589
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
3590
- ...processCreateParams(params),
3591
- });
3592
- };
3593
- ////////////////////////////////////////
3594
- ////////////////////////////////////////
3595
- ////////// //////////
3596
- ////////// z.custom //////////
3597
- ////////// //////////
3598
- ////////////////////////////////////////
3599
- ////////////////////////////////////////
3600
- function cleanParams(params, data) {
3601
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3602
- const p2 = typeof p === "string" ? { message: p } : p;
3603
- return p2;
3604
- }
3605
- function custom(check, _params = {},
3606
- /**
3607
- * @deprecated
3608
- *
3609
- * Pass `fatal` into the params object instead:
3610
- *
3611
- * ```ts
3612
- * z.string().custom((val) => val.length > 5, { fatal: false })
3613
- * ```
3614
- *
3615
- */
3616
- fatal) {
3617
- if (check)
3618
- return ZodAny.create().superRefine((data, ctx) => {
3619
- const r = check(data);
3620
- if (r instanceof Promise) {
3621
- return r.then((r) => {
3622
- if (!r) {
3623
- const params = cleanParams(_params, data);
3624
- const _fatal = params.fatal ?? fatal ?? true;
3625
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3626
- }
3627
- });
3628
- }
3629
- if (!r) {
3630
- const params = cleanParams(_params, data);
3631
- const _fatal = params.fatal ?? fatal ?? true;
3632
- ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
3633
- }
3634
- return;
3635
- });
3636
- return ZodAny.create();
3637
- }
3638
- exports.late = {
3639
- object: ZodObject.lazycreate,
3640
- };
3641
- var ZodFirstPartyTypeKind;
3642
- (function (ZodFirstPartyTypeKind) {
3643
- ZodFirstPartyTypeKind["ZodString"] = "ZodString";
3644
- ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
3645
- ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
3646
- ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
3647
- ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
3648
- ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
3649
- ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
3650
- ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
3651
- ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
3652
- ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
3653
- ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
3654
- ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
3655
- ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
3656
- ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
3657
- ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
3658
- ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
3659
- ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3660
- ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
3661
- ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
3662
- ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
3663
- ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
3664
- ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
3665
- ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
3666
- ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
3667
- ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
3668
- ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
3669
- ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
3670
- ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
3671
- ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
3672
- ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
3673
- ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
3674
- ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
3675
- ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
3676
- ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
3677
- ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
3678
- ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
3679
- })(ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
3680
- // requires TS 4.4+
3681
- class Class {
3682
- constructor(..._) { }
3683
- }
3684
- const instanceOfType = (
3685
- // const instanceOfType = <T extends new (...args: any[]) => any>(
3686
- cls, params = {
3687
- message: `Input not instance of ${cls.name}`,
3688
- }) => custom((data) => data instanceof cls, params);
3689
- exports.instanceof = instanceOfType;
3690
- const stringType = ZodString.create;
3691
- exports.string = stringType;
3692
- const numberType = ZodNumber.create;
3693
- exports.number = numberType;
3694
- const nanType = ZodNaN.create;
3695
- exports.nan = nanType;
3696
- const bigIntType = ZodBigInt.create;
3697
- exports.bigint = bigIntType;
3698
- const booleanType = ZodBoolean.create;
3699
- exports.boolean = booleanType;
3700
- const dateType = ZodDate.create;
3701
- exports.date = dateType;
3702
- const symbolType = ZodSymbol.create;
3703
- exports.symbol = symbolType;
3704
- const undefinedType = ZodUndefined.create;
3705
- exports.undefined = undefinedType;
3706
- const nullType = ZodNull.create;
3707
- exports.null = nullType;
3708
- const anyType = ZodAny.create;
3709
- exports.any = anyType;
3710
- const unknownType = ZodUnknown.create;
3711
- exports.unknown = unknownType;
3712
- const neverType = ZodNever.create;
3713
- exports.never = neverType;
3714
- const voidType = ZodVoid.create;
3715
- exports.void = voidType;
3716
- const arrayType = ZodArray.create;
3717
- exports.array = arrayType;
3718
- const objectType = ZodObject.create;
3719
- exports.object = objectType;
3720
- const strictObjectType = ZodObject.strictCreate;
3721
- exports.strictObject = strictObjectType;
3722
- const unionType = ZodUnion.create;
3723
- exports.union = unionType;
3724
- const discriminatedUnionType = ZodDiscriminatedUnion.create;
3725
- exports.discriminatedUnion = discriminatedUnionType;
3726
- const intersectionType = ZodIntersection.create;
3727
- exports.intersection = intersectionType;
3728
- const tupleType = ZodTuple.create;
3729
- exports.tuple = tupleType;
3730
- const recordType = ZodRecord.create;
3731
- exports.record = recordType;
3732
- const mapType = ZodMap.create;
3733
- exports.map = mapType;
3734
- const setType = ZodSet.create;
3735
- exports.set = setType;
3736
- const functionType = ZodFunction.create;
3737
- exports.function = functionType;
3738
- const lazyType = ZodLazy.create;
3739
- exports.lazy = lazyType;
3740
- const literalType = ZodLiteral.create;
3741
- exports.literal = literalType;
3742
- const enumType = ZodEnum.create;
3743
- exports.enum = enumType;
3744
- const nativeEnumType = ZodNativeEnum.create;
3745
- exports.nativeEnum = nativeEnumType;
3746
- const promiseType = ZodPromise.create;
3747
- exports.promise = promiseType;
3748
- const effectsType = ZodEffects.create;
3749
- exports.effect = effectsType;
3750
- exports.transformer = effectsType;
3751
- const optionalType = ZodOptional.create;
3752
- exports.optional = optionalType;
3753
- const nullableType = ZodNullable.create;
3754
- exports.nullable = nullableType;
3755
- const preprocessType = ZodEffects.createWithPreprocess;
3756
- exports.preprocess = preprocessType;
3757
- const pipelineType = ZodPipeline.create;
3758
- exports.pipeline = pipelineType;
3759
- const ostring = () => stringType().optional();
3760
- exports.ostring = ostring;
3761
- const onumber = () => numberType().optional();
3762
- exports.onumber = onumber;
3763
- const oboolean = () => booleanType().optional();
3764
- exports.oboolean = oboolean;
3765
- exports.coerce = {
3766
- string: ((arg) => ZodString.create({ ...arg, coerce: true })),
3767
- number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
3768
- boolean: ((arg) => ZodBoolean.create({
3769
- ...arg,
3770
- coerce: true,
3771
- })),
3772
- bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
3773
- date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
3774
- };
3775
- exports.NEVER = parseUtil_js_1.INVALID;