@zuplo/cli 7.13.3 → 7.13.4

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 (858) hide show
  1. package/dist/cmds/lint.d.ts.map +1 -1
  2. package/dist/cmds/lint.js +0 -5
  3. package/dist/cmds/lint.js.map +1 -1
  4. package/dist/lint/handler.d.ts.map +1 -1
  5. package/dist/lint/handler.js +9 -0
  6. package/dist/lint/handler.js.map +1 -1
  7. package/node_modules/@simple-git/argv-parser/LICENSE +20 -0
  8. package/node_modules/@simple-git/argv-parser/dist/index.cjs +1 -1
  9. package/node_modules/@simple-git/argv-parser/dist/index.cjs.map +1 -1
  10. package/node_modules/@simple-git/argv-parser/dist/index.d.ts +2 -1
  11. package/node_modules/@simple-git/argv-parser/dist/index.d.ts.map +1 -0
  12. package/node_modules/@simple-git/argv-parser/dist/index.mjs +244 -198
  13. package/node_modules/@simple-git/argv-parser/dist/index.mjs.map +1 -1
  14. package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.d.ts +1 -0
  15. package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.d.ts.map +1 -0
  16. package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.types.d.ts +1 -0
  17. package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.types.d.ts.map +1 -0
  18. package/node_modules/@simple-git/argv-parser/dist/src/config/analyse-config.d.ts +1 -0
  19. package/node_modules/@simple-git/argv-parser/dist/src/config/analyse-config.d.ts.map +1 -0
  20. package/node_modules/@simple-git/argv-parser/dist/src/config/config-operands.d.ts +1 -0
  21. package/node_modules/@simple-git/argv-parser/dist/src/config/config-operands.d.ts.map +1 -0
  22. package/node_modules/@simple-git/argv-parser/dist/src/config/config.types.d.ts +1 -0
  23. package/node_modules/@simple-git/argv-parser/dist/src/config/config.types.d.ts.map +1 -0
  24. package/node_modules/@simple-git/argv-parser/dist/src/config/detect-config-action.d.ts +1 -0
  25. package/node_modules/@simple-git/argv-parser/dist/src/config/detect-config-action.d.ts.map +1 -0
  26. package/node_modules/@simple-git/argv-parser/dist/src/env/parse-env.d.ts +25 -0
  27. package/node_modules/@simple-git/argv-parser/dist/src/env/parse-env.d.ts.map +1 -0
  28. package/node_modules/@simple-git/argv-parser/dist/src/flags/flags.helpers.d.ts +1 -0
  29. package/node_modules/@simple-git/argv-parser/dist/src/flags/flags.helpers.d.ts.map +1 -0
  30. package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-global-flags.d.ts +1 -0
  31. package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-global-flags.d.ts.map +1 -0
  32. package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-task-flags.d.ts +1 -0
  33. package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-task-flags.d.ts.map +1 -0
  34. package/node_modules/@simple-git/argv-parser/dist/src/tokens/flag-specs.d.ts +1 -0
  35. package/node_modules/@simple-git/argv-parser/dist/src/tokens/flag-specs.d.ts.map +1 -0
  36. package/node_modules/@simple-git/argv-parser/dist/src/tokens/token-expander.d.ts +1 -0
  37. package/node_modules/@simple-git/argv-parser/dist/src/tokens/token-expander.d.ts.map +1 -0
  38. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts +1 -0
  39. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts.map +1 -0
  40. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts +1 -0
  41. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts.map +1 -0
  42. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-analysis.d.ts +1 -0
  43. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-analysis.d.ts.map +1 -0
  44. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-check.d.ts +1 -0
  45. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-check.d.ts.map +1 -0
  46. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability.types.d.ts +29 -0
  47. package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability.types.d.ts.map +1 -0
  48. package/node_modules/@simple-git/argv-parser/package.json +2 -2
  49. package/node_modules/@zuplo/core/customer.cli.minified.js +344 -344
  50. package/node_modules/@zuplo/core/index.minified.js +359 -359
  51. package/node_modules/@zuplo/core/package.json +1 -1
  52. package/node_modules/@zuplo/graphql/package.json +1 -1
  53. package/node_modules/@zuplo/openapi-tools/package.json +2 -2
  54. package/node_modules/@zuplo/otel/package.json +1 -1
  55. package/node_modules/@zuplo/runtime/out/esm/{chunk-DVFQRFED.js → chunk-NWYAKCSU.js} +81 -81
  56. package/node_modules/@zuplo/runtime/out/esm/chunk-NWYAKCSU.js.map +1 -0
  57. package/node_modules/@zuplo/runtime/out/esm/chunk-PXS4NOKU.js +102 -0
  58. package/node_modules/@zuplo/runtime/out/esm/chunk-PXS4NOKU.js.map +1 -0
  59. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  60. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  61. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  62. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  63. package/node_modules/@zuplo/runtime/package.json +2 -2
  64. package/node_modules/simple-git/LICENSE +20 -0
  65. package/node_modules/simple-git/dist/index.cjs +6 -0
  66. package/node_modules/simple-git/dist/index.cjs.map +1 -0
  67. package/node_modules/simple-git/dist/index.d.ts +5 -0
  68. package/node_modules/simple-git/dist/index.d.ts.map +1 -0
  69. package/node_modules/simple-git/dist/index.mjs +2895 -0
  70. package/node_modules/simple-git/dist/index.mjs.map +1 -0
  71. package/node_modules/simple-git/dist/src/lib/api.d.ts +13 -13
  72. package/node_modules/simple-git/dist/src/lib/api.d.ts.map +1 -0
  73. package/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +1 -0
  74. package/node_modules/simple-git/dist/src/lib/args/log-format.d.ts.map +1 -0
  75. package/node_modules/simple-git/dist/src/lib/errors/git-configuration-error.d.ts +25 -0
  76. package/node_modules/simple-git/dist/src/lib/errors/git-configuration-error.d.ts.map +1 -0
  77. package/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts +2 -1
  78. package/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts.map +1 -0
  79. package/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts +3 -2
  80. package/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts.map +1 -0
  81. package/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +2 -1
  82. package/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts.map +1 -0
  83. package/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts +3 -2
  84. package/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts.map +1 -0
  85. package/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts +1 -0
  86. package/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts.map +1 -0
  87. package/node_modules/simple-git/dist/src/lib/git-factory.d.ts +3 -15
  88. package/node_modules/simple-git/dist/src/lib/git-factory.d.ts.map +1 -0
  89. package/node_modules/simple-git/dist/src/lib/git-logger.d.ts +2 -1
  90. package/node_modules/simple-git/dist/src/lib/git-logger.d.ts.map +1 -0
  91. package/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts +3 -2
  92. package/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts.map +1 -0
  93. package/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +2 -1
  94. package/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts.map +1 -0
  95. package/node_modules/simple-git/dist/src/lib/{responses/CleanSummary.d.ts → parsers/parse-clean.d.ts} +5 -4
  96. package/node_modules/simple-git/dist/src/lib/parsers/parse-clean.d.ts.map +1 -0
  97. package/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts +2 -1
  98. package/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts.map +1 -0
  99. package/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +1 -0
  100. package/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts.map +1 -0
  101. package/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts +2 -1
  102. package/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts.map +1 -0
  103. package/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts +2 -1
  104. package/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts.map +1 -0
  105. package/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts +3 -2
  106. package/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts.map +1 -0
  107. package/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts +2 -1
  108. package/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts.map +1 -0
  109. package/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts +3 -2
  110. package/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts.map +1 -0
  111. package/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts +3 -2
  112. package/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts.map +1 -0
  113. package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts +2 -1
  114. package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts.map +1 -0
  115. package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts +2 -1
  116. package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts.map +1 -0
  117. package/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -2
  118. package/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts.map +1 -0
  119. package/node_modules/simple-git/dist/src/lib/plugins/allow-environment.plugin.d.ts +3 -0
  120. package/node_modules/simple-git/dist/src/lib/plugins/allow-environment.plugin.d.ts.map +1 -0
  121. package/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +1 -0
  122. package/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts.map +1 -0
  123. package/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts +2 -1
  124. package/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts.map +1 -0
  125. package/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts +3 -2
  126. package/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts.map +1 -0
  127. package/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +2 -1
  128. package/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts.map +1 -0
  129. package/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +3 -2
  130. package/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts.map +1 -0
  131. package/node_modules/simple-git/dist/src/lib/plugins/index.d.ts +5 -1
  132. package/node_modules/simple-git/dist/src/lib/plugins/index.d.ts.map +1 -0
  133. package/node_modules/simple-git/dist/src/lib/plugins/input.plugin.d.ts +4 -0
  134. package/node_modules/simple-git/dist/src/lib/plugins/input.plugin.d.ts.map +1 -0
  135. package/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +2 -1
  136. package/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts.map +1 -0
  137. package/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts +3 -2
  138. package/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts.map +1 -0
  139. package/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +8 -4
  140. package/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts.map +1 -0
  141. package/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +3 -2
  142. package/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts.map +1 -0
  143. package/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -1
  144. package/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts.map +1 -0
  145. package/node_modules/simple-git/dist/src/lib/plugins/{timout-plugin.d.ts → timeout-plugin.d.ts} +2 -1
  146. package/node_modules/simple-git/dist/src/lib/plugins/timeout-plugin.d.ts.map +1 -0
  147. package/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts +2 -1
  148. package/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts.map +1 -0
  149. package/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +2 -1
  150. package/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts.map +1 -0
  151. package/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts +2 -1
  152. package/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts.map +1 -0
  153. package/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts +2 -1
  154. package/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts.map +1 -0
  155. package/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts +2 -1
  156. package/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts.map +1 -0
  157. package/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts +1 -0
  158. package/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts.map +1 -0
  159. package/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts +2 -1
  160. package/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts.map +1 -0
  161. package/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts +2 -1
  162. package/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts.map +1 -0
  163. package/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +2 -1
  164. package/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts.map +1 -0
  165. package/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts +2 -1
  166. package/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts.map +1 -0
  167. package/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts +2 -1
  168. package/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts.map +1 -0
  169. package/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts +5 -3
  170. package/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts.map +1 -0
  171. package/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts +2 -1
  172. package/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts.map +1 -0
  173. package/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +1 -0
  174. package/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts.map +1 -0
  175. package/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +3 -2
  176. package/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts.map +1 -0
  177. package/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts +3 -2
  178. package/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts.map +1 -0
  179. package/node_modules/simple-git/dist/src/lib/task-callback.d.ts +2 -1
  180. package/node_modules/simple-git/dist/src/lib/task-callback.d.ts.map +1 -0
  181. package/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +2 -1
  182. package/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts.map +1 -0
  183. package/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts +3 -2
  184. package/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts.map +1 -0
  185. package/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts +2 -1
  186. package/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts.map +1 -0
  187. package/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts +2 -1
  188. package/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts.map +1 -0
  189. package/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts +2 -1
  190. package/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts.map +1 -0
  191. package/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -1
  192. package/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts.map +1 -0
  193. package/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +3 -2
  194. package/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts.map +1 -0
  195. package/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +4 -3
  196. package/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts.map +1 -0
  197. package/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +2 -1
  198. package/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts.map +1 -0
  199. package/node_modules/simple-git/dist/src/lib/tasks/config.d.ts +2 -1
  200. package/node_modules/simple-git/dist/src/lib/tasks/config.d.ts.map +1 -0
  201. package/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +2 -1
  202. package/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts.map +1 -0
  203. package/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +1 -0
  204. package/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts.map +1 -0
  205. package/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +4 -3
  206. package/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts.map +1 -0
  207. package/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts +4 -3
  208. package/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts.map +1 -0
  209. package/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -1
  210. package/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts.map +1 -0
  211. package/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts +2 -1
  212. package/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts.map +1 -0
  213. package/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts +2 -1
  214. package/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts.map +1 -0
  215. package/node_modules/simple-git/dist/src/lib/tasks/init.d.ts +3 -2
  216. package/node_modules/simple-git/dist/src/lib/tasks/init.d.ts.map +1 -0
  217. package/node_modules/simple-git/dist/src/lib/tasks/interpret-trailers.d.ts +3 -0
  218. package/node_modules/simple-git/dist/src/lib/tasks/interpret-trailers.d.ts.map +1 -0
  219. package/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +3 -2
  220. package/node_modules/simple-git/dist/src/lib/tasks/log.d.ts.map +1 -0
  221. package/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts +4 -3
  222. package/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts.map +1 -0
  223. package/node_modules/simple-git/dist/src/lib/tasks/move.d.ts +3 -2
  224. package/node_modules/simple-git/dist/src/lib/tasks/move.d.ts.map +1 -0
  225. package/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts +3 -2
  226. package/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts.map +1 -0
  227. package/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +3 -2
  228. package/node_modules/simple-git/dist/src/lib/tasks/push.d.ts.map +1 -0
  229. package/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +1 -0
  230. package/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts.map +1 -0
  231. package/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +1 -0
  232. package/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts.map +1 -0
  233. package/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -1
  234. package/node_modules/simple-git/dist/src/lib/tasks/show.d.ts.map +1 -0
  235. package/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +2 -1
  236. package/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts.map +1 -0
  237. package/node_modules/simple-git/dist/src/lib/tasks/status.d.ts +3 -2
  238. package/node_modules/simple-git/dist/src/lib/tasks/status.d.ts.map +1 -0
  239. package/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts +2 -1
  240. package/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts.map +1 -0
  241. package/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts +3 -2
  242. package/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts.map +1 -0
  243. package/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +1 -0
  244. package/node_modules/simple-git/dist/src/lib/tasks/task.d.ts.map +1 -0
  245. package/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +2 -1
  246. package/node_modules/simple-git/dist/src/lib/tasks/version.d.ts.map +1 -0
  247. package/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +2 -1
  248. package/node_modules/simple-git/dist/src/lib/types/handlers.d.ts.map +1 -0
  249. package/node_modules/simple-git/dist/src/lib/types/index.d.ts +19 -2
  250. package/node_modules/simple-git/dist/src/lib/types/index.d.ts.map +1 -0
  251. package/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +4 -2
  252. package/node_modules/simple-git/dist/src/lib/types/tasks.d.ts.map +1 -0
  253. package/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +2 -0
  254. package/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts.map +1 -0
  255. package/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts +1 -0
  256. package/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts.map +1 -0
  257. package/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +2 -1
  258. package/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts.map +1 -0
  259. package/node_modules/simple-git/dist/src/lib/utils/index.d.ts +1 -0
  260. package/node_modules/simple-git/dist/src/lib/utils/index.d.ts.map +1 -0
  261. package/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +1 -0
  262. package/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts.map +1 -0
  263. package/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts +2 -1
  264. package/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts.map +1 -0
  265. package/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +2 -1
  266. package/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts.map +1 -0
  267. package/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts +3 -2
  268. package/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts.map +1 -0
  269. package/node_modules/simple-git/dist/src/lib/utils/util.d.ts +2 -0
  270. package/node_modules/simple-git/dist/src/lib/utils/util.d.ts.map +1 -0
  271. package/node_modules/simple-git/dist/src/typings/index.d.ts +4 -0
  272. package/node_modules/simple-git/dist/src/typings/index.d.ts.map +1 -0
  273. package/node_modules/simple-git/dist/src/typings/response.d.ts +479 -0
  274. package/node_modules/simple-git/dist/src/typings/response.d.ts.map +1 -0
  275. package/node_modules/simple-git/dist/src/typings/simple-git.d.ts +517 -0
  276. package/node_modules/simple-git/dist/src/typings/simple-git.d.ts.map +1 -0
  277. package/node_modules/simple-git/dist/src/typings/types.d.ts +11 -0
  278. package/node_modules/simple-git/dist/src/typings/types.d.ts.map +1 -0
  279. package/node_modules/simple-git/package.json +12 -16
  280. package/node_modules/simple-git/readme.md +29 -47
  281. package/node_modules/undici/docs/docs/api/Client.md +2 -0
  282. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +3 -1
  283. package/node_modules/undici/docs/docs/api/Dispatcher.md +1 -0
  284. package/node_modules/undici/lib/core/connect.js +10 -4
  285. package/node_modules/undici/lib/core/request.js +23 -2
  286. package/node_modules/undici/lib/core/symbols.js +1 -0
  287. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  288. package/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
  289. package/node_modules/undici/lib/dispatcher/client-h1.js +23 -10
  290. package/node_modules/undici/lib/dispatcher/client-h2.js +84 -23
  291. package/node_modules/undici/lib/dispatcher/client.js +9 -4
  292. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
  293. package/node_modules/undici/lib/handler/cache-handler.js +69 -5
  294. package/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
  295. package/node_modules/undici/lib/handler/redirect-handler.js +8 -1
  296. package/node_modules/undici/lib/handler/retry-handler.js +109 -23
  297. package/node_modules/undici/lib/interceptor/cache.js +20 -1
  298. package/node_modules/undici/lib/interceptor/decompress.js +348 -46
  299. package/node_modules/undici/lib/interceptor/dump.js +10 -23
  300. package/node_modules/undici/lib/web/cookies/index.js +3 -1
  301. package/node_modules/undici/lib/web/cookies/parse.js +138 -137
  302. package/node_modules/undici/lib/web/cookies/util.js +21 -2
  303. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +325 -149
  304. package/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  305. package/node_modules/undici/lib/web/fetch/index.js +3 -3
  306. package/node_modules/undici/lib/web/infra/index.js +14 -0
  307. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  308. package/node_modules/undici/lib/web/websocket/connection.js +19 -9
  309. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  310. package/node_modules/undici/lib/web/websocket/receiver.js +13 -0
  311. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  312. package/node_modules/undici/package.json +1 -1
  313. package/node_modules/undici/types/client.d.ts +14 -0
  314. package/node_modules/undici/types/interceptors.d.ts +2 -0
  315. package/node_modules/zod/README.md +29 -2
  316. package/node_modules/zod/compile.cjs +96 -0
  317. package/node_modules/zod/compile.d.cts +1 -0
  318. package/node_modules/zod/compile.d.ts +1 -0
  319. package/node_modules/zod/compile.js +52 -0
  320. package/node_modules/zod/index.cjs +21 -2
  321. package/node_modules/zod/index.d.cts +1 -2
  322. package/node_modules/zod/index.d.ts +1 -2
  323. package/node_modules/zod/index.js +5 -2
  324. package/node_modules/zod/locales/index.cjs +19 -0
  325. package/node_modules/zod/mini/index.cjs +19 -0
  326. package/node_modules/zod/package.json +20 -8
  327. package/node_modules/zod/src/compile.ts +56 -0
  328. package/node_modules/zod/src/index.ts +5 -2
  329. package/node_modules/zod/src/v3/ZodError.ts +22 -12
  330. package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
  331. package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
  332. package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
  333. package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
  334. package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
  335. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
  336. package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
  337. package/node_modules/zod/src/v3/types.ts +5 -5
  338. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  339. package/node_modules/zod/src/v4/classic/compat.ts +26 -18
  340. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  341. package/node_modules/zod/src/v4/classic/errors.ts +59 -44
  342. package/node_modules/zod/src/v4/classic/external.ts +14 -9
  343. package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
  344. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  345. package/node_modules/zod/src/v4/classic/index.ts +2 -2
  346. package/node_modules/zod/src/v4/classic/iso.ts +2 -72
  347. package/node_modules/zod/src/v4/classic/parse.ts +10 -4
  348. package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
  349. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
  350. package/node_modules/zod/src/v4/classic/tests/array.test.ts +29 -2
  351. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
  352. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
  353. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
  354. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
  355. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
  356. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
  357. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  358. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  359. package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
  360. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
  361. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  362. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  363. package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
  364. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
  365. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
  366. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
  367. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
  368. package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
  369. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
  370. package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
  371. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
  372. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
  373. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  374. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  375. package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
  376. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  377. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
  378. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
  379. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  380. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
  381. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
  382. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
  383. package/node_modules/zod/src/v4/classic/tests/map.test.ts +19 -0
  384. package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
  385. package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
  386. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  387. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
  388. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
  389. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
  390. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
  391. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  392. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
  393. package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
  394. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
  395. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  396. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
  397. package/node_modules/zod/src/v4/classic/tests/set.test.ts +15 -0
  398. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
  399. package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
  400. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
  401. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
  402. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
  403. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
  404. package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
  405. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  406. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
  407. package/node_modules/zod/src/v4/core/api.ts +87 -35
  408. package/node_modules/zod/src/v4/core/checks.ts +119 -146
  409. package/node_modules/zod/src/v4/core/compile.ts +2322 -0
  410. package/node_modules/zod/src/v4/core/core.ts +99 -22
  411. package/node_modules/zod/src/v4/core/doc.ts +17 -9
  412. package/node_modules/zod/src/v4/core/errors.ts +113 -25
  413. package/node_modules/zod/src/v4/core/index.ts +3 -0
  414. package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
  415. package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
  416. package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
  417. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  418. package/node_modules/zod/src/v4/core/parse.ts +164 -50
  419. package/node_modules/zod/src/v4/core/regexes.ts +42 -15
  420. package/node_modules/zod/src/v4/core/registries.ts +2 -2
  421. package/node_modules/zod/src/v4/core/schemas.ts +1035 -539
  422. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  423. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  424. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  425. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  426. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  427. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  428. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  429. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  430. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
  431. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
  432. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
  433. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  434. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  435. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  436. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  437. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  438. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  439. package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
  440. package/node_modules/zod/src/v4/core/util.ts +467 -157
  441. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  442. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  443. package/node_modules/zod/src/v4/index.ts +3 -3
  444. package/node_modules/zod/src/v4/locales/ar.ts +5 -0
  445. package/node_modules/zod/src/v4/locales/az.ts +5 -0
  446. package/node_modules/zod/src/v4/locales/be.ts +12 -0
  447. package/node_modules/zod/src/v4/locales/bg.ts +5 -0
  448. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  449. package/node_modules/zod/src/v4/locales/ca.ts +5 -0
  450. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  451. package/node_modules/zod/src/v4/locales/cs.ts +5 -0
  452. package/node_modules/zod/src/v4/locales/da.ts +7 -2
  453. package/node_modules/zod/src/v4/locales/de.ts +5 -0
  454. package/node_modules/zod/src/v4/locales/el.ts +3 -0
  455. package/node_modules/zod/src/v4/locales/en.ts +17 -4
  456. package/node_modules/zod/src/v4/locales/eo.ts +5 -0
  457. package/node_modules/zod/src/v4/locales/es.ts +4 -0
  458. package/node_modules/zod/src/v4/locales/fa.ts +5 -0
  459. package/node_modules/zod/src/v4/locales/fi.ts +5 -0
  460. package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
  461. package/node_modules/zod/src/v4/locales/fr.ts +21 -14
  462. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  463. package/node_modules/zod/src/v4/locales/he.ts +8 -1
  464. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  465. package/node_modules/zod/src/v4/locales/hr.ts +4 -0
  466. package/node_modules/zod/src/v4/locales/hu.ts +5 -0
  467. package/node_modules/zod/src/v4/locales/hy.ts +11 -0
  468. package/node_modules/zod/src/v4/locales/id.ts +5 -0
  469. package/node_modules/zod/src/v4/locales/index.ts +11 -0
  470. package/node_modules/zod/src/v4/locales/is.ts +5 -0
  471. package/node_modules/zod/src/v4/locales/it.ts +5 -0
  472. package/node_modules/zod/src/v4/locales/ja.ts +5 -0
  473. package/node_modules/zod/src/v4/locales/ka.ts +5 -0
  474. package/node_modules/zod/src/v4/locales/km.ts +5 -0
  475. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  476. package/node_modules/zod/src/v4/locales/ko.ts +5 -0
  477. package/node_modules/zod/src/v4/locales/lt.ts +4 -0
  478. package/node_modules/zod/src/v4/locales/mk.ts +5 -0
  479. package/node_modules/zod/src/v4/locales/ms.ts +5 -0
  480. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  481. package/node_modules/zod/src/v4/locales/nl.ts +5 -0
  482. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  483. package/node_modules/zod/src/v4/locales/no.ts +7 -2
  484. package/node_modules/zod/src/v4/locales/ota.ts +5 -0
  485. package/node_modules/zod/src/v4/locales/pl.ts +5 -0
  486. package/node_modules/zod/src/v4/locales/ps.ts +5 -0
  487. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  488. package/node_modules/zod/src/v4/locales/pt.ts +101 -58
  489. package/node_modules/zod/src/v4/locales/ro.ts +3 -0
  490. package/node_modules/zod/src/v4/locales/ru.ts +12 -0
  491. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  492. package/node_modules/zod/src/v4/locales/sl.ts +5 -0
  493. package/node_modules/zod/src/v4/locales/sv.ts +7 -2
  494. package/node_modules/zod/src/v4/locales/ta.ts +5 -0
  495. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  496. package/node_modules/zod/src/v4/locales/th.ts +5 -0
  497. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  498. package/node_modules/zod/src/v4/locales/tr.ts +5 -0
  499. package/node_modules/zod/src/v4/locales/uk.ts +5 -0
  500. package/node_modules/zod/src/v4/locales/ur.ts +5 -0
  501. package/node_modules/zod/src/v4/locales/uz.ts +3 -0
  502. package/node_modules/zod/src/v4/locales/vi.ts +5 -0
  503. package/node_modules/zod/src/v4/locales/yo.ts +5 -0
  504. package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
  505. package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
  506. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  507. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  508. package/node_modules/zod/src/v4/mini/external.ts +12 -1
  509. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  510. package/node_modules/zod/src/v4/mini/parse.ts +2 -0
  511. package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
  512. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
  513. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
  514. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
  515. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
  516. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
  517. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  518. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  519. package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
  520. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
  521. package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
  522. package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
  523. package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
  524. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
  525. package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
  526. package/node_modules/zod/v3/ZodError.cjs +41 -12
  527. package/node_modules/zod/v3/ZodError.d.cts +1 -1
  528. package/node_modules/zod/v3/ZodError.d.ts +1 -1
  529. package/node_modules/zod/v3/ZodError.js +22 -12
  530. package/node_modules/zod/v3/errors.cjs +19 -0
  531. package/node_modules/zod/v3/external.cjs +19 -0
  532. package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
  533. package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
  534. package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
  535. package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
  536. package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
  537. package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
  538. package/node_modules/zod/v3/helpers/util.cjs +19 -0
  539. package/node_modules/zod/v3/index.cjs +19 -0
  540. package/node_modules/zod/v3/standard-schema.cjs +19 -0
  541. package/node_modules/zod/v3/types.cjs +26 -5
  542. package/node_modules/zod/v3/types.js +7 -5
  543. package/node_modules/zod/v4/classic/checks.cjs +21 -1
  544. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  545. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  546. package/node_modules/zod/v4/classic/checks.js +1 -1
  547. package/node_modules/zod/v4/classic/coerce.cjs +19 -0
  548. package/node_modules/zod/v4/classic/compat.cjs +19 -0
  549. package/node_modules/zod/v4/classic/compat.d.cts +9 -11
  550. package/node_modules/zod/v4/classic/compat.d.ts +9 -11
  551. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  552. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  553. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  554. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  555. package/node_modules/zod/v4/classic/errors.cjs +62 -34
  556. package/node_modules/zod/v4/classic/errors.d.cts +3 -4
  557. package/node_modules/zod/v4/classic/errors.d.ts +3 -4
  558. package/node_modules/zod/v4/classic/errors.js +43 -34
  559. package/node_modules/zod/v4/classic/external.cjs +51 -27
  560. package/node_modules/zod/v4/classic/external.d.cts +5 -2
  561. package/node_modules/zod/v4/classic/external.d.ts +5 -2
  562. package/node_modules/zod/v4/classic/external.js +5 -8
  563. package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
  564. package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
  565. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  566. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  567. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  568. package/node_modules/zod/v4/classic/in-out.js +36 -0
  569. package/node_modules/zod/v4/classic/index.cjs +21 -2
  570. package/node_modules/zod/v4/classic/index.d.cts +1 -2
  571. package/node_modules/zod/v4/classic/index.d.ts +1 -2
  572. package/node_modules/zod/v4/classic/index.js +2 -2
  573. package/node_modules/zod/v4/classic/iso.cjs +30 -22
  574. package/node_modules/zod/v4/classic/iso.d.cts +2 -17
  575. package/node_modules/zod/v4/classic/iso.d.ts +2 -17
  576. package/node_modules/zod/v4/classic/iso.js +2 -17
  577. package/node_modules/zod/v4/classic/parse.cjs +23 -1
  578. package/node_modules/zod/v4/classic/parse.d.cts +17 -4
  579. package/node_modules/zod/v4/classic/parse.d.ts +17 -4
  580. package/node_modules/zod/v4/classic/parse.js +1 -0
  581. package/node_modules/zod/v4/classic/schemas.cjs +591 -426
  582. package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
  583. package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
  584. package/node_modules/zod/v4/classic/schemas.js +564 -424
  585. package/node_modules/zod/v4/core/api.cjs +66 -24
  586. package/node_modules/zod/v4/core/api.d.cts +22 -12
  587. package/node_modules/zod/v4/core/api.d.ts +22 -12
  588. package/node_modules/zod/v4/core/api.js +44 -24
  589. package/node_modules/zod/v4/core/checks.cjs +88 -128
  590. package/node_modules/zod/v4/core/checks.d.cts +29 -13
  591. package/node_modules/zod/v4/core/checks.d.ts +29 -13
  592. package/node_modules/zod/v4/core/checks.js +68 -127
  593. package/node_modules/zod/v4/core/compile.cjs +1916 -0
  594. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  595. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  596. package/node_modules/zod/v4/core/compile.js +1866 -0
  597. package/node_modules/zod/v4/core/core.cjs +101 -19
  598. package/node_modules/zod/v4/core/core.d.cts +16 -4
  599. package/node_modules/zod/v4/core/core.d.ts +16 -4
  600. package/node_modules/zod/v4/core/core.js +83 -20
  601. package/node_modules/zod/v4/core/doc.cjs +31 -9
  602. package/node_modules/zod/v4/core/doc.d.cts +3 -1
  603. package/node_modules/zod/v4/core/doc.d.ts +3 -1
  604. package/node_modules/zod/v4/core/doc.js +12 -9
  605. package/node_modules/zod/v4/core/errors.cjs +126 -25
  606. package/node_modules/zod/v4/core/errors.d.cts +4 -0
  607. package/node_modules/zod/v4/core/errors.d.ts +4 -0
  608. package/node_modules/zod/v4/core/errors.js +107 -25
  609. package/node_modules/zod/v4/core/index.cjs +24 -1
  610. package/node_modules/zod/v4/core/index.d.cts +3 -0
  611. package/node_modules/zod/v4/core/index.d.ts +3 -0
  612. package/node_modules/zod/v4/core/index.js +3 -0
  613. package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
  614. package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
  615. package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
  616. package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
  617. package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
  618. package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
  619. package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
  620. package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
  621. package/node_modules/zod/v4/core/json-schema.cjs +19 -0
  622. package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
  623. package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
  624. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  625. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  626. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  627. package/node_modules/zod/v4/core/memoizer.js +311 -0
  628. package/node_modules/zod/v4/core/parse.cjs +148 -46
  629. package/node_modules/zod/v4/core/parse.d.cts +14 -11
  630. package/node_modules/zod/v4/core/parse.d.ts +14 -11
  631. package/node_modules/zod/v4/core/parse.js +127 -45
  632. package/node_modules/zod/v4/core/regexes.cjs +54 -17
  633. package/node_modules/zod/v4/core/regexes.d.cts +5 -0
  634. package/node_modules/zod/v4/core/regexes.d.ts +5 -0
  635. package/node_modules/zod/v4/core/regexes.js +32 -15
  636. package/node_modules/zod/v4/core/registries.cjs +19 -0
  637. package/node_modules/zod/v4/core/registries.js +2 -2
  638. package/node_modules/zod/v4/core/schemas.cjs +815 -386
  639. package/node_modules/zod/v4/core/schemas.d.cts +126 -35
  640. package/node_modules/zod/v4/core/schemas.d.ts +126 -35
  641. package/node_modules/zod/v4/core/schemas.js +783 -386
  642. package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
  643. package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
  644. package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
  645. package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
  646. package/node_modules/zod/v4/core/to-json-schema.js +247 -44
  647. package/node_modules/zod/v4/core/util.cjs +387 -157
  648. package/node_modules/zod/v4/core/util.d.cts +81 -1
  649. package/node_modules/zod/v4/core/util.d.ts +81 -1
  650. package/node_modules/zod/v4/core/util.js +355 -156
  651. package/node_modules/zod/v4/core/versions.cjs +21 -2
  652. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  653. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  654. package/node_modules/zod/v4/core/versions.js +2 -2
  655. package/node_modules/zod/v4/core/visit.cjs +214 -0
  656. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  657. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  658. package/node_modules/zod/v4/core/visit.js +169 -0
  659. package/node_modules/zod/v4/index.cjs +34 -5
  660. package/node_modules/zod/v4/index.d.cts +2 -2
  661. package/node_modules/zod/v4/index.d.ts +2 -2
  662. package/node_modules/zod/v4/index.js +3 -2
  663. package/node_modules/zod/v4/locales/ar.cjs +5 -0
  664. package/node_modules/zod/v4/locales/ar.js +5 -0
  665. package/node_modules/zod/v4/locales/az.cjs +5 -0
  666. package/node_modules/zod/v4/locales/az.js +5 -0
  667. package/node_modules/zod/v4/locales/be.cjs +12 -0
  668. package/node_modules/zod/v4/locales/be.js +12 -0
  669. package/node_modules/zod/v4/locales/bg.cjs +5 -0
  670. package/node_modules/zod/v4/locales/bg.js +5 -0
  671. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  672. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  673. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  674. package/node_modules/zod/v4/locales/bn.js +113 -0
  675. package/node_modules/zod/v4/locales/ca.cjs +5 -0
  676. package/node_modules/zod/v4/locales/ca.js +5 -0
  677. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  678. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  679. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  680. package/node_modules/zod/v4/locales/ckb.js +133 -0
  681. package/node_modules/zod/v4/locales/cs.cjs +5 -0
  682. package/node_modules/zod/v4/locales/cs.js +5 -0
  683. package/node_modules/zod/v4/locales/da.cjs +7 -2
  684. package/node_modules/zod/v4/locales/da.js +7 -2
  685. package/node_modules/zod/v4/locales/de.cjs +5 -0
  686. package/node_modules/zod/v4/locales/de.js +5 -0
  687. package/node_modules/zod/v4/locales/el.cjs +3 -0
  688. package/node_modules/zod/v4/locales/el.js +3 -0
  689. package/node_modules/zod/v4/locales/en.cjs +16 -4
  690. package/node_modules/zod/v4/locales/en.js +16 -4
  691. package/node_modules/zod/v4/locales/eo.cjs +5 -0
  692. package/node_modules/zod/v4/locales/eo.js +5 -0
  693. package/node_modules/zod/v4/locales/es.cjs +4 -0
  694. package/node_modules/zod/v4/locales/es.js +4 -0
  695. package/node_modules/zod/v4/locales/fa.cjs +5 -0
  696. package/node_modules/zod/v4/locales/fa.js +5 -0
  697. package/node_modules/zod/v4/locales/fi.cjs +5 -0
  698. package/node_modules/zod/v4/locales/fi.js +5 -0
  699. package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
  700. package/node_modules/zod/v4/locales/fr-CA.js +5 -0
  701. package/node_modules/zod/v4/locales/fr.cjs +18 -14
  702. package/node_modules/zod/v4/locales/fr.js +18 -14
  703. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  704. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  705. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  706. package/node_modules/zod/v4/locales/gu.js +113 -0
  707. package/node_modules/zod/v4/locales/he.cjs +7 -0
  708. package/node_modules/zod/v4/locales/he.js +7 -0
  709. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  710. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  711. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  712. package/node_modules/zod/v4/locales/hi.js +111 -0
  713. package/node_modules/zod/v4/locales/hr.cjs +4 -0
  714. package/node_modules/zod/v4/locales/hr.js +4 -0
  715. package/node_modules/zod/v4/locales/hu.cjs +5 -0
  716. package/node_modules/zod/v4/locales/hu.js +5 -0
  717. package/node_modules/zod/v4/locales/hy.cjs +11 -0
  718. package/node_modules/zod/v4/locales/hy.js +11 -0
  719. package/node_modules/zod/v4/locales/id.cjs +5 -0
  720. package/node_modules/zod/v4/locales/id.js +5 -0
  721. package/node_modules/zod/v4/locales/index.cjs +43 -2
  722. package/node_modules/zod/v4/locales/index.d.cts +11 -0
  723. package/node_modules/zod/v4/locales/index.d.ts +11 -0
  724. package/node_modules/zod/v4/locales/index.js +11 -0
  725. package/node_modules/zod/v4/locales/is.cjs +5 -0
  726. package/node_modules/zod/v4/locales/is.js +5 -0
  727. package/node_modules/zod/v4/locales/it.cjs +5 -0
  728. package/node_modules/zod/v4/locales/it.js +5 -0
  729. package/node_modules/zod/v4/locales/ja.cjs +5 -0
  730. package/node_modules/zod/v4/locales/ja.js +5 -0
  731. package/node_modules/zod/v4/locales/ka.cjs +5 -0
  732. package/node_modules/zod/v4/locales/ka.js +5 -0
  733. package/node_modules/zod/v4/locales/km.cjs +5 -0
  734. package/node_modules/zod/v4/locales/km.js +5 -0
  735. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  736. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  737. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  738. package/node_modules/zod/v4/locales/kn.js +116 -0
  739. package/node_modules/zod/v4/locales/ko.cjs +5 -0
  740. package/node_modules/zod/v4/locales/ko.js +5 -0
  741. package/node_modules/zod/v4/locales/lt.cjs +4 -0
  742. package/node_modules/zod/v4/locales/lt.js +4 -0
  743. package/node_modules/zod/v4/locales/mk.cjs +5 -0
  744. package/node_modules/zod/v4/locales/mk.js +5 -0
  745. package/node_modules/zod/v4/locales/ms.cjs +5 -0
  746. package/node_modules/zod/v4/locales/ms.js +5 -0
  747. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  748. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  749. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  750. package/node_modules/zod/v4/locales/ne.js +111 -0
  751. package/node_modules/zod/v4/locales/nl.cjs +5 -0
  752. package/node_modules/zod/v4/locales/nl.js +5 -0
  753. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  754. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  755. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  756. package/node_modules/zod/v4/locales/nn.js +113 -0
  757. package/node_modules/zod/v4/locales/no.cjs +7 -2
  758. package/node_modules/zod/v4/locales/no.js +7 -2
  759. package/node_modules/zod/v4/locales/ota.cjs +5 -0
  760. package/node_modules/zod/v4/locales/ota.js +5 -0
  761. package/node_modules/zod/v4/locales/pl.cjs +5 -0
  762. package/node_modules/zod/v4/locales/pl.js +5 -0
  763. package/node_modules/zod/v4/locales/ps.cjs +5 -0
  764. package/node_modules/zod/v4/locales/ps.js +5 -0
  765. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  766. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  767. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  768. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  769. package/node_modules/zod/v4/locales/pt.cjs +89 -55
  770. package/node_modules/zod/v4/locales/pt.js +89 -55
  771. package/node_modules/zod/v4/locales/ro.cjs +3 -0
  772. package/node_modules/zod/v4/locales/ro.js +3 -0
  773. package/node_modules/zod/v4/locales/ru.cjs +12 -0
  774. package/node_modules/zod/v4/locales/ru.js +12 -0
  775. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  776. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  777. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  778. package/node_modules/zod/v4/locales/sk.js +116 -0
  779. package/node_modules/zod/v4/locales/sl.cjs +5 -0
  780. package/node_modules/zod/v4/locales/sl.js +5 -0
  781. package/node_modules/zod/v4/locales/sv.cjs +7 -2
  782. package/node_modules/zod/v4/locales/sv.js +7 -2
  783. package/node_modules/zod/v4/locales/ta.cjs +5 -0
  784. package/node_modules/zod/v4/locales/ta.js +5 -0
  785. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  786. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  787. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  788. package/node_modules/zod/v4/locales/tg.js +117 -0
  789. package/node_modules/zod/v4/locales/th.cjs +5 -0
  790. package/node_modules/zod/v4/locales/th.js +5 -0
  791. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  792. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  793. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  794. package/node_modules/zod/v4/locales/tk.js +107 -0
  795. package/node_modules/zod/v4/locales/tr.cjs +5 -0
  796. package/node_modules/zod/v4/locales/tr.js +5 -0
  797. package/node_modules/zod/v4/locales/uk.cjs +5 -0
  798. package/node_modules/zod/v4/locales/uk.js +5 -0
  799. package/node_modules/zod/v4/locales/ur.cjs +5 -0
  800. package/node_modules/zod/v4/locales/ur.js +5 -0
  801. package/node_modules/zod/v4/locales/uz.cjs +3 -0
  802. package/node_modules/zod/v4/locales/uz.js +3 -0
  803. package/node_modules/zod/v4/locales/vi.cjs +5 -0
  804. package/node_modules/zod/v4/locales/vi.js +5 -0
  805. package/node_modules/zod/v4/locales/yo.cjs +5 -0
  806. package/node_modules/zod/v4/locales/yo.js +5 -0
  807. package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
  808. package/node_modules/zod/v4/locales/zh-CN.js +5 -0
  809. package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
  810. package/node_modules/zod/v4/locales/zh-TW.js +5 -0
  811. package/node_modules/zod/v4/mini/checks.cjs +21 -1
  812. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  813. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  814. package/node_modules/zod/v4/mini/checks.js +1 -1
  815. package/node_modules/zod/v4/mini/coerce.cjs +19 -0
  816. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  817. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  818. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  819. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  820. package/node_modules/zod/v4/mini/external.cjs +33 -1
  821. package/node_modules/zod/v4/mini/external.d.cts +5 -2
  822. package/node_modules/zod/v4/mini/external.d.ts +5 -2
  823. package/node_modules/zod/v4/mini/external.js +3 -1
  824. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  825. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  826. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  827. package/node_modules/zod/v4/mini/in-out.js +36 -0
  828. package/node_modules/zod/v4/mini/index.cjs +19 -0
  829. package/node_modules/zod/v4/mini/iso.cjs +19 -0
  830. package/node_modules/zod/v4/mini/parse.cjs +22 -1
  831. package/node_modules/zod/v4/mini/parse.d.cts +1 -1
  832. package/node_modules/zod/v4/mini/parse.d.ts +1 -1
  833. package/node_modules/zod/v4/mini/parse.js +1 -1
  834. package/node_modules/zod/v4/mini/schemas.cjs +117 -53
  835. package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
  836. package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
  837. package/node_modules/zod/v4/mini/schemas.js +92 -51
  838. package/node_modules/zod/v4-mini/index.cjs +19 -0
  839. package/package.json +14 -14
  840. package/node_modules/@zuplo/runtime/out/esm/chunk-DVFQRFED.js.map +0 -1
  841. package/node_modules/@zuplo/runtime/out/esm/chunk-FQIUJWH2.js +0 -105
  842. package/node_modules/@zuplo/runtime/out/esm/chunk-FQIUJWH2.js.map +0 -1
  843. package/node_modules/simple-git/dist/cjs/index.js +0 -4898
  844. package/node_modules/simple-git/dist/cjs/index.js.map +0 -7
  845. package/node_modules/simple-git/dist/esm/index.js +0 -4745
  846. package/node_modules/simple-git/dist/esm/index.js.map +0 -7
  847. package/node_modules/simple-git/dist/esm/package.json +0 -3
  848. package/node_modules/simple-git/dist/src/lib/responses/CheckIgnore.d.ts +0 -4
  849. package/node_modules/simple-git/dist/src/lib/runners/promise-wrapped.d.ts +0 -2
  850. package/node_modules/simple-git/dist/typings/errors.d.ts +0 -5
  851. package/node_modules/simple-git/dist/typings/index.d.ts +0 -14
  852. package/node_modules/simple-git/dist/typings/response.d.ts +0 -556
  853. package/node_modules/simple-git/dist/typings/simple-git.d.ts +0 -1033
  854. package/node_modules/simple-git/dist/typings/types.d.ts +0 -22
  855. package/node_modules/simple-git/promise.js +0 -17
  856. package/node_modules/zod/src/v4/core/config.ts +0 -15
  857. /package/node_modules/@zuplo/runtime/out/esm/{chunk-DVFQRFED.js.LEGAL.txt → chunk-NWYAKCSU.js.LEGAL.txt} +0 -0
  858. /package/node_modules/@zuplo/runtime/out/esm/{chunk-FQIUJWH2.js.LEGAL.txt → chunk-PXS4NOKU.js.LEGAL.txt} +0 -0
