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