@@ -1,10 +1,11 @@
1
- import type { $ZodTypeDiscriminable } from "./api.js";
2
1
  import * as checks from "./checks.js";
2
+ import type { $ZodNumberFormats } from "./checks.js";
3
+ import type { $ZodBigIntFormats } from "./checks.js";
3
4
  import * as core from "./core.js";
4
5
  import { Doc } from "./doc.js";
5
6
  import type * as errors from "./errors.js";
6
7
  import type * as JSONSchema from "./json-schema.js";
7
- import { parse, parseAsync, safeParse, safeParseAsync } from "./parse.js";
8
+ import { parse, parseAsync } from "./parse.js";
8
9
  import * as regexes from "./regexes.js";
9
10
  import type { StandardSchemaV1 } from "./standard-schema.js";
10
11
  import type { ProcessParams, ToJSONSchemaContext } from "./to-json-schema.js";
@@ -29,6 +30,15 @@ export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> ex
29
30
  readonly async?: boolean | undefined;
30
31
  readonly direction?: "forward" | "backward";
31
32
  readonly skipChecks?: boolean;
33
+ /** Set only by `validate`/`validateAsync`. A container may stop before its next child, never inside one, so a map entry and a tuple's fixed items parse whole. */
34
+ readonly abortEarly?: boolean;
35
+ }
36
+
37
+ /** Gives a container cycle support: `attach` wraps its parse, and `alloc` registers the object it builds into before any child is parsed so a reference back to the same input resolves to it. */
38
+ export interface $ZodMemoizer {
39
+ attach(inst: $ZodType): void;
40
+ guard(inst: $ZodType): void;
41
+ alloc<T extends object>(inst: $ZodType, payload: ParsePayload, empty: T, ctx: ParseContextInternal): T;
32
42
  }
33
43
 
34
44
  export interface ParsePayload<T = unknown> {
@@ -36,11 +46,9 @@ export interface ParsePayload<T = unknown> {
36
46
  issues: errors.$ZodRawIssue[];
37
47
  /** A way to mark a whole payload as aborted. Used in codecs/pipes. */
38
48
  aborted?: boolean;
39
- /** @internal Marks a value as a fallback that an outer wrapper (e.g.
40
- * $ZodOptional) may override with its own interpretation when input was
41
- * undefined. Set by $ZodCatch when catchValue substitutes and by every
42
- * $ZodTransform invocation. */
43
- fallback?: boolean | undefined;
49
+ /** @internal Set when the value came from a repeat visit to a node still being
50
+ * parsed. Its checks run on the node itself, against the finished value. */
51
+ memo?: boolean | undefined;
44
52
  }
45
53
 
46
54
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
@@ -120,8 +128,13 @@ export interface _$ZodTypeInternals {
120
128
  * @default Required
121
129
  */
122
130
 
123
- /** @internal */
124
- optin?: "optional" | undefined;
131
+ /** @internal Three rungs, each strictly stronger than the last:
132
+ * undefined — required; the container may not omit this slot
133
+ * "optional" — the container may omit it; nothing is supplied in its place
134
+ * "defaulted" — the container may omit it AND this schema substitutes a value
135
+ * Consumers asking "may the slot be absent?" test `!== undefined`.
136
+ * $ZodOptional asks the stronger question and tests `=== "defaulted"`. */
137
+ optin?: "optional" | "defaulted" | undefined;
125
138
  /** @internal */
126
139
  optout?: "optional" | undefined;
127
140
 
@@ -187,137 +200,164 @@ export interface $ZodType<
187
200
  export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
188
201
  extends $ZodType<T["output"], T["input"], T> {}
189
202
 
190
- export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
191
- inst ??= {} as any;
192
-
193
- inst._zod.def = def; // set _def property
194
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
195
- inst._zod.version = version;
196
-
197
- const checks = [...(inst._zod.def.checks ?? [])];
198
-
199
- // if inst is itself a checks.$ZodCheck, run it as a check
200
- if (inst._zod.traits.has("$ZodCheck")) {
201
- checks.unshift(inst as any);
202
- }
203
-
204
- for (const ch of checks) {
205
- for (const fn of ch._zod.onattach) {
206
- fn(inst);
203
+ export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor<$ZodType>(
204
+ "$ZodType",
205
+ (inst, def) => {
206
+ inst ??= {} as any;
207
+
208
+ inst._zod.def = def; // set _def property
209
+ inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
210
+ inst._zod.version = version;
211
+
212
+ const defChecks = inst._zod.def.checks;
213
+ // if inst is itself a checks.$ZodCheck, run it as a check
214
+ const checks: checks.$ZodCheck<never>[] = inst._zod.traits.has("$ZodCheck")
215
+ ? [inst as any, ...(defChecks ?? [])]
216
+ : defChecks?.length
217
+ ? [...defChecks]
218
+ : [];
219
+
220
+ for (const ch of checks) {
221
+ for (const fn of ch._zod.onattach) {
222
+ fn(inst);
223
+ }
207
224
  }
208
- }
209
225
 
210
- if (checks.length === 0) {
211
- // deferred initializer
212
- // inst._zod.parse is not yet defined
213
- inst._zod.deferred ??= [];
214
- inst._zod.deferred?.push(() => {
215
- inst._zod.run = inst._zod.parse;
216
- });
217
- } else {
218
- const runChecks = (
219
- payload: ParsePayload,
220
- checks: checks.$ZodCheck<never>[],
221
- ctx?: ParseContextInternal | undefined
222
- ): util.MaybeAsync<ParsePayload> => {
223
- let isAborted = util.aborted(payload);
224
-
225
- let asyncResult!: Promise<unknown> | undefined;
226
- for (const ch of checks) {
227
- if (ch._zod.def.when) {
228
- if (util.explicitlyAborted(payload)) continue;
229
- const shouldRun = ch._zod.def.when(payload);
230
- if (!shouldRun) continue;
231
- } else if (isAborted) {
232
- continue;
233
- }
234
- const currLen = payload.issues.length;
235
- const _ = ch._zod.check(payload as any) as any as ParsePayload;
226
+ if (checks.length === 0) {
227
+ // deferred initializer inst._zod.parse is not yet defined
228
+ inst._zod.deferred ??= [];
229
+ inst._zod.deferred?.push(() => {
230
+ inst._zod.run = inst._zod.parse;
231
+ });
232
+ } else {
233
+ const runChecks = (
234
+ payload: ParsePayload,
235
+ checks: checks.$ZodCheck<never>[],
236
+ ctx?: ParseContextInternal | undefined
237
+ ): util.MaybeAsync<ParsePayload> => {
238
+ if (payload.memo) return payload;
239
+
240
+ let isAborted = util.aborted(payload);
241
+
242
+ let asyncResult!: Promise<unknown> | undefined;
243
+ for (const ch of checks) {
244
+ if (ch._zod.def.when) {
245
+ if (util.explicitlyAborted(payload)) continue;
246
+ const shouldRun = ch._zod.def.when(payload);
247
+ if (!shouldRun) continue;
248
+ } else if (isAborted) {
249
+ continue;
250
+ }
251
+ const currLen = payload.issues.length;
252
+ const _ = ch._zod.check(payload as any) as any as ParsePayload;
236
253
 
237
- if (_ instanceof Promise && ctx?.async === false) {
238
- throw new core.$ZodAsyncError();
239
- }
240
- if (asyncResult || _ instanceof Promise) {
241
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
242
- await _;
254
+ if (_ instanceof Promise && ctx?.async === false) {
255
+ throw new core.$ZodAsyncError();
256
+ }
257
+ if (asyncResult || _ instanceof Promise) {
258
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
259
+ await _;
260
+ const nextLen = payload.issues.length;
261
+ if (nextLen === currLen) return;
262
+ util.attachSchema(payload.issues, currLen, inst);
263
+ if (!isAborted) isAborted = util.aborted(payload, currLen);
264
+ });
265
+ } else {
243
266
  const nextLen = payload.issues.length;
244
- if (nextLen === currLen) return;
267
+ if (nextLen === currLen) continue;
268
+ util.attachSchema(payload.issues, currLen, inst);
245
269
  if (!isAborted) isAborted = util.aborted(payload, currLen);
270
+ }
271
+ }
272
+
273
+ if (asyncResult) {
274
+ return asyncResult.then(() => {
275
+ return payload;
246
276
  });
247
- } else {
248
- const nextLen = payload.issues.length;
249
- if (nextLen === currLen) continue;
250
- if (!isAborted) isAborted = util.aborted(payload, currLen);
251
277
  }
252
- }
278
+ return payload;
279
+ };
253
280
 
254
- if (asyncResult) {
255
- return asyncResult.then(() => {
256
- return payload;
257
- });
258
- }
259
- return payload;
260
- };
281
+ const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
282
+ // abort if the canary is aborted
283
+ if (util.aborted(canary)) {
284
+ canary.aborted = true;
285
+ return canary;
286
+ }
261
287
 
262
- const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
263
- // abort if the canary is aborted
264
- if (util.aborted(canary)) {
265
- canary.aborted = true;
266
- return canary;
267
- }
288
+ // run checks first, then
289
+ const checkResult = runChecks(payload, checks, ctx);
290
+ if (checkResult instanceof Promise) {
291
+ if (ctx.async === false) throw new core.$ZodAsyncError();
292
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
293
+ }
294
+ return inst._zod.parse(checkResult, ctx);
295
+ };
268
296
 
269
- // run checks first, then
270
- const checkResult = runChecks(payload, checks, ctx);
271
- if (checkResult instanceof Promise) {
272
- if (ctx.async === false) throw new core.$ZodAsyncError();
273
- return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
274
- }
275
- return inst._zod.parse(checkResult, ctx);
276
- };
297
+ inst._zod.run = (payload, ctx) => {
298
+ if (ctx.skipChecks) {
299
+ return inst._zod.parse(payload, ctx);
300
+ }
301
+ if (ctx.direction === "backward") {
302
+ // run canary initial pass (no checks)
303
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
277
304
 
278
- inst._zod.run = (payload, ctx) => {
279
- if (ctx.skipChecks) {
280
- return inst._zod.parse(payload, ctx);
281
- }
282
- if (ctx.direction === "backward") {
283
- // run canary
284
- // initial pass (no checks)
285
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
305
+ if (canary instanceof Promise) {
306
+ return canary.then((canary) => {
307
+ return handleCanaryResult(canary, payload, ctx);
308
+ });
309
+ }
286
310
 
287
- if (canary instanceof Promise) {
288
- return canary.then((canary) => {
289
- return handleCanaryResult(canary, payload, ctx);
290
- });
311
+ return handleCanaryResult(canary, payload, ctx);
291
312
  }
292
313
 
293
- return handleCanaryResult(canary, payload, ctx);
294
- }
295
-
296
- // forward
297
- const result = inst._zod.parse(payload, ctx);
298
- if (result instanceof Promise) {
299
- if (ctx.async === false) throw new core.$ZodAsyncError();
300
- return result.then((result) => runChecks(result, checks, ctx));
301
- }
314
+ // forward
315
+ const result = inst._zod.parse(payload, ctx);
316
+ if (result instanceof Promise) {
317
+ if (ctx.async === false) throw new core.$ZodAsyncError();
318
+ return result.then((result) => runChecks(result, checks, ctx));
319
+ }
302
320
 
303
- return runChecks(result, checks, ctx);
304
- };
321
+ return runChecks(result, checks, ctx);
322
+ };
323
+ }
324
+ },
325
+ {
326
+ // Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
327
+ get "~standard"(): StandardSchemaV1.Props<any, any> {
328
+ return util.hide(this, "~standard", standardProps(this));
329
+ },
330
+ set "~standard"(value: StandardSchemaV1.Props<any, any>) {
331
+ util.own(this, "~standard", value);
332
+ },
305
333
  }
334
+ );
335
+
336
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
337
+ // a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
338
+ const toStandardResult = (r: ParsePayload, ctx: ParseContextInternal) =>
339
+ r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
306
340
 
307
- // Lazy initialize ~standard to avoid creating objects for every schema
308
- util.defineLazy(inst, "~standard", () => ({
341
+ async function validateAsync(inst: $ZodType, value: unknown) {
342
+ const ctx: ParseContextInternal = { async: true };
343
+ return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)) as ParsePayload, ctx);
344
+ }
345
+
346
+ export function standardProps(inst: $ZodType): StandardSchemaV1.Props<any, any> {
347
+ return {
309
348
  validate: (value: unknown) => {
349
+ const ctx: ParseContextInternal = { async: false };
310
350
  try {
311
- const r = safeParse(inst, value);
312
- return r.success ? { value: r.data } : { issues: r.error?.issues };
313
- } catch (_) {
314
- return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
315
- }
351
+ const r = inst._zod.run({ value, issues: [] }, ctx);
352
+ if (!(r instanceof Promise)) return toStandardResult(r, ctx);
353
+ } catch (_) {}
354
+ // async function so a synchronously throwing check rejects instead of escaping validate
355
+ return validateAsync(inst, value);
316
356
  },
317
357
  vendor: "zod",
318
358
  version: 1 as const,
319
- }));
320
- });
359
+ };
360
+ }
321
361
 
322
362
  export { clone } from "./util.js";
323
363
 
@@ -347,6 +387,8 @@ export interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, In
347
387
  patterns: Set<RegExp>;
348
388
  format: string;
349
389
  contentEncoding: string;
390
+ /** the pattern admits strings its `format` keyword forbids, so `toJSONSchema` must not emit it */
391
+ laxFormat: boolean;
350
392
  }>;
351
393
  }
352
394
 
@@ -356,7 +398,8 @@ export interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInterna
356
398
 
357
399
  export const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
358
400
  $ZodType.init(inst, def);
359
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
401
+ // a format's own pattern, else unbounded; a template literal derives the check-aware form itself
402
+ inst._zod.pattern = (def as $ZodStringFormatDef).pattern ?? regexes.anyString;
360
403
  inst._zod.parse = (payload, _) => {
361
404
  if (def.coerce)
362
405
  try {
@@ -477,71 +520,133 @@ export interface $ZodURL extends $ZodType {
477
520
  _zod: $ZodURLInternals;
478
521
  }
479
522
 
523
+ /** The `://` guard rejected the input before the URL constructor saw it. */
524
+ export const URL_BAD_FORMAT = 1;
525
+ /** The URL parser rejected the input. */
526
+ export const URL_UNPARSEABLE = 2;
527
+
528
+ export function canParseURL(input: string): boolean {
529
+ try {
530
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
531
+ new URL(input);
532
+ return true;
533
+ } catch {
534
+ return false;
535
+ }
536
+ }
537
+
538
+ export function validateURL(
539
+ trimmed: string,
540
+ def: Pick<$ZodURLDef, "protocol" | "hostname" | "normalize">
541
+ ): URL | true | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE {
542
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
543
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
544
+ }
545
+ return parseURLObject(trimmed, def);
546
+ }
547
+
548
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
549
+ export function parseURLObject(
550
+ trimmed: string,
551
+ def: Pick<$ZodURLDef, "protocol" | "normalize">
552
+ ): URL | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE {
553
+ // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
554
+ if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
555
+ return URL_BAD_FORMAT;
556
+ }
557
+
558
+ try {
559
+ if (typeof URL !== "undefined") {
560
+ const URLStatic = URL as typeof URL & { parse?: (input: string) => URL | null };
561
+ if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
562
+ }
563
+ // @ts-ignore
564
+ return new URL(trimmed);
565
+ } catch {
566
+ return URL_UNPARSEABLE;
567
+ }
568
+ }
569
+
570
+ const asciiTabOrNewline = /[\t\n\r]/g;
571
+
572
+ /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
573
+ export function stripTabAndNewline(value: string): string {
574
+ return value.replace(asciiTabOrNewline, "");
575
+ }
576
+
577
+ export function urlHostnameOk(url: URL, hostname: RegExp): boolean {
578
+ hostname.lastIndex = 0;
579
+ return hostname.test(url.hostname);
580
+ }
581
+
582
+ export function urlProtocolOk(url: URL, protocol: RegExp): boolean {
583
+ protocol.lastIndex = 0;
584
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
585
+ }
586
+
480
587
  export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
481
588
  $ZodStringFormat.init(inst, def);
482
589
  inst._zod.check = (payload) => {
483
590
  try {
484
591
  // Trim whitespace from input
485
592
  const trimmed = payload.value.trim();
593
+ const url = validateURL(trimmed, def);
486
594
 
487
- // When normalize is off, require :// for http/https URLs
488
- // This prevents strings like "http:example.com" or "https:/path" from being silently accepted
489
- if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source) {
490
- if (!/^https?:\/\//i.test(trimmed)) {
491
- payload.issues.push({
492
- code: "invalid_format",
493
- format: "url",
494
- note: "Invalid URL format",
495
- input: payload.value,
496
- inst,
497
- continue: !def.abort,
498
- });
499
- return;
500
- }
595
+ if (url === URL_BAD_FORMAT) {
596
+ payload.issues.push({
597
+ code: "invalid_format",
598
+ format: "url",
599
+ note: "Invalid URL format",
600
+ input: payload.value,
601
+ inst,
602
+ continue: !def.abort,
603
+ });
604
+ return;
501
605
  }
502
606
 
503
- // @ts-ignore
504
- const url = new URL(trimmed);
607
+ if (url === URL_UNPARSEABLE) {
608
+ payload.issues.push({
609
+ code: "invalid_format",
610
+ format: "url",
611
+ input: payload.value,
612
+ inst,
613
+ continue: !def.abort,
614
+ });
615
+ return;
616
+ }
505
617
 
506
- if (def.hostname) {
507
- def.hostname.lastIndex = 0;
508
- if (!def.hostname.test(url.hostname)) {
509
- payload.issues.push({
510
- code: "invalid_format",
511
- format: "url",
512
- note: "Invalid hostname",
513
- pattern: def.hostname.source,
514
- input: payload.value,
515
- inst,
516
- continue: !def.abort,
517
- });
518
- }
618
+ if (url === true) {
619
+ payload.value = stripTabAndNewline(trimmed);
620
+ return;
519
621
  }
520
622
 
521
- if (def.protocol) {
522
- def.protocol.lastIndex = 0;
523
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
524
- payload.issues.push({
525
- code: "invalid_format",
526
- format: "url",
527
- note: "Invalid protocol",
528
- pattern: def.protocol.source,
529
- input: payload.value,
530
- inst,
531
- continue: !def.abort,
532
- });
533
- }
623
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) {
624
+ payload.issues.push({
625
+ code: "invalid_format",
626
+ format: "url",
627
+ note: "Invalid hostname",
628
+ pattern: def.hostname.source,
629
+ input: payload.value,
630
+ inst,
631
+ continue: !def.abort,
632
+ });
534
633
  }
535
634
 
536
- // Set the output value based on normalize flag
537
- if (def.normalize) {
538
- // Use normalized URL
539
- payload.value = url.href;
540
- } else {
541
- // Preserve the original input (trimmed)
542
- payload.value = trimmed;
635
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) {
636
+ payload.issues.push({
637
+ code: "invalid_format",
638
+ format: "url",
639
+ note: "Invalid protocol",
640
+ pattern: def.protocol.source,
641
+ input: payload.value,
642
+ inst,
643
+ continue: !def.abort,
644
+ });
543
645
  }
544
646
 
647
+ // Set the output value based on normalize flag
648
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
649
+
545
650
  return;
546
651
  } catch (_) {
547
652
  payload.issues.push({
@@ -574,8 +679,12 @@ export const $ZodEmoji: core.$constructor<$ZodEmoji> = /*@__PURE__*/ core.$const
574
679
 
575
680
  ////////////////////////////// ZodNanoID //////////////////////////////
576
681
 
577
- export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {}
578
- export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {}
682
+ export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {
683
+ length?: number | undefined;
684
+ }
685
+ export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
686
+ def: $ZodNanoIDDef;
687
+ }
579
688
 
580
689
  export interface $ZodNanoID extends $ZodType {
581
690
  _zod: $ZodNanoIDInternals;
@@ -584,7 +693,9 @@ export interface $ZodNanoID extends $ZodType {
584
693
  export const $ZodNanoID: core.$constructor<$ZodNanoID> = /*@__PURE__*/ core.$constructor(
585
694
  "$ZodNanoID",
586
695
  (inst, def): void => {
587
- def.pattern ??= regexes.nanoid;
696
+ if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
697
+ throw new Error(`Invalid nanoid length: ${def.length}`);
698
+ def.pattern ??= def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length);
588
699
  $ZodStringFormat.init(inst, def);
589
700
  }
590
701
  );
@@ -782,8 +893,6 @@ export interface $ZodIPv4 extends $ZodType {
782
893
  export const $ZodIPv4: core.$constructor<$ZodIPv4> = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def): void => {
783
894
  def.pattern ??= regexes.ipv4;
784
895
  $ZodStringFormat.init(inst, def);
785
-
786
- inst._zod.bag.format = `ipv4`;
787
896
  });
788
897
 
789
898
  ////////////////////////////// ZodIPv6 //////////////////////////////
@@ -800,18 +909,20 @@ export interface $ZodIPv6 extends $ZodType {
800
909
  _zod: $ZodIPv6Internals;
801
910
  }
802
911
 
912
+ /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
913
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
914
+
915
+ export function isValidIPv6(value: string): boolean {
916
+ if (!ipv6Alphabet.test(value)) return false;
917
+ return canParseURL(`http://[${value}]`);
918
+ }
919
+
803
920
  export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def): void => {
804
921
  def.pattern ??= regexes.ipv6;
805
922
  $ZodStringFormat.init(inst, def);
806
923
 
807
- inst._zod.bag.format = `ipv6`;
808
-
809
924
  inst._zod.check = (payload) => {
810
- try {
811
- // @ts-ignore
812
- new URL(`http://[${payload.value}]`);
813
- // return;
814
- } catch {
925
+ if (!isValidIPv6(payload.value)) {
815
926
  payload.issues.push({
816
927
  code: "invalid_format",
817
928
  format: "ipv6",
@@ -839,8 +950,6 @@ export interface $ZodMAC extends $ZodType {
839
950
  export const $ZodMAC: core.$constructor<$ZodMAC> = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def): void => {
840
951
  def.pattern ??= regexes.mac(def.delimiter);
841
952
  $ZodStringFormat.init(inst, def);
842
-
843
- inst._zod.bag.format = `mac`;
844
953
  });
845
954
 
846
955
  ////////////////////////////// ZodCIDRv4 //////////////////////////////
@@ -879,6 +988,17 @@ export interface $ZodCIDRv6 extends $ZodType {
879
988
  _zod: $ZodCIDRv6Internals;
880
989
  }
881
990
 
991
+ export function isValidCIDRv6(value: string): boolean {
992
+ const parts = value.split("/");
993
+ if (parts.length !== 2) return false;
994
+ const [address, prefix] = parts;
995
+ if (!prefix) return false;
996
+ const prefixNum = Number(prefix);
997
+ if (`${prefixNum}` !== prefix) return false;
998
+ if (prefixNum < 0 || prefixNum > 128) return false;
999
+ return isValidIPv6(address);
1000
+ }
1001
+
882
1002
  export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$constructor(
883
1003
  "$ZodCIDRv6",
884
1004
  (inst, def): void => {
@@ -886,17 +1006,7 @@ export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$con
886
1006
  $ZodStringFormat.init(inst, def);
887
1007
 
888
1008
  inst._zod.check = (payload) => {
889
- const parts = payload.value.split("/");
890
- try {
891
- if (parts.length !== 2) throw new Error();
892
- const [address, prefix] = parts;
893
- if (!prefix) throw new Error();
894
- const prefixNum = Number(prefix);
895
- if (`${prefixNum}` !== prefix) throw new Error();
896
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
897
- // @ts-ignore
898
- new URL(`http://[${address}]`);
899
- } catch {
1009
+ if (!isValidCIDRv6(payload.value)) {
900
1010
  payload.issues.push({
901
1011
  code: "invalid_format",
902
1012
  format: "cidrv6",
@@ -931,14 +1041,15 @@ export interface $ZodBase64 extends $ZodType {
931
1041
  _zod: $ZodBase64Internals;
932
1042
  }
933
1043
 
1044
+ // lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
1045
+ export const base64Charset: RegExp = /^[0-9a-zA-Z+/]*={0,2}$/;
1046
+
934
1047
  export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$constructor(
935
1048
  "$ZodBase64",
936
1049
  (inst, def): void => {
937
- def.pattern ??= regexes.base64;
1050
+ def.pattern ??= base64Charset;
938
1051
  $ZodStringFormat.init(inst, def);
939
1052
 
940
- inst._zod.bag.contentEncoding = "base64";
941
-
942
1053
  inst._zod.check = (payload) => {
943
1054
  if (isValidBase64(payload.value)) return;
944
1055
 
@@ -953,9 +1064,12 @@ export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$con
953
1064
  }
954
1065
  );
955
1066
 
956
- ////////////////////////////// ZodBase64 //////////////////////////////
1067
+ ////////////////////////////// ZodBase64URL //////////////////////////////
1068
+ // lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
1069
+ export const base64urlCharset: RegExp = /^[A-Za-z0-9_-]*$/;
1070
+
957
1071
  export function isValidBase64URL(data: string): boolean {
958
- if (!regexes.base64url.test(data)) return false;
1072
+ if (!base64urlCharset.test(data)) return false;
959
1073
  const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
960
1074
  const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
961
1075
  return isValidBase64(padded);
@@ -971,11 +1085,9 @@ export interface $ZodBase64URL extends $ZodType {
971
1085
  export const $ZodBase64URL: core.$constructor<$ZodBase64URL> = /*@__PURE__*/ core.$constructor(
972
1086
  "$ZodBase64URL",
973
1087
  (inst, def): void => {
974
- def.pattern ??= regexes.base64url;
1088
+ def.pattern ??= base64urlCharset;
975
1089
  $ZodStringFormat.init(inst, def);
976
1090
 
977
- inst._zod.bag.contentEncoding = "base64url";
978
-
979
1091
  inst._zod.check = (payload) => {
980
1092
  if (isValidBase64URL(payload.value)) return;
981
1093
 
@@ -1004,6 +1116,103 @@ export const $ZodE164: core.$constructor<$ZodE164> = /*@__PURE__*/ core.$constru
1004
1116
  $ZodStringFormat.init(inst, def);
1005
1117
  });
1006
1118
 
1119
+ ////////////////////////////// ZodCreditCard //////////////////////////////
1120
+
1121
+ const CC_SANITIZE = /[- ]/g;
1122
+
1123
+ /** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
1124
+ function isLuhnAlgo(digits: string): boolean {
1125
+ let length = digits.length;
1126
+ let bit = 1;
1127
+ let sum = 0;
1128
+ while (length) {
1129
+ const value = digits.charCodeAt(--length) - 48;
1130
+ bit ^= 1;
1131
+ sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value]! : value;
1132
+ }
1133
+ return sum % 10 === 0;
1134
+ }
1135
+
1136
+ export function isValidCreditCard(input: string): boolean {
1137
+ if (!regexes.creditCard.test(input)) return false;
1138
+ return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
1139
+ }
1140
+
1141
+ export interface $ZodCreditCardDef extends $ZodStringFormatDef<"credit_card"> {}
1142
+ export interface $ZodCreditCardInternals extends $ZodStringFormatInternals<"credit_card"> {
1143
+ def: $ZodCreditCardDef;
1144
+ }
1145
+
1146
+ export interface $ZodCreditCard extends $ZodType {
1147
+ _zod: $ZodCreditCardInternals;
1148
+ }
1149
+
1150
+ export const $ZodCreditCard: core.$constructor<$ZodCreditCard> = /*@__PURE__*/ core.$constructor(
1151
+ "$ZodCreditCard",
1152
+ (inst, def): void => {
1153
+ // Shape only — the Luhn check below is not expressible as a pattern, so consumers of `pattern` (JSON Schema, template literals) get the length and separator rules alone.
1154
+ def.pattern ??= regexes.creditCard;
1155
+ $ZodStringFormat.init(inst, def);
1156
+ inst._zod.check = (payload) => {
1157
+ if (isValidCreditCard(payload.value)) return;
1158
+ payload.issues.push({
1159
+ code: "invalid_format",
1160
+ format: "credit_card",
1161
+ input: payload.value,
1162
+ inst,
1163
+ continue: !def.abort,
1164
+ });
1165
+ };
1166
+ }
1167
+ );
1168
+
1169
+ ////////////////////////////// ZodIBAN //////////////////////////////
1170
+
1171
+ // iso 7064 mod 97-10 checksum without BigInt
1172
+ function isIso7064Mod97(iban: string): boolean {
1173
+ let remainder = 0;
1174
+ const len = iban.length;
1175
+ for (let i = 4; i < len; i++) {
1176
+ const code = iban.charCodeAt(i);
1177
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
1178
+ }
1179
+ for (let i = 0; i < 4; i++) {
1180
+ const code = iban.charCodeAt(i);
1181
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
1182
+ }
1183
+ return remainder === 1;
1184
+ }
1185
+
1186
+ export function isValidIBAN(input: string): boolean {
1187
+ if (!regexes.iban.test(input)) return false;
1188
+ return isIso7064Mod97(input);
1189
+ }
1190
+
1191
+ export interface $ZodIBANDef extends $ZodStringFormatDef<"iban"> {}
1192
+ export interface $ZodIBANInternals extends $ZodStringFormatInternals<"iban"> {
1193
+ def: $ZodIBANDef;
1194
+ }
1195
+
1196
+ export interface $ZodIBAN extends $ZodType {
1197
+ _zod: $ZodIBANInternals;
1198
+ }
1199
+
1200
+ export const $ZodIBAN: core.$constructor<$ZodIBAN> = /*@__PURE__*/ core.$constructor("$ZodIBAN", (inst, def): void => {
1201
+ // shape only — checksum is not expressible as a pattern
1202
+ def.pattern ??= regexes.iban;
1203
+ $ZodStringFormat.init(inst, def);
1204
+ inst._zod.check = (payload) => {
1205
+ if (isValidIBAN(payload.value)) return;
1206
+ payload.issues.push({
1207
+ code: "invalid_format",
1208
+ format: "iban",
1209
+ input: payload.value,
1210
+ inst,
1211
+ continue: !def.abort,
1212
+ });
1213
+ };
1214
+ });
1215
+
1007
1216
  ////////////////////////////// ZodJWT //////////////////////////////
1008
1217
 
1009
1218
  export function isValidJWT(token: string, algorithm: util.JWTAlgorithm | null = null): boolean {
@@ -1120,7 +1329,7 @@ export interface $ZodNumber<Input = unknown> extends $ZodType {
1120
1329
  export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
1121
1330
  $ZodType.init(inst, def);
1122
1331
 
1123
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
1332
+ inst._zod.pattern = regexes.number;
1124
1333
  inst._zod.parse = (payload, _ctx) => {
1125
1334
  if (def.coerce)
1126
1335
  try {
@@ -1136,7 +1345,7 @@ export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$con
1136
1345
  ? Number.isNaN(input)
1137
1346
  ? "NaN"
1138
1347
  : !Number.isFinite(input)
1139
- ? "Infinity"
1348
+ ? String(input)
1140
1349
  : undefined
1141
1350
  : undefined;
1142
1351
 
@@ -1155,15 +1364,19 @@ export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$con
1155
1364
  ///////////////////////////////////////////////
1156
1365
  ////////// ZodNumberFormat //////////
1157
1366
  ///////////////////////////////////////////////
1158
- export interface $ZodNumberFormatDef extends $ZodNumberDef, checks.$ZodCheckNumberFormatDef {}
1159
-
1160
- export interface $ZodNumberFormatInternals extends $ZodNumberInternals<number>, checks.$ZodCheckNumberFormatInternals {
1161
- def: $ZodNumberFormatDef;
1367
+ export interface $ZodNumberFormatDef<Format extends $ZodNumberFormats = $ZodNumberFormats>
1368
+ extends $ZodNumberDef,
1369
+ checks.$ZodCheckNumberFormatDef<Format> {}
1370
+
1371
+ export interface $ZodNumberFormatInternals<Format extends $ZodNumberFormats = $ZodNumberFormats>
1372
+ extends $ZodNumberInternals<number>,
1373
+ checks.$ZodCheckNumberFormatInternals<Format> {
1374
+ def: $ZodNumberFormatDef<Format>;
1162
1375
  isst: errors.$ZodIssueInvalidType;
1163
1376
  }
1164
1377
 
1165
- export interface $ZodNumberFormat extends $ZodType {
1166
- _zod: $ZodNumberFormatInternals;
1378
+ export interface $ZodNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodType {
1379
+ _zod: $ZodNumberFormatInternals<Format>;
1167
1380
  }
1168
1381
 
1169
1382
  export const $ZodNumberFormat: core.$constructor<$ZodNumberFormat> = /*@__PURE__*/ core.$constructor(
@@ -1278,16 +1491,20 @@ export const $ZodBigInt: core.$constructor<$ZodBigInt> = /*@__PURE__*/ core.$con
1278
1491
  ///////////////////////////////////////////////
1279
1492
  ////////// ZodBigIntFormat //////////
1280
1493
  ///////////////////////////////////////////////
1281
- export interface $ZodBigIntFormatDef extends $ZodBigIntDef, checks.$ZodCheckBigIntFormatDef {
1494
+ export interface $ZodBigIntFormatDef<Format extends $ZodBigIntFormats = $ZodBigIntFormats>
1495
+ extends $ZodBigIntDef,
1496
+ checks.$ZodCheckBigIntFormatDef<Format> {
1282
1497
  check: "bigint_format";
1283
1498
  }
1284
1499
 
1285
- export interface $ZodBigIntFormatInternals extends $ZodBigIntInternals<bigint>, checks.$ZodCheckBigIntFormatInternals {
1286
- def: $ZodBigIntFormatDef;
1500
+ export interface $ZodBigIntFormatInternals<Format extends $ZodBigIntFormats = $ZodBigIntFormats>
1501
+ extends $ZodBigIntInternals<bigint>,
1502
+ checks.$ZodCheckBigIntFormatInternals<Format> {
1503
+ def: $ZodBigIntFormatDef<Format>;
1287
1504
  }
1288
1505
 
1289
- export interface $ZodBigIntFormat extends $ZodType {
1290
- _zod: $ZodBigIntFormatInternals;
1506
+ export interface $ZodBigIntFormat<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodType {
1507
+ _zod: $ZodBigIntFormatInternals<Format>;
1291
1508
  }
1292
1509
 
1293
1510
  export const $ZodBigIntFormat: core.$constructor<$ZodBigIntFormat> = /*@__PURE__*/ core.$constructor(
@@ -1627,6 +1844,34 @@ export interface $ZodArrayInternals<T extends SomeType = $ZodType> extends _$Zod
1627
1844
 
1628
1845
  export interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<any, any, $ZodArrayInternals<T>> {}
1629
1846
 
1847
+ // an oversized container fails its leading size checks before any element is parsed
1848
+ function capSize(inst: $ZodType, size: (input: any) => number): void {
1849
+ const caps = util.sizeCaps(inst._zod.def.checks);
1850
+ if (!caps.length) return;
1851
+ const cap = Math.min(...caps.map((c) => c[0]));
1852
+ const parse = inst._zod.parse;
1853
+ inst._zod.parse = (payload, ctx) => {
1854
+ const n = size(payload.value);
1855
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
1856
+ for (const [max, ch] of util.sizeCaps(inst._zod.def.checks)) {
1857
+ if (n > max && ch._zod.def.when!(payload)) {
1858
+ const start = payload.issues.length;
1859
+ ch._zod.check(payload as ParsePayload<never>);
1860
+ // the value is still the raw input, so no later check may read it
1861
+ (payload.issues[start] as { continue?: boolean }).continue = false;
1862
+ util.attachSchema(payload.issues, start, inst);
1863
+ return payload;
1864
+ }
1865
+ }
1866
+ }
1867
+ return parse(payload, ctx);
1868
+ };
1869
+ }
1870
+
1871
+ const arraySize = (input: unknown): number => (Array.isArray(input) ? input.length : -1);
1872
+ const mapSize = (input: unknown): number => (input instanceof Map ? input.size : -1);
1873
+ const setSize = (input: unknown): number => (input instanceof Set ? input.size : -1);
1874
+
1630
1875
  function handleArrayResult(result: ParsePayload<any>, final: ParsePayload<any[]>, index: number) {
1631
1876
  if (result.issues.length) {
1632
1877
  final.issues.push(...util.prefixIssues(index, result.issues));
@@ -1637,6 +1882,9 @@ function handleArrayResult(result: ParsePayload<any>, final: ParsePayload<any[]>
1637
1882
  export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
1638
1883
  $ZodType.init(inst, def);
1639
1884
 
1885
+ const memo = core.globalConfig.memoizer;
1886
+ memo?.attach(inst);
1887
+
1640
1888
  inst._zod.parse = (payload, ctx) => {
1641
1889
  const input = payload.value;
1642
1890
 
@@ -1651,8 +1899,9 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1651
1899
  return payload;
1652
1900
  }
1653
1901
 
1654
- payload.value = Array(input.length);
1902
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1655
1903
  const proms: Promise<any>[] = [];
1904
+ const abortEarly = ctx?.abortEarly;
1656
1905
  for (let i = 0; i < input.length; i++) {
1657
1906
  const item = input[i];
1658
1907
  const result = def.element._zod.run(
@@ -1667,6 +1916,8 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1667
1916
  proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1668
1917
  } else {
1669
1918
  handleArrayResult(result, payload, i);
1919
+ // the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
1920
+ if (abortEarly && result.issues.length !== 0 && util.aborted(result)) break;
1670
1921
  }
1671
1922
  }
1672
1923
 
@@ -1676,6 +1927,7 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1676
1927
 
1677
1928
  return payload; //handleArrayResultsAsync(parseResults, final);
1678
1929
  };
1930
+ capSize(inst, arraySize);
1679
1931
  });
1680
1932
 
1681
1933
  //////////////////////////////////////////
@@ -1687,12 +1939,12 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1687
1939
  //////////////////////////////////////////
1688
1940
 
1689
1941
  type OptionalOutSchema = { _zod: { optout: "optional" } };
1690
- type OptionalInSchema = { _zod: { optin: "optional" } };
1942
+ type OptionalInSchema = { _zod: { optin: "optional" | "defaulted" } };
1691
1943
 
1692
1944
  export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1693
1945
  ? util.IsAny<T[keyof T]> extends true
1694
1946
  ? Record<string, unknown>
1695
- : Record<string, core.output<T[keyof T]>>
1947
+ : { [k in string]: core.output<T[keyof T]> }
1696
1948
  : keyof (T & Extra) extends never
1697
1949
  ? Record<string, never>
1698
1950
  : util.Prettify<
@@ -1736,7 +1988,7 @@ export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<st
1736
1988
  export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1737
1989
  ? util.IsAny<T[keyof T]> extends true
1738
1990
  ? Record<string, unknown>
1739
- : Record<string, core.input<T[keyof T]>>
1991
+ : { [k in string]: core.input<T[keyof T]> }
1740
1992
  : keyof (T & Extra) extends never
1741
1993
  ? Record<string, never>
1742
1994
  : util.Prettify<
@@ -1752,19 +2004,24 @@ function handlePropertyResult(
1752
2004
  final: ParsePayload,
1753
2005
  key: PropertyKey,
1754
2006
  input: any,
1755
- isOptionalIn: boolean,
1756
- isOptionalOut: boolean
2007
+ optin: "optional" | "defaulted" | undefined,
2008
+ optout: "optional" | undefined
1757
2009
  ) {
1758
2010
  const isPresent = key in input;
2011
+ const isOptionalOut = optout === "optional";
2012
+ // The middle rung means "absence permitted, nothing supplied in its place", so an absent key contributes nothing — whatever the schema made of `undefined` is invented, not substituted. Only `optional` reaches this with a value: `defaulted` substitutes, and a schema that isn't optional-out has to keep the key.
2013
+ if (!isPresent && isOptionalOut && optin === "optional") {
2014
+ return;
2015
+ }
1759
2016
  if (result.issues.length) {
1760
2017
  // For optional-in/out schemas, ignore errors on absent keys.
1761
- if (isOptionalIn && isOptionalOut && !isPresent) {
2018
+ if (optin !== undefined && isOptionalOut && !isPresent) {
1762
2019
  return;
1763
2020
  }
1764
2021
  final.issues.push(...util.prefixIssues(key, result.issues));
1765
2022
  }
1766
2023
 
1767
- if (!isPresent && !isOptionalIn) {
2024
+ if (!isPresent && optin === undefined) {
1768
2025
  if (!result.issues.length) {
1769
2026
  final.issues.push({
1770
2027
  code: "invalid_type",
@@ -1777,7 +2034,7 @@ function handlePropertyResult(
1777
2034
  }
1778
2035
 
1779
2036
  if (result.value === undefined) {
1780
- if (isPresent) {
2037
+ if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
1781
2038
  (final.value as any)[key] = undefined;
1782
2039
  }
1783
2040
  } else {
@@ -1835,18 +2092,27 @@ export interface $ZodObject<
1835
2092
  out Params extends $ZodObjectConfig = $ZodObjectConfig,
1836
2093
  > extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {}
1837
2094
 
2095
+ // one shared instance; a fresh [] per schema cost 56 bytes retained
2096
+ const NO_SYMBOL_KEYS: symbol[] = [];
2097
+
1838
2098
  function normalizeDef(def: $ZodObjectDef) {
1839
2099
  const keys = Object.keys(def.shape);
1840
- for (const k of keys) {
1841
- if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
1842
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
2100
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
2101
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
2102
+ // aliases `keys` when there are no symbols, so a string-only shape keeps one array
2103
+ const allKeys: (string | symbol)[] = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
2104
+ for (const k of allKeys) {
2105
+ if (!(def.shape as any)?.[k]?._zod?.traits?.has("$ZodType")) {
2106
+ throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
1843
2107
  }
1844
2108
  }
1845
2109
  const okeys = util.optionalKeys(def.shape);
1846
2110
 
1847
2111
  return {
1848
2112
  ...def,
1849
- keys,
2113
+ allKeys,
2114
+ symbolKeys,
2115
+ // string-only: handleCatchall matches it against `for...in`, which never yields a symbol
1850
2116
  keySet: new Set(keys),
1851
2117
  numKeys: keys.length,
1852
2118
  optionalKeys: new Set(okeys),
@@ -1857,21 +2123,31 @@ function handleCatchall(
1857
2123
  proms: Promise<any>[],
1858
2124
  input: any,
1859
2125
  payload: ParsePayload,
1860
- ctx: ParseContext,
2126
+ ctx: ParseContextInternal,
1861
2127
  def: ReturnType<typeof normalizeDef>,
1862
- inst: $ZodObject
2128
+ inst: $ZodObject,
2129
+ abortEarly: boolean
1863
2130
  ) {
1864
2131
  const unrecognized: string[] = [];
1865
2132
  const keySet = def.keySet;
1866
2133
  const _catchall = def.catchall!._zod;
1867
2134
  const t = _catchall.def.type;
1868
- const isOptionalIn = _catchall.optin === "optional";
1869
- const isOptionalOut = _catchall.optout === "optional";
2135
+ const optin = _catchall.optin;
2136
+ const optout = _catchall.optout;
2137
+ // starts at 0, not the current length: the shape phase already ran and may have aborted
2138
+ let seen = 0;
1870
2139
  for (const key in input) {
1871
- // skip __proto__ so it can't replace the result prototype via the
1872
- // assignment setter on the plain {} we build into
1873
- if (key === "__proto__") continue;
2140
+ if (abortEarly && payload.issues.length !== seen) {
2141
+ if (util.aborted(payload, seen)) break;
2142
+ seen = payload.issues.length;
2143
+ }
2144
+ // Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
1874
2145
  if (keySet.has(key)) continue;
2146
+ // Don't copy an undeclared __proto__ into the result; assignment to a plain {} would replace the result prototype. But in strict mode it is still an unknown key, so report it before skipping.
2147
+ if (key === "__proto__") {
2148
+ if (t === "never") unrecognized.push(key);
2149
+ continue;
2150
+ }
1875
2151
  if (t === "never") {
1876
2152
  unrecognized.push(key);
1877
2153
  continue;
@@ -1879,9 +2155,9 @@ function handleCatchall(
1879
2155
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1880
2156
 
1881
2157
  if (r instanceof Promise) {
1882
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
2158
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1883
2159
  } else {
1884
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2160
+ handlePropertyResult(r, payload, key, input, optin, optout);
1885
2161
  }
1886
2162
  }
1887
2163
 
@@ -1891,6 +2167,8 @@ function handleCatchall(
1891
2167
  keys: unrecognized,
1892
2168
  input,
1893
2169
  inst,
2170
+ // Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
2171
+ continue: true,
1894
2172
  });
1895
2173
  }
1896
2174
 
@@ -1903,32 +2181,35 @@ function handleCatchall(
1903
2181
  export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
1904
2182
  // requires cast because technically $ZodObject doesn't extend
1905
2183
  $ZodType.init(inst, def);
1906
- // const sh = def.shape;
1907
2184
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
1908
- if (!desc?.get) {
1909
- const sh = def.shape;
1910
- Object.defineProperty(def, "shape", {
1911
- get: () => {
1912
- const newSh = { ...sh };
1913
- Object.defineProperty(def, "shape", {
1914
- value: newSh,
1915
- });
1916
-
1917
- return newSh;
1918
- },
1919
- });
2185
+ // a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
2186
+ const sh = desc?.get ? (desc.get as util.ShapeGetter).raw : (def.shape ?? {});
2187
+ if (sh) {
2188
+ // Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
2189
+ const get: util.ShapeGetter = () => {
2190
+ const newSh = { ...sh };
2191
+ Object.defineProperty(def, "shape", { value: newSh });
2192
+ get.raw = newSh;
2193
+ return newSh;
2194
+ };
2195
+ get.raw = sh;
2196
+ Object.defineProperty(def, "shape", { get });
1920
2197
  }
1921
2198
 
1922
2199
  const _normalized = util.cached(() => normalizeDef(def));
1923
2200
 
1924
- util.defineLazy(inst._zod, "propValues", () => {
1925
- const shape = def.shape;
2201
+ util.defineLazyInternal(inst, "propValues", (zod) => {
2202
+ const shape = zod.def.shape;
1926
2203
  const propValues: util.PropValues = {};
1927
2204
  for (const key in shape) {
1928
2205
  const field = shape[key]!._zod;
1929
2206
  if (field.values) {
1930
- propValues[key] ??= new Set();
2207
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
2208
+ util.assignProp(propValues, key, new Set());
2209
+ }
1931
2210
  for (const v of field.values) propValues[key].add(v);
2211
+ // An omittable slot reads back as undefined at a discriminator lookup, so it has to claim undefined: two options that can both omit the key are not discriminable on it.
2212
+ if (field.optin !== undefined) propValues[key].add(undefined);
1932
2213
  }
1933
2214
  }
1934
2215
  return propValues;
@@ -1938,6 +2219,8 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1938
2219
  const catchall = def.catchall;
1939
2220
 
1940
2221
  let value!: typeof _normalized.value;
2222
+ const memo = core.globalConfig.memoizer;
2223
+ memo?.attach(inst);
1941
2224
 
1942
2225
  inst._zod.parse = (payload, ctx) => {
1943
2226
  value ??= _normalized.value;
@@ -1952,21 +2235,28 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1952
2235
  return payload;
1953
2236
  }
1954
2237
 
1955
- payload.value = {};
2238
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1956
2239
 
1957
2240
  const proms: Promise<any>[] = [];
1958
2241
  const shape = value.shape;
2242
+ const abortEarly = ctx?.abortEarly;
2243
+ let seen = payload.issues.length;
1959
2244
 
1960
- for (const key of value.keys) {
1961
- const el = shape[key]!;
1962
- const isOptionalIn = el._zod.optin === "optional";
1963
- const isOptionalOut = el._zod.optout === "optional";
2245
+ for (const key of value.allKeys) {
2246
+ if (abortEarly && payload.issues.length !== seen) {
2247
+ if (util.aborted(payload, seen)) break;
2248
+ seen = payload.issues.length;
2249
+ }
2250
+ if (key === "__proto__") continue;
2251
+ const el = (shape as any)[key]!;
2252
+ const optin = el._zod.optin;
2253
+ const optout = el._zod.optout;
1964
2254
 
1965
2255
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1966
2256
  if (r instanceof Promise) {
1967
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
2257
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1968
2258
  } else {
1969
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2259
+ handlePropertyResult(r, payload, key, input, optin, optout);
1970
2260
  }
1971
2261
  }
1972
2262
 
@@ -1974,7 +2264,7 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1974
2264
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
1975
2265
  }
1976
2266
 
1977
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2267
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
1978
2268
  };
1979
2269
  });
1980
2270
 
@@ -1987,63 +2277,71 @@ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$
1987
2277
  const superParse = inst._zod.parse;
1988
2278
  const _normalized = util.cached(() => normalizeDef(def));
1989
2279
 
2280
+ const memo = core.globalConfig.memoizer;
2281
+
1990
2282
  const generateFastpass = (shape: any) => {
1991
- const doc = new Doc(["shape", "payload", "ctx"]);
1992
2283
  const normalized = _normalized.value;
1993
-
1994
- const parseStr = (key: string) => {
1995
- const k = util.esc(key);
1996
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1997
- };
2284
+ const syms = normalized.symbolKeys;
2285
+ // a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
2286
+ const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
2287
+
2288
+ const parseStr = (k: string) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2289
+
2290
+ // prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
2291
+ const prefixStr = (id: string, k: string) => `
2292
+ let ${id}_ab = false;
2293
+ for (let i = 0; i < ${id}.issues.length; i++) {
2294
+ const iss = ${id}.issues[i];
2295
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2296
+ payload.issues.push(iss);
2297
+ if (iss.continue !== true) ${id}_ab = true;
2298
+ }
2299
+ if (${id}_ab && ctx && ctx.abortEarly) {
2300
+ payload.value = newResult;
2301
+ return payload;
2302
+ }`;
1998
2303
 
1999
2304
  doc.write(`const input = payload.value;`);
2000
2305
 
2001
2306
  const ids: any = Object.create(null);
2002
2307
  let counter = 0;
2003
- for (const key of normalized.keys) {
2308
+ for (const key of normalized.allKeys) {
2004
2309
  ids[key] = `key_${counter++}`;
2005
2310
  }
2006
2311
 
2007
2312
  // A: preserve key order {
2008
- doc.write(`const newResult = {};`);
2009
- for (const key of normalized.keys) {
2313
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
2314
+ for (const key of normalized.allKeys) {
2315
+ if (key === "__proto__") continue;
2010
2316
  const id = ids[key];
2011
- const k = util.esc(key);
2317
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
2318
+ const isPresent = `${k} in input`;
2012
2319
  const schema = shape[key];
2013
- const isOptionalIn = schema?._zod?.optin === "optional";
2320
+ const optin = schema?._zod?.optin;
2321
+ const isOptionalIn = optin !== undefined;
2014
2322
  const isOptionalOut = schema?._zod?.optout === "optional";
2015
2323
 
2016
- doc.write(`const ${id} = ${parseStr(key)};`);
2324
+ doc.write(`const ${id} = ${parseStr(k)};`);
2017
2325
 
2018
2326
  if (isOptionalIn && isOptionalOut) {
2019
- // For optional-in/out schemas, ignore errors on absent keys
2327
+ // For optional-in/out schemas, ignore errors on absent keys — and, like the interpreted path, drop the value produced alongside them. The middle rung goes further: it permits absence without supplying anything in its place, so an absent key contributes nothing at all.
2328
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2020
2329
  doc.write(`
2021
- if (${id}.issues.length) {
2022
- if (${k} in input) {
2023
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2024
- ...iss,
2025
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2026
- })));
2330
+ const ${id}_present = ${isPresent};
2331
+ if (!${id}.issues.length || ${id}_present) {
2332
+ if (${id}.issues.length) {${prefixStr(id, k)}
2027
2333
  }
2028
- }
2029
-
2030
- if (${id}.value === undefined) {
2031
- if (${k} in input) {
2032
- newResult[${k}] = undefined;
2334
+
2335
+ if (${assign}) {
2336
+ newResult[${k}] = ${id}.value;
2033
2337
  }
2034
- } else {
2035
- newResult[${k}] = ${id}.value;
2036
2338
  }
2037
-
2339
+
2038
2340
  `);
2039
2341
  } else if (!isOptionalIn) {
2040
2342
  doc.write(`
2041
- const ${id}_present = ${k} in input;
2042
- if (${id}.issues.length) {
2043
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2044
- ...iss,
2045
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2046
- })));
2343
+ const ${id}_present = ${isPresent};
2344
+ if (${id}.issues.length) {${prefixStr(id, k)}
2047
2345
  }
2048
2346
  if (!${id}_present && !${id}.issues.length) {
2049
2347
  payload.issues.push({
@@ -2052,42 +2350,38 @@ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$
2052
2350
  input: undefined,
2053
2351
  path: [${k}]
2054
2352
  });
2353
+ if (ctx && ctx.abortEarly) {
2354
+ payload.value = newResult;
2355
+ return payload;
2356
+ }
2055
2357
  }
2056
2358
 
2057
2359
  if (${id}_present) {
2058
- if (${id}.value === undefined) {
2059
- newResult[${k}] = undefined;
2060
- } else {
2061
- newResult[${k}] = ${id}.value;
2062
- }
2360
+ newResult[${k}] = ${id}.value;
2063
2361
  }
2064
2362
 
2065
2363
  `);
2066
2364
  } else {
2067
2365
  doc.write(`
2068
- if (${id}.issues.length) {
2069
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2070
- ...iss,
2071
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2072
- })));
2366
+ if (${id}.issues.length) {${prefixStr(id, k)}
2073
2367
  }
2074
-
2075
- if (${id}.value === undefined) {
2076
- if (${k} in input) {
2077
- newResult[${k}] = undefined;
2078
- }
2079
- } else {
2368
+ `);
2369
+ if (optin === "defaulted") {
2370
+ doc.write(`newResult[${k}] = ${id}.value;`);
2371
+ } else {
2372
+ doc.write(`
2373
+ if (${id}.value !== undefined || ${isPresent}) {
2080
2374
  newResult[${k}] = ${id}.value;
2081
2375
  }
2082
-
2083
2376
  `);
2377
+ }
2084
2378
  }
2085
2379
  }
2086
2380
 
2087
2381
  doc.write(`payload.value = newResult;`);
2088
2382
  doc.write(`return payload;`);
2089
- const fn = doc.compile();
2090
- return (payload: any, ctx: any) => fn(shape, payload, ctx);
2383
+ // closing `shape` in is what pays: turbofan specializes the parser against that one shape object, so every `shape[k]._zod.run` folds to a known callee. as a parameter it stays a generic load and measures 13% slower even with the forwarding frame gone
2384
+ return doc.compile() as (payload: any, ctx: any) => any;
2091
2385
  };
2092
2386
 
2093
2387
  let fastpass!: ReturnType<typeof generateFastpass>;
@@ -2120,7 +2414,7 @@ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$
2120
2414
  payload = fastpass(payload, ctx);
2121
2415
 
2122
2416
  if (!catchall) return payload;
2123
- return handleCatchall([], input, payload, ctx, value, inst);
2417
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
2124
2418
  }
2125
2419
 
2126
2420
  return superParse(payload, ctx);
@@ -2155,7 +2449,7 @@ export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $Zo
2155
2449
  output: $InferUnionOutput<T[number]>;
2156
2450
  input: $InferUnionInput<T[number]>;
2157
2451
  // if any element in the union is optional, then the union is optional
2158
- optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
2452
+ optin: IsOptionalIn<T[number]> extends false ? "optional" | "defaulted" | undefined : "optional" | "defaulted";
2159
2453
  optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
2160
2454
  }
2161
2455
 
@@ -2192,24 +2486,28 @@ function handleUnionResults(results: ParsePayload[], final: ParsePayload, inst:
2192
2486
  export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
2193
2487
  $ZodType.init(inst, def);
2194
2488
 
2195
- util.defineLazy(inst._zod, "optin", () =>
2196
- def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined
2489
+ util.defineLazyInternal(inst, "optin", (zod) =>
2490
+ zod.def.options.some((o) => o._zod.optin === "defaulted")
2491
+ ? "defaulted"
2492
+ : zod.def.options.some((o) => o._zod.optin !== undefined)
2493
+ ? "optional"
2494
+ : undefined
2197
2495
  );
2198
2496
 
2199
- util.defineLazy(inst._zod, "optout", () =>
2200
- def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined
2497
+ util.defineLazyInternal(inst, "optout", (zod) =>
2498
+ zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined
2201
2499
  );
2202
2500
 
2203
- util.defineLazy(inst._zod, "values", () => {
2204
- if (def.options.every((o) => o._zod.values)) {
2205
- return new Set<util.Primitive>(def.options.flatMap((option) => Array.from(option._zod.values!)));
2501
+ util.defineLazyInternal(inst, "values", (zod) => {
2502
+ if (zod.def.options.every((o) => o._zod.values)) {
2503
+ return new Set<util.Primitive>(zod.def.options.flatMap((option) => Array.from(option._zod.values!)));
2206
2504
  }
2207
2505
  return undefined;
2208
2506
  });
2209
2507
 
2210
- util.defineLazy(inst._zod, "pattern", () => {
2211
- if (def.options.every((o) => o._zod.pattern)) {
2212
- const patterns = def.options.map((o) => o._zod.pattern);
2508
+ util.defineLazyInternal(inst, "pattern", (zod) => {
2509
+ if (zod.def.options.every((o) => o._zod.pattern)) {
2510
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
2213
2511
  return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p!.source)).join("|")})$`);
2214
2512
  }
2215
2513
  return undefined;
@@ -2254,14 +2552,17 @@ function handleExclusiveUnionResults(
2254
2552
  inst: $ZodUnion,
2255
2553
  ctx?: ParseContext
2256
2554
  ) {
2257
- const successes = results.filter((r) => r.issues.length === 0);
2555
+ const matches: number[] = [];
2556
+ for (let i = 0; i < results.length; i++) {
2557
+ if (results[i].issues.length === 0) matches.push(i);
2558
+ }
2258
2559
 
2259
- if (successes.length === 1) {
2260
- final.value = successes[0].value;
2560
+ if (matches.length === 1) {
2561
+ final.value = results[matches[0]].value;
2261
2562
  return final;
2262
2563
  }
2263
2564
 
2264
- if (successes.length === 0) {
2565
+ if (matches.length === 0) {
2265
2566
  // No matches - same as regular union
2266
2567
  final.issues.push({
2267
2568
  code: "invalid_union",
@@ -2277,6 +2578,7 @@ function handleExclusiveUnionResults(
2277
2578
  inst,
2278
2579
  errors: [],
2279
2580
  inclusive: false,
2581
+ matches,
2280
2582
  });
2281
2583
  }
2282
2584
 
@@ -2348,6 +2650,65 @@ export interface $ZodDiscriminatedUnionInternals<
2348
2650
  > extends $ZodUnionInternals<Options> {
2349
2651
  def: $ZodDiscriminatedUnionDef<Options, Disc>;
2350
2652
  propValues: util.PropValues;
2653
+ bag: util.LoosePartial<{
2654
+ optionsMap: Map<util.Primitive, $ZodType | null>;
2655
+ }>;
2656
+ }
2657
+
2658
+ /** The discriminator values a member of `Options` can declare. An omittable discriminator contributes `undefined`, matching what `propValues` claims for it. */
2659
+ export type $DiscriminatorValue<Options extends readonly SomeType[], Disc extends string> = {
2660
+ [I in keyof Options]: Options[I] extends { _zod: { output: infer Out } }
2661
+ ? Disc extends keyof Out
2662
+ ? Out[Disc]
2663
+ : never
2664
+ : never;
2665
+ }[number];
2666
+
2667
+ /** The member of `Options` that declares `V`. */
2668
+ export type $DiscriminatedOption<Options extends readonly SomeType[], Disc extends string, V> = {
2669
+ [I in keyof Options]: Options[I] extends { _zod: { output: infer Out } }
2670
+ ? Disc extends keyof Out
2671
+ ? V extends Out[Disc]
2672
+ ? Options[I]
2673
+ : never
2674
+ : never
2675
+ : never;
2676
+ }[number];
2677
+
2678
+ /** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
2679
+ export function getDiscriminatedOption<
2680
+ Options extends readonly SomeType[],
2681
+ Disc extends string,
2682
+ const V extends $DiscriminatorValue<Options, Disc>,
2683
+ >(union: $ZodDiscriminatedUnion<Options, Disc>, value: V): $DiscriminatedOption<Options, Disc, V> {
2684
+ const internals = union._zod;
2685
+ let map = internals.bag.optionsMap;
2686
+ if (!map) {
2687
+ map = discriminatorMap(internals.def);
2688
+ internals.bag.optionsMap = map;
2689
+ }
2690
+ const option = map.get(value as util.Primitive);
2691
+ if (option === null) throw new Error(`Ambiguous discriminator value "${String(value)}"`);
2692
+ return option as any;
2693
+ }
2694
+
2695
+ function discriminatorMap(def: $ZodDiscriminatedUnionDef<readonly SomeType[]>): Map<util.Primitive, $ZodType | null> {
2696
+ const map = new Map<util.Primitive, $ZodType | null>();
2697
+ for (const option of def.options as readonly $ZodType[]) {
2698
+ const values = option._zod.propValues?.[def.discriminator];
2699
+ if (!values || values.size === 0)
2700
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2701
+ for (const value of values) {
2702
+ if (map.has(value)) {
2703
+ if (value !== undefined) throw new Error(`Duplicate discriminator value "${String(value)}"`);
2704
+ // keep the collision marked so a later member cannot reclaim it
2705
+ map.set(value, null);
2706
+ } else {
2707
+ map.set(value, option);
2708
+ }
2709
+ }
2710
+ }
2711
+ return map;
2351
2712
  }
2352
2713
 
2353
2714
  export interface $ZodDiscriminatedUnion<
@@ -2365,39 +2726,37 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2365
2726
  $ZodUnion.init(inst, def);
2366
2727
 
2367
2728
  const _super = inst._zod.parse;
2368
- util.defineLazy(inst._zod, "propValues", () => {
2729
+ util.defineLazyInternal(inst, "propValues", (zod) => {
2369
2730
  const propValues: util.PropValues = {};
2370
- for (const option of def.options) {
2731
+ let undefinedCount = 0;
2732
+ for (const option of zod.def.options) {
2371
2733
  const pv = option._zod.propValues;
2372
2734
  if (!pv || Object.keys(pv).length === 0)
2373
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2735
+ throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2736
+ if (pv[zod.def.discriminator]?.has(undefined)) undefinedCount++;
2374
2737
  for (const [k, v] of Object.entries(pv!)) {
2375
- if (!propValues[k]) propValues[k] = new Set();
2738
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
2739
+ util.assignProp(propValues, k, new Set());
2740
+ }
2376
2741
  for (const val of v) {
2377
2742
  propValues[k].add(val);
2378
2743
  }
2379
2744
  }
2380
2745
  }
2746
+ if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(undefined);
2381
2747
  return propValues;
2382
2748
  });
2383
2749
 
2384
- const disc = util.cached(() => {
2385
- const opts = def.options as $ZodTypeDiscriminable[];
2386
- const map: Map<util.Primitive, $ZodType> = new Map();
2387
- for (const o of opts) {
2388
- const values = o._zod.propValues?.[def.discriminator];
2389
- if (!values || values.size === 0)
2390
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2391
- for (const v of values) {
2392
- if (map.has(v)) {
2393
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
2394
- }
2395
- map.set(v, o);
2396
- }
2750
+ // Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
2751
+ def.options.forEach((option, i) => {
2752
+ const propShape = util.rawShape(option._zod.def);
2753
+ if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
2754
+ throw new Error(`Invalid discriminated union option at index "${i}"`);
2397
2755
  }
2398
- return map;
2399
2756
  });
2400
2757
 
2758
+ const disc = util.cached(() => discriminatorMap(def));
2759
+
2401
2760
  inst._zod.parse = (payload, ctx) => {
2402
2761
  const input = payload.value;
2403
2762
  if (!util.isObject(input)) {
@@ -2411,15 +2770,16 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2411
2770
  return payload;
2412
2771
  }
2413
2772
 
2414
- const opt = disc.value.get(input?.[def.discriminator] as any);
2415
- if (opt) {
2773
+ const value = input?.[def.discriminator];
2774
+ const opt = disc.value.get(value as util.Primitive);
2775
+ // forward metadata cannot choose an encoder for an absent tag
2776
+ if (opt && (value !== undefined || ctx.direction !== "backward")) {
2416
2777
  return opt._zod.run(payload, ctx) as any;
2417
2778
  }
2418
2779
 
2419
2780
  // Fall back to union matching when the fast discriminator path fails:
2420
2781
  // - explicitly enabled via unionFallback, or
2421
- // - during backward direction (encode), since codec-based discriminators
2422
- // have different values in forward vs backward directions
2782
+ // - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
2423
2783
  if (def.unionFallback || ctx.direction === "backward") {
2424
2784
  return _super(payload, ctx);
2425
2785
  }
@@ -2430,7 +2790,7 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2430
2790
  errors: [],
2431
2791
  note: "No matching discriminator",
2432
2792
  discriminator: def.discriminator,
2433
- options: Array.from(disc.value.keys()),
2793
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
2434
2794
  input,
2435
2795
  path: [def.discriminator],
2436
2796
  inst,
@@ -2492,7 +2852,7 @@ export const $ZodIntersection: core.$constructor<$ZodIntersection> = /*@__PURE__
2492
2852
  }
2493
2853
  );
2494
2854
 
2495
- function mergeValues(
2855
+ export function mergeValues(
2496
2856
  a: any,
2497
2857
  b: any
2498
2858
  ): { valid: true; data: any } | { valid: false; mergeErrorPath: (string | number)[] } {
@@ -2510,7 +2870,9 @@ function mergeValues(
2510
2870
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
2511
2871
 
2512
2872
  const newObj: any = { ...a, ...b };
2873
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
2513
2874
  for (const key of sharedKeys) {
2875
+ if (key === "__proto__") continue;
2514
2876
  const sharedValue = mergeValues(a[key], b[key]);
2515
2877
  if (!sharedValue.valid) {
2516
2878
  return {
@@ -2551,44 +2913,52 @@ function mergeValues(
2551
2913
  }
2552
2914
 
2553
2915
  function handleIntersectionResults(result: ParsePayload, left: ParsePayload, right: ParsePayload): ParsePayload {
2554
- // Track which side(s) report each key as unrecognized
2916
+ // Track which side(s) reject each key. A key rejection is reported only when BOTH sides reject it, so a key owned by one branch survives the other's key schema. strictObject reports these as unrecognized_keys; a record with an open key schema reports one invalid_key per key.
2555
2917
  const unrecKeys = new Map<string, { l?: true; r?: true }>();
2556
2918
  let unrecIssue: errors.$ZodRawIssue | undefined;
2919
+ const keyIssues = new Map<string, errors.$ZodRawIssue>();
2557
2920
 
2558
- for (const iss of left.issues) {
2559
- if (iss.code === "unrecognized_keys") {
2921
+ const collect = (iss: errors.$ZodRawIssue, side: "l" | "r"): boolean => {
2922
+ let keys: string[];
2923
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2560
2924
  unrecIssue ??= iss;
2561
- for (const k of iss.keys) {
2562
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2563
- unrecKeys.get(k)!.l = true;
2564
- }
2925
+ keys = iss.keys as string[];
2926
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2927
+ const k = String(iss.path[0]);
2928
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2929
+ keys = [k];
2565
2930
  } else {
2566
- result.issues.push(iss);
2931
+ return false;
2932
+ }
2933
+ for (const k of keys) {
2934
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2935
+ unrecKeys.get(k)![side] = true;
2567
2936
  }
2937
+ return true;
2938
+ };
2939
+
2940
+ for (const iss of left.issues) {
2941
+ if (!collect(iss, "l")) result.issues.push(iss);
2568
2942
  }
2569
2943
 
2570
2944
  for (const iss of right.issues) {
2571
- if (iss.code === "unrecognized_keys") {
2572
- for (const k of iss.keys) {
2573
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2574
- unrecKeys.get(k)!.r = true;
2575
- }
2576
- } else {
2577
- result.issues.push(iss);
2578
- }
2945
+ if (!collect(iss, "r")) result.issues.push(iss);
2579
2946
  }
2580
2947
 
2581
- // Report only keys unrecognized by BOTH sides
2948
+ // Report only keys rejected by BOTH sides
2582
2949
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
2583
- if (bothKeys.length && unrecIssue) {
2584
- result.issues.push({ ...unrecIssue, keys: bothKeys });
2950
+ if (bothKeys.length) {
2951
+ const aggregated = unrecIssue ? bothKeys.filter((k) => (unrecIssue!.keys as string[]).includes(k)) : [];
2952
+ if (aggregated.length) result.issues.push({ ...unrecIssue!, keys: aggregated });
2953
+ for (const k of bothKeys) {
2954
+ if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k)!);
2955
+ }
2585
2956
  }
2586
2957
 
2587
- if (util.aborted(result)) return result;
2588
-
2589
2958
  const merged = mergeValues(left.value, right.value);
2590
2959
 
2591
2960
  if (!merged.valid) {
2961
+ if (util.aborted(result)) return result;
2592
2962
  throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
2593
2963
  }
2594
2964
 
@@ -2624,7 +2994,7 @@ type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly
2624
2994
  ...infer Prefix extends SomeType[],
2625
2995
  infer Tail extends SomeType,
2626
2996
  ]
2627
- ? Tail["_zod"]["optin"] extends "optional"
2997
+ ? Tail["_zod"]["optin"] extends "optional" | "defaulted"
2628
2998
  ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?]
2629
2999
  : TupleInputTypeNoOptionals<T>
2630
3000
  : [];
@@ -2666,6 +3036,8 @@ export interface $ZodTuple<
2666
3036
  export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
2667
3037
  $ZodType.init(inst, def);
2668
3038
  const items = def.items;
3039
+ const memo = core.globalConfig.memoizer;
3040
+ memo?.attach(inst);
2669
3041
 
2670
3042
  inst._zod.parse = (payload, ctx) => {
2671
3043
  const input = payload.value;
@@ -2679,7 +3051,7 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2679
3051
  return payload;
2680
3052
  }
2681
3053
 
2682
- payload.value = [];
3054
+ payload.value = memo ? memo.alloc(inst, payload, [] as unknown[], ctx) : [];
2683
3055
  const proms: Promise<any>[] = [];
2684
3056
 
2685
3057
  const optinStart = getTupleOptStart(items, "optin");
@@ -2709,11 +3081,11 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2709
3081
  }
2710
3082
  }
2711
3083
 
2712
- // Run every item in parallel, collecting results into an indexed
2713
- // array. The post-processing in `handleTupleResults` walks them in
2714
- // order so it can decide whether an absent optional-output error can
2715
- // truncate the tail or must be reported to preserve required output.
3084
+ // Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
2716
3085
  const itemResults: ParsePayload[] = new Array(items.length);
3086
+ // only tracked when there is a rest loop to skip
3087
+ const abortEarly = def.rest ? ctx?.abortEarly : undefined;
3088
+ let itemAborted = false;
2717
3089
  for (let i = 0; i < items.length; i++) {
2718
3090
  const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
2719
3091
  if (r instanceof Promise) {
@@ -2724,13 +3096,20 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2724
3096
  );
2725
3097
  } else {
2726
3098
  itemResults[i] = r;
3099
+ if (abortEarly && !itemAborted && r.issues.length) itemAborted = util.aborted(r);
2727
3100
  }
2728
3101
  }
2729
3102
 
2730
- if (def.rest) {
3103
+ // sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
3104
+ if (def.rest && !itemAborted) {
2731
3105
  let i = items.length - 1;
2732
3106
  const rest = input.slice(items.length);
3107
+ let seen = payload.issues.length;
2733
3108
  for (const el of rest) {
3109
+ if (abortEarly && payload.issues.length !== seen) {
3110
+ if (util.aborted(payload, seen)) break;
3111
+ seen = payload.issues.length;
3112
+ }
2734
3113
  i++;
2735
3114
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
2736
3115
  if (result instanceof Promise) {
@@ -2750,7 +3129,9 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2750
3129
 
2751
3130
  function getTupleOptStart(items: readonly $ZodType[], key: "optin" | "optout") {
2752
3131
  for (let i = items.length - 1; i >= 0; i--) {
2753
- if (items[i]._zod[key] !== "optional") return i + 1;
3132
+ // optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
3133
+ const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
3134
+ if (!omittable) return i + 1;
2754
3135
  }
2755
3136
  return 0;
2756
3137
  }
@@ -2769,12 +3150,15 @@ function handleTupleResults(
2769
3150
  input: unknown[],
2770
3151
  optoutStart: number
2771
3152
  ) {
2772
- // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
2773
- // rule, but only after `optoutStart`: the first index where the output
2774
- // tuple tail can be absent.
3153
+ // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional rule, but only after `optoutStart`: the first index where the output tuple tail can be absent.
2775
3154
  for (let i = 0; i < items.length; i++) {
2776
3155
  const r = itemResults[i];
2777
3156
  const isPresent = i < input.length;
3157
+ // The array analog of `handlePropertyResult`'s absent-key early return: the middle rung permits absence without supplying anything in its place, so the tail truncates here instead of materializing whatever the item made of `undefined`.
3158
+ if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
3159
+ final.value.length = i;
3160
+ break;
3161
+ }
2778
3162
  if (r.issues.length) {
2779
3163
  if (!isPresent && i >= optoutStart) {
2780
3164
  final.value.length = i;
@@ -2817,6 +3201,7 @@ export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value
2817
3201
  valueType: Value;
2818
3202
  /** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
2819
3203
  mode?: "strict" | "loose";
3204
+ partial?: boolean;
2820
3205
  }
2821
3206
 
2822
3207
  // export type $InferZodRecordOutput<
@@ -2856,11 +3241,17 @@ export type $InferZodRecordInput<
2856
3241
  Value extends SomeType = $ZodType,
2857
3242
  > = Key extends $partial
2858
3243
  ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>>
2859
- : Record<core.input<Key> & PropertyKey, core.input<Value>>;
3244
+ : // A value schema that accepts an absent slot makes the key omittable on the way in, exactly as it does in an object shape. The output side keeps every key, since the parser fills each one.
3245
+ [Value] extends [OptionalInSchema]
3246
+ ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>>
3247
+ : Record<core.input<Key> & PropertyKey, core.input<Value>>;
2860
3248
 
2861
3249
  export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2862
- extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
3250
+ extends $ZodTypeInternals {
2863
3251
  def: $ZodRecordDef<Key, Value>;
3252
+ // members rather than base type arguments, which TypeScript 7.1 reports as circular for `z.json()`
3253
+ output: $InferZodRecordOutput<Key, Value>;
3254
+ input: $InferZodRecordInput<Key, Value>;
2864
3255
  isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
2865
3256
  optin?: "optional" | undefined;
2866
3257
  optout?: "optional" | undefined;
@@ -2874,6 +3265,8 @@ export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value ext
2874
3265
 
2875
3266
  export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
2876
3267
  $ZodType.init(inst, def);
3268
+ const memo = core.globalConfig.memoizer;
3269
+ memo?.attach(inst);
2877
3270
 
2878
3271
  inst._zod.parse = (payload, ctx) => {
2879
3272
  const input = payload.value;
@@ -2889,15 +3282,18 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2889
3282
  return payload;
2890
3283
  }
2891
3284
 
3285
+ // no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
2892
3286
  const proms: Promise<any>[] = [];
2893
3287
 
2894
3288
  const values = def.keyType._zod.values;
2895
- if (values) {
2896
- payload.value = {};
3289
+ if (values && !def.partial) {
3290
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2897
3291
  const recordKeys = new Set<string | symbol>();
2898
3292
  for (const key of values) {
2899
3293
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2900
3294
  recordKeys.add(typeof key === "number" ? key.toString() : key);
3295
+ // A declared __proto__ is stripped but is not an unrecognized key.
3296
+ if (key === "__proto__") continue;
2901
3297
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2902
3298
  if (keyResult instanceof Promise) {
2903
3299
  throw new Error("Async schemas not supported in object keys currently");
@@ -2914,6 +3310,7 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2914
3310
  continue;
2915
3311
  }
2916
3312
  const outKey = keyResult.value as PropertyKey;
3313
+ if (outKey === "__proto__") continue;
2917
3314
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2918
3315
 
2919
3316
  if (result instanceof Promise) {
@@ -2937,8 +3334,14 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2937
3334
  let unrecognized!: string[];
2938
3335
  for (const key in input) {
2939
3336
  if (!recordKeys.has(key)) {
2940
- unrecognized = unrecognized ?? [];
2941
- unrecognized.push(key);
3337
+ if (def.mode === "loose") {
3338
+ // skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
3339
+ if (key === "__proto__") continue;
3340
+ payload.value[key] = input[key];
3341
+ } else {
3342
+ unrecognized = unrecognized ?? [];
3343
+ unrecognized.push(key);
3344
+ }
2942
3345
  }
2943
3346
  }
2944
3347
  if (unrecognized && unrecognized.length > 0) {
@@ -2948,10 +3351,13 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2948
3351
  input,
2949
3352
  inst,
2950
3353
  keys: unrecognized,
3354
+ continue: true,
2951
3355
  });
2952
3356
  }
2953
3357
  } else {
2954
- payload.value = {};
3358
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
3359
+ // An enumerable key schema declares which keys the record owns, so a key outside the set is unrecognized. A non-enumerable one (regex, refine) is a constraint every key must satisfy, so a failing key is invalid. Only the former is reconcilable against the other side of an intersection.
3360
+ let unrecognized!: string[];
2955
3361
  // Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
2956
3362
  for (const key of Reflect.ownKeys(input)) {
2957
3363
  if (key === "__proto__") continue;
@@ -2961,8 +3367,7 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2961
3367
  throw new Error("Async schemas not supported in object keys currently");
2962
3368
  }
2963
3369
 
2964
- // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
2965
- // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
3370
+ // Numeric string fallback: if key is a numeric string and failed, retry with Number(key). This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
2966
3371
  const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
2967
3372
  if (checkNumericKey) {
2968
3373
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
@@ -2978,6 +3383,9 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2978
3383
  if (def.mode === "loose") {
2979
3384
  // Pass through unchanged
2980
3385
  payload.value[key] = input[key];
3386
+ } else if (values) {
3387
+ unrecognized = unrecognized ?? [];
3388
+ unrecognized.push(key as string);
2981
3389
  } else {
2982
3390
  // Default "strict" behavior: error on invalid key
2983
3391
  payload.issues.push({
@@ -2992,6 +3400,10 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2992
3400
  continue;
2993
3401
  }
2994
3402
 
3403
+ // the guard above tests the raw input key, but the key schema can normalize an ordinary key into __proto__; re-check the key we actually write under
3404
+ const outKey = keyResult.value as PropertyKey;
3405
+ if (outKey === "__proto__") continue;
3406
+
2995
3407
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2996
3408
 
2997
3409
  if (result instanceof Promise) {
@@ -3000,16 +3412,27 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
3000
3412
  if (result.issues.length) {
3001
3413
  payload.issues.push(...util.prefixIssues(key, result.issues));
3002
3414
  }
3003
- payload.value[keyResult.value as PropertyKey] = result.value;
3415
+ payload.value[outKey] = result.value;
3004
3416
  })
3005
3417
  );
3006
3418
  } else {
3007
3419
  if (result.issues.length) {
3008
3420
  payload.issues.push(...util.prefixIssues(key, result.issues));
3009
3421
  }
3010
- payload.value[keyResult.value as PropertyKey] = result.value;
3422
+ payload.value[outKey] = result.value;
3011
3423
  }
3012
3424
  }
3425
+
3426
+ if (unrecognized && unrecognized.length > 0) {
3427
+ payload.issues.push({
3428
+ code: "unrecognized_keys",
3429
+
3430
+ input,
3431
+ inst,
3432
+ keys: unrecognized,
3433
+ continue: true,
3434
+ });
3435
+ }
3013
3436
  }
3014
3437
 
3015
3438
  if (proms.length) {
@@ -3046,6 +3469,8 @@ export interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType
3046
3469
 
3047
3470
  export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
3048
3471
  $ZodType.init(inst, def);
3472
+ const memo = core.globalConfig.memoizer;
3473
+ memo?.attach(inst);
3049
3474
 
3050
3475
  inst._zod.parse = (payload, ctx) => {
3051
3476
  const input = payload.value;
@@ -3061,9 +3486,15 @@ export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$construct
3061
3486
  }
3062
3487
 
3063
3488
  const proms: Promise<any>[] = [];
3064
- payload.value = new Map();
3489
+ payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
3490
+ const abortEarly = ctx?.abortEarly;
3491
+ let seen = payload.issues.length;
3065
3492
 
3066
3493
  for (const [key, value] of input) {
3494
+ if (abortEarly && payload.issues.length !== seen) {
3495
+ if (util.aborted(payload, seen)) break;
3496
+ seen = payload.issues.length;
3497
+ }
3067
3498
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
3068
3499
  const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
3069
3500
 
@@ -3081,6 +3512,7 @@ export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$construct
3081
3512
  if (proms.length) return Promise.all(proms).then(() => payload);
3082
3513
  return payload;
3083
3514
  };
3515
+ capSize(inst, mapSize);
3084
3516
  });
3085
3517
 
3086
3518
  function handleMapResult(
@@ -3150,6 +3582,8 @@ export interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
3150
3582
 
3151
3583
  export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
3152
3584
  $ZodType.init(inst, def);
3585
+ const memo = core.globalConfig.memoizer;
3586
+ memo?.attach(inst);
3153
3587
 
3154
3588
  inst._zod.parse = (payload, ctx) => {
3155
3589
  const input = payload.value;
@@ -3164,8 +3598,14 @@ export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$construct
3164
3598
  }
3165
3599
 
3166
3600
  const proms: Promise<any>[] = [];
3167
- payload.value = new Set();
3601
+ payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
3602
+ const abortEarly = ctx?.abortEarly;
3603
+ let seen = payload.issues.length;
3168
3604
  for (const item of input) {
3605
+ if (abortEarly && payload.issues.length !== seen) {
3606
+ if (util.aborted(payload, seen)) break;
3607
+ seen = payload.issues.length;
3608
+ }
3169
3609
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
3170
3610
  if (result instanceof Promise) {
3171
3611
  proms.push(result.then((result) => handleSetResult(result, payload)));
@@ -3175,6 +3615,7 @@ export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$construct
3175
3615
  if (proms.length) return Promise.all(proms).then(() => payload);
3176
3616
  return payload;
3177
3617
  };
3618
+ capSize(inst, setSize);
3178
3619
  });
3179
3620
 
3180
3621
  function handleSetResult(result: ParsePayload, final: ParsePayload<Set<any>>) {
@@ -3224,12 +3665,13 @@ export const $ZodEnum: core.$constructor<$ZodEnum> = /*@__PURE__*/ core.$constru
3224
3665
  const valuesSet = new Set<util.Primitive>(values);
3225
3666
  inst._zod.values = valuesSet;
3226
3667
 
3227
- inst._zod.pattern = new RegExp(
3228
- `^(${values
3229
- .filter((k) => util.propertyKeyTypes.has(typeof k))
3230
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
3231
- .join("|")})$`
3232
- );
3668
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3669
+ const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
3670
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
3671
+ return new RegExp(
3672
+ patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$"
3673
+ );
3674
+ });
3233
3675
 
3234
3676
  inst._zod.parse = (payload, _ctx) => {
3235
3677
  const input = payload.value;
@@ -3275,18 +3717,23 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
3275
3717
  "$ZodLiteral",
3276
3718
  (inst, def) => {
3277
3719
  $ZodType.init(inst, def);
3278
- if (def.values.length === 0) {
3279
- throw new Error("Cannot create literal schema with no valid values");
3280
- }
3281
3720
 
3282
3721
  const values = new Set<util.Literal>(def.values);
3283
3722
  inst._zod.values = values;
3284
- inst._zod.pattern = new RegExp(
3285
- `^(${def.values
3286
3723
 
3287
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
3288
- .join("|")})$`
3289
- );
3724
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3725
+ const vals = zod.def.values;
3726
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
3727
+ return new RegExp(
3728
+ vals.length
3729
+ ? `^(${vals
3730
+ .map((o: util.Literal) =>
3731
+ typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)
3732
+ )
3733
+ .join("|")})$`
3734
+ : "^[^\\s\\S]$"
3735
+ );
3736
+ });
3290
3737
 
3291
3738
  inst._zod.parse = (payload, _ctx) => {
3292
3739
  const input = payload.value;
@@ -3423,6 +3870,8 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
3423
3870
  (inst, def) => {
3424
3871
  $ZodType.init(inst, def);
3425
3872
  inst._zod.optin = "optional";
3873
+ core.globalConfig.memoizer?.guard(inst);
3874
+
3426
3875
  inst._zod.parse = (payload, ctx) => {
3427
3876
  if (ctx.direction === "backward") {
3428
3877
  throw new core.$ZodEncodeError(inst.constructor.name);
@@ -3433,7 +3882,6 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
3433
3882
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
3434
3883
  return output.then((output) => {
3435
3884
  payload.value = output;
3436
- payload.fallback = true;
3437
3885
  return payload;
3438
3886
  });
3439
3887
  }
@@ -3443,7 +3891,6 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
3443
3891
  }
3444
3892
 
3445
3893
  payload.value = _out;
3446
- payload.fallback = true;
3447
3894
  return payload;
3448
3895
  };
3449
3896
  }
@@ -3464,7 +3911,7 @@ export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodType
3464
3911
  export interface $ZodOptionalInternals<T extends SomeType = $ZodType>
3465
3912
  extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
3466
3913
  def: $ZodOptionalDef<T>;
3467
- optin: "optional";
3914
+ optin: "optional" | "defaulted";
3468
3915
  optout: "optional";
3469
3916
  isst: never;
3470
3917
  values: T["_zod"]["values"];
@@ -3475,37 +3922,39 @@ export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
3475
3922
  _zod: $ZodOptionalInternals<T>;
3476
3923
  }
3477
3924
 
3478
- function handleOptionalResult(result: ParsePayload, input: unknown) {
3479
- if (input === undefined && (result.issues.length || result.fallback)) {
3480
- return { issues: [], value: undefined };
3481
- }
3482
- return result;
3925
+ function handleOptionalResult(payload: ParsePayload, result: ParsePayload) {
3926
+ // A substituting schema that still failed has no usable answer; yield undefined. Its issues are simply dropped: it ran on a payload of its own, so there is no shared array to truncate and nothing of the caller's to lose with it.
3927
+ payload.value = result.issues.length ? undefined : result.value;
3928
+ return payload;
3483
3929
  }
3484
3930
 
3485
3931
  export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.$constructor(
3486
3932
  "$ZodOptional",
3487
3933
  (inst, def) => {
3488
3934
  $ZodType.init(inst, def);
3489
- inst._zod.optin = "optional";
3935
+ // .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
3936
+ util.defineLazyInternal(inst, "optin", (zod) =>
3937
+ zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"
3938
+ );
3490
3939
  inst._zod.optout = "optional";
3491
3940
 
3492
- util.defineLazy(inst._zod, "values", () => {
3493
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
3941
+ util.defineLazyInternal(inst, "values", (zod) => {
3942
+ const values = (zod.def as $ZodOptionalDef).innerType._zod.values;
3943
+ return values ? new Set([...values, undefined]) : undefined;
3494
3944
  });
3495
- util.defineLazy(inst._zod, "pattern", () => {
3496
- const pattern = def.innerType._zod.pattern;
3945
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3946
+ const pattern = (zod.def as $ZodOptionalDef).innerType._zod.pattern;
3497
3947
  return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
3498
3948
  });
3499
3949
 
3500
3950
  inst._zod.parse = (payload, ctx) => {
3501
- if (def.innerType._zod.optin === "optional") {
3502
- const input = payload.value;
3503
- const result = def.innerType._zod.run(payload, ctx);
3504
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
3505
- return handleOptionalResult(result, input);
3506
- }
3507
3951
  if (payload.value === undefined) {
3508
- return payload;
3952
+ // Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
3953
+ if (def.innerType._zod.optin !== "defaulted") return payload;
3954
+ // Its own payload, for the same reason $ZodCatch gets one: a pipe forwards an unrecognized key through the caller's issues array, and this must not read that as the substituting schema failing and drop it.
3955
+ const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
3956
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
3957
+ return handleOptionalResult(payload, result);
3509
3958
  }
3510
3959
  return def.innerType._zod.run(payload, ctx);
3511
3960
  };
@@ -3541,8 +3990,8 @@ export const $ZodExactOptional: core.$constructor<$ZodExactOptional> = /*@__PURE
3541
3990
  $ZodOptional.init(inst, def);
3542
3991
 
3543
3992
  // Override values/pattern to NOT add undefined
3544
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3545
- util.defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
3993
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3994
+ util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
3546
3995
 
3547
3996
  // Override parse to just delegate (no undefined handling)
3548
3997
  inst._zod.parse = (payload, ctx) => {
@@ -3581,16 +4030,16 @@ export const $ZodNullable: core.$constructor<$ZodNullable> = /*@__PURE__*/ core.
3581
4030
  "$ZodNullable",
3582
4031
  (inst, def) => {
3583
4032
  $ZodType.init(inst, def);
3584
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3585
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
4033
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
4034
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
3586
4035
 
3587
- util.defineLazy(inst._zod, "pattern", () => {
3588
- const pattern = def.innerType._zod.pattern;
4036
+ util.defineLazyInternal(inst, "pattern", (zod) => {
4037
+ const pattern = zod.def.innerType._zod.pattern;
3589
4038
  return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
3590
4039
  });
3591
4040
 
3592
- util.defineLazy(inst._zod, "values", () => {
3593
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
4041
+ util.defineLazyInternal(inst, "values", (zod) => {
4042
+ return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
3594
4043
  });
3595
4044
 
3596
4045
  inst._zod.parse = (payload, ctx) => {
@@ -3619,7 +4068,7 @@ export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeD
3619
4068
  export interface $ZodDefaultInternals<T extends SomeType = $ZodType>
3620
4069
  extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
3621
4070
  def: $ZodDefaultDef<T>;
3622
- optin: "optional";
4071
+ optin: "defaulted";
3623
4072
  optout?: "optional" | undefined; // required
3624
4073
  isst: never;
3625
4074
  values: T["_zod"]["values"];
@@ -3635,8 +4084,8 @@ export const $ZodDefault: core.$constructor<$ZodDefault> = /*@__PURE__*/ core.$c
3635
4084
  $ZodType.init(inst, def);
3636
4085
 
3637
4086
  // inst._zod.qin = "true";
3638
- inst._zod.optin = "optional";
3639
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4087
+ inst._zod.optin = "defaulted";
4088
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3640
4089
 
3641
4090
  inst._zod.parse = (payload, ctx) => {
3642
4091
  if (ctx.direction === "backward") {
@@ -3684,9 +4133,9 @@ export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodType
3684
4133
  }
3685
4134
 
3686
4135
  export interface $ZodPrefaultInternals<T extends SomeType = $ZodType>
3687
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
4136
+ extends $ZodTypeInternals<core.output<T>, core.input<T> | undefined> {
3688
4137
  def: $ZodPrefaultDef<T>;
3689
- optin: "optional";
4138
+ optin: "defaulted";
3690
4139
  optout?: "optional" | undefined;
3691
4140
  isst: never;
3692
4141
  values: T["_zod"]["values"];
@@ -3701,8 +4150,8 @@ export const $ZodPrefault: core.$constructor<$ZodPrefault> = /*@__PURE__*/ core.
3701
4150
  (inst, def) => {
3702
4151
  $ZodType.init(inst, def);
3703
4152
 
3704
- inst._zod.optin = "optional";
3705
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4153
+ inst._zod.optin = "defaulted";
4154
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3706
4155
 
3707
4156
  inst._zod.parse = (payload, ctx) => {
3708
4157
  if (ctx.direction === "backward") {
@@ -3748,8 +4197,8 @@ export const $ZodNonOptional: core.$constructor<$ZodNonOptional> = /*@__PURE__*/
3748
4197
  (inst, def) => {
3749
4198
  $ZodType.init(inst, def);
3750
4199
 
3751
- util.defineLazy(inst._zod, "values", () => {
3752
- const v = def.innerType._zod.values;
4200
+ util.defineLazyInternal(inst, "values", (zod) => {
4201
+ const v = zod.def.innerType._zod.values;
3753
4202
  return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
3754
4203
  });
3755
4204
 
@@ -3893,11 +4342,33 @@ export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
3893
4342
  _zod: $ZodCatchInternals<T>;
3894
4343
  }
3895
4344
 
4345
+ function handleCatchResult(payload: ParsePayload, result: ParsePayload, def: $ZodCatchDef, ctx: ParseContextInternal) {
4346
+ if (!result.issues.length) {
4347
+ payload.value = result.value;
4348
+ // The value carries up, so the flag describing it has to carry with it: a back-edge into a node still being parsed must not be frozen by an enclosing readonly, and its checks belong to the node itself. Guarded so the ordinary case adds no own property.
4349
+ if (result.memo) payload.memo = true;
4350
+ return payload;
4351
+ }
4352
+
4353
+ // Spread the inner's own payload, not ours: `value` has to stay the input the catch was handed, and the inner ran on a payload of its own so its issues are already private to this call.
4354
+ payload.value = def.catchValue({
4355
+ ...result,
4356
+ value: payload.value,
4357
+ error: {
4358
+ issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
4359
+ },
4360
+ input: payload.value,
4361
+ });
4362
+ return payload;
4363
+ }
4364
+
3896
4365
  export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
3897
4366
  $ZodType.init(inst, def);
3898
- inst._zod.optin = "optional";
3899
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3900
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4367
+ util.defineLazyInternal(inst, "optin", (zod) =>
4368
+ zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"
4369
+ );
4370
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
4371
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3901
4372
 
3902
4373
  inst._zod.parse = (payload, ctx) => {
3903
4374
  if (ctx.direction === "backward") {
@@ -3905,41 +4376,12 @@ export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$const
3905
4376
  }
3906
4377
 
3907
4378
  // Forward direction (decode): apply catch logic
3908
- const result = def.innerType._zod.run(payload, ctx);
4379
+ const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
3909
4380
  if (result instanceof Promise) {
3910
- return result.then((result) => {
3911
- payload.value = result.value;
3912
- if (result.issues.length) {
3913
- payload.value = def.catchValue({
3914
- ...payload,
3915
- error: {
3916
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3917
- },
3918
- input: payload.value,
3919
- });
3920
- payload.issues = [];
3921
- payload.fallback = true;
3922
- }
3923
-
3924
- return payload;
3925
- });
4381
+ return result.then((result) => handleCatchResult(payload, result, def, ctx));
3926
4382
  }
3927
4383
 
3928
- payload.value = result.value;
3929
- if (result.issues.length) {
3930
- payload.value = def.catchValue({
3931
- ...payload,
3932
- error: {
3933
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3934
- },
3935
- input: payload.value,
3936
- });
3937
-
3938
- payload.issues = [];
3939
- payload.fallback = true;
3940
- }
3941
-
3942
- return payload;
4384
+ return handleCatchResult(payload, result, def, ctx);
3943
4385
  };
3944
4386
  });
3945
4387
 
@@ -4013,10 +4455,10 @@ export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $Z
4013
4455
 
4014
4456
  export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
4015
4457
  $ZodType.init(inst, def);
4016
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
4017
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
4018
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
4019
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
4458
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
4459
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
4460
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
4461
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
4020
4462
 
4021
4463
  inst._zod.parse = (payload, ctx) => {
4022
4464
  if (ctx.direction === "backward") {
@@ -4036,12 +4478,13 @@ export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constru
4036
4478
  });
4037
4479
 
4038
4480
  function handlePipeResult(left: ParsePayload, next: $ZodType, ctx: ParseContextInternal) {
4039
- if (left.issues.length) {
4481
+ // Any issue stops the pipe, so a failing refinement never feeds its transform. An unrecognized key is the exception: it describes the input's extra properties, not the value being piped, and an enclosing intersection may yet reconcile it.
4482
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
4040
4483
  // prevent further checks
4041
4484
  left.aborted = true;
4042
4485
  return left;
4043
4486
  }
4044
- return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
4487
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
4045
4488
  }
4046
4489
 
4047
4490
  ////////////////////////////////////////////
@@ -4072,10 +4515,10 @@ export interface $ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $
4072
4515
 
4073
4516
  export const $ZodCodec: core.$constructor<$ZodCodec> = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
4074
4517
  $ZodType.init(inst, def);
4075
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
4076
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
4077
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
4078
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
4518
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
4519
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
4520
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
4521
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
4079
4522
 
4080
4523
  inst._zod.parse = (payload, ctx) => {
4081
4524
  const direction = ctx.direction || "forward";
@@ -4136,19 +4579,22 @@ function handleCodecTxResult(left: ParsePayload, value: any, nextSchema: SomeTyp
4136
4579
  ////////// //////////
4137
4580
  /////////////////////////////////////////////////
4138
4581
  /////////////////////////////////////////////////
4139
- export interface $ZodPreprocessDef<B extends SomeType = $ZodType> extends $ZodPipeDef<$ZodTransform, B> {
4140
- in: $ZodTransform;
4582
+ export interface $ZodPreprocessDef<B extends SomeType = $ZodType, I = unknown>
4583
+ extends $ZodPipeDef<$ZodTransform<unknown, I>, B> {
4584
+ in: $ZodTransform<unknown, I>;
4141
4585
  out: B;
4142
4586
  }
4143
4587
 
4144
- export interface $ZodPreprocessInternals<B extends SomeType = $ZodType> extends $ZodPipeInternals<$ZodTransform, B> {
4145
- def: $ZodPreprocessDef<B>;
4588
+ export interface $ZodPreprocessInternals<B extends SomeType = $ZodType, I = unknown>
4589
+ extends $ZodPipeInternals<$ZodTransform<unknown, I>, B> {
4590
+ def: $ZodPreprocessDef<B, I>;
4146
4591
  optin: B["_zod"]["optin"];
4147
4592
  optout: B["_zod"]["optout"];
4148
4593
  }
4149
4594
 
4150
- export interface $ZodPreprocess<B extends SomeType = $ZodType> extends $ZodPipe<$ZodTransform, B> {
4151
- _zod: $ZodPreprocessInternals<B>;
4595
+ export interface $ZodPreprocess<B extends SomeType = $ZodType, I = unknown>
4596
+ extends $ZodPipe<$ZodTransform<unknown, I>, B> {
4597
+ _zod: $ZodPreprocessInternals<B, I>;
4152
4598
  }
4153
4599
 
4154
4600
  export const $ZodPreprocess: core.$constructor<$ZodPreprocess> = /*@__PURE__*/ core.$constructor(
@@ -4189,10 +4635,10 @@ export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.
4189
4635
  "$ZodReadonly",
4190
4636
  (inst, def) => {
4191
4637
  $ZodType.init(inst, def);
4192
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
4193
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4194
- util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
4195
- util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
4638
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
4639
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
4640
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
4641
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
4196
4642
 
4197
4643
  inst._zod.parse = (payload, ctx) => {
4198
4644
  if (ctx.direction === "backward") {
@@ -4208,7 +4654,8 @@ export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.
4208
4654
  );
4209
4655
 
4210
4656
  function handleReadonlyResult(payload: ParsePayload): ParsePayload {
4211
- payload.value = Object.freeze(payload.value);
4657
+ // A repeat visit hands back a node that is still being built; freezing it here would make the rest of its keys fail to assign.
4658
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
4212
4659
  return payload;
4213
4660
  }
4214
4661
 
@@ -4285,6 +4732,51 @@ export type $PartsToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = [
4285
4732
  : never
4286
4733
  : never;
4287
4734
 
4735
+ // a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
4736
+ function leafPattern(schema: $ZodType): string | undefined {
4737
+ const def = schema._zod.def as { pattern?: RegExp; format?: string; checks?: checks.$ZodCheck[] };
4738
+ let pattern = def.pattern;
4739
+ let isInt = !!def.format?.includes("int");
4740
+ let minimum: number | undefined;
4741
+ let maximum: number | undefined;
4742
+ for (const ch of def.checks ?? []) {
4743
+ const d = ch._zod.def as { pattern?: RegExp; format?: string; minimum?: number; maximum?: number; length?: number };
4744
+ if (d.pattern) pattern = d.pattern;
4745
+ isInt ||= !!d.format?.includes("int");
4746
+ const lo = d.minimum ?? d.length;
4747
+ const hi = d.maximum ?? d.length;
4748
+ if (lo !== undefined && (minimum === undefined || lo > minimum)) minimum = lo;
4749
+ if (hi !== undefined && (maximum === undefined || hi < maximum)) maximum = hi;
4750
+ }
4751
+ if (pattern) return pattern.source;
4752
+ // an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
4753
+ if (minimum !== undefined && maximum !== undefined && minimum > maximum) return "(?!)";
4754
+ if (minimum !== undefined || maximum !== undefined) return regexes.string({ minimum, maximum }).source;
4755
+ const own = schema._zod.pattern;
4756
+ return (isInt && own === regexes.number ? regexes.integer : own)?.source;
4757
+ }
4758
+
4759
+ // a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
4760
+ function partPattern(schema: $ZodType): string | undefined {
4761
+ const def = schema._zod.def as { innerType?: $ZodType; options?: $ZodType[] };
4762
+ const own = schema._zod.pattern?.source;
4763
+ // lazy resolves its inner on the internals, not the def
4764
+ const inner = def.innerType ?? (schema._zod as { innerType?: $ZodType }).innerType;
4765
+ if (inner) {
4766
+ const before = inner._zod.pattern?.source;
4767
+ const after = partPattern(inner);
4768
+ if (own && before && after && after !== before) {
4769
+ return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
4770
+ }
4771
+ return own;
4772
+ }
4773
+ if (def.options) {
4774
+ const sources = def.options.map(partPattern);
4775
+ if (sources.every(Boolean)) return `^(${sources.map((s) => util.cleanRegex(s!)).join("|")})$`;
4776
+ }
4777
+ return leafPattern(schema);
4778
+ }
4779
+
4288
4780
  export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
4289
4781
  "$ZodTemplateLiteral",
4290
4782
  (inst, def) => {
@@ -4293,18 +4785,11 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
4293
4785
  for (const part of def.parts) {
4294
4786
  if (typeof part === "object" && part !== null) {
4295
4787
  // is Zod schema
4296
- if (!part._zod.pattern) {
4297
- // if (!source)
4788
+ const source = partPattern(part);
4789
+ if (!source) {
4298
4790
  throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
4299
4791
  }
4300
-
4301
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
4302
-
4303
- if (!source) throw new Error(`Invalid template literal part: ${part._zod.traits}`);
4304
-
4305
- const start = source.startsWith("^") ? 1 : 0;
4306
- const end = source.endsWith("$") ? source.length - 1 : source.length;
4307
- regexParts.push(source.slice(start, end));
4792
+ regexParts.push(util.cleanRegex(source));
4308
4793
  } else if (part === null || util.primitiveTypes.has(typeof part)) {
4309
4794
  regexParts.push(util.escapeRegex(`${part}`));
4310
4795
  } else {
@@ -4424,35 +4909,45 @@ export const $ZodFunction: core.$constructor<$ZodFunction> = /*@__PURE__*/ core.
4424
4909
  "$ZodFunction",
4425
4910
  (inst, def) => {
4426
4911
  $ZodType.init(inst, def);
4427
- inst._def = def;
4912
+ // Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
4913
+ Object.defineProperty(inst, "_def", { value: def });
4428
4914
  inst._zod.def = def;
4429
4915
 
4430
4916
  inst.implement = (func) => {
4431
4917
  if (typeof func !== "function") {
4432
4918
  throw new Error("implement() must be called with a function");
4433
4919
  }
4434
- return function (this: any, ...args: never[]) {
4435
- const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
4436
- const result = Reflect.apply(func, this, parsedArgs as never[]);
4437
- if (inst._def.output) {
4438
- return parse(inst._def.output, result);
4439
- }
4440
- return result as any;
4441
- };
4920
+ // Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
4921
+ return Object.defineProperty(
4922
+ function (this: any, ...args: never[]) {
4923
+ const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
4924
+ const result = Reflect.apply(func, this, parsedArgs as never[]);
4925
+ if (inst._def.output) {
4926
+ return parse(inst._def.output, result);
4927
+ }
4928
+ return result as any;
4929
+ },
4930
+ "_zod",
4931
+ { value: inst._zod, enumerable: false }
4932
+ ) as any;
4442
4933
  };
4443
4934
 
4444
4935
  inst.implementAsync = (func) => {
4445
4936
  if (typeof func !== "function") {
4446
4937
  throw new Error("implementAsync() must be called with a function");
4447
4938
  }
4448
- return async function (this: any, ...args: never[]) {
4449
- const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
4450
- const result = await Reflect.apply(func, this, parsedArgs as never[]);
4451
- if (inst._def.output) {
4452
- return await parseAsync(inst._def.output, result);
4453
- }
4454
- return result;
4455
- } as any;
4939
+ return Object.defineProperty(
4940
+ async function (this: any, ...args: never[]) {
4941
+ const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
4942
+ const result = await Reflect.apply(func, this, parsedArgs as never[]);
4943
+ if (inst._def.output) {
4944
+ return await parseAsync(inst._def.output, result);
4945
+ }
4946
+ return result;
4947
+ },
4948
+ "_zod",
4949
+ { value: inst._zod, enumerable: false }
4950
+ ) as any;
4456
4951
  };
4457
4952
 
4458
4953
  inst._zod.parse = (payload, _ctx) => {
@@ -4576,18 +5071,16 @@ export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
4576
5071
  export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
4577
5072
  $ZodType.init(inst, def);
4578
5073
 
4579
- // Cache the resolved inner type on the shared `def` so all clones of this
4580
- // lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
4581
- // preserving identity for cycle detection on recursive schemas.
5074
+ // Cache the resolved inner type on the shared `def` so all clones of this lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance, preserving identity for cycle detection on recursive schemas.
4582
5075
  util.defineLazy(inst._zod, "innerType", () => {
4583
5076
  const d = def as $ZodLazyDef & { _cachedInner?: $ZodType };
4584
5077
  if (!d._cachedInner) d._cachedInner = def.getter() as $ZodType;
4585
5078
  return d._cachedInner;
4586
5079
  });
4587
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
4588
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
4589
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
4590
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
5080
+ util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
5081
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
5082
+ util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
5083
+ util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
4591
5084
  inst._zod.parse = (payload, ctx) => {
4592
5085
  const inner = inst._zod.innerType;
4593
5086
  return inner._zod.run(payload, ctx);
@@ -4724,7 +5217,10 @@ export type $ZodStringFormatTypes =
4724
5217
  | $ZodBase64
4725
5218
  | $ZodBase64URL
4726
5219
  | $ZodE164
5220
+ | $ZodCreditCard
5221
+ | $ZodIBAN
4727
5222
  | $ZodJWT
4728
5223
  | $ZodCustomStringFormat<"hex">
4729
5224
  | $ZodCustomStringFormat<util.HashFormat>
4730
- | $ZodCustomStringFormat<"hostname">;
5225
+ | $ZodCustomStringFormat<"hostname">
5226
+ | $ZodCustomStringFormat<"currency_code">;