aws-runtime-bridge 1.9.134 → 1.9.137

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 (820) hide show
  1. package/dist/adapter/AcodeSdkAdapter.d.ts +8 -0
  2. package/dist/adapter/AcodeSdkAdapter.js +5 -5
  3. package/dist/config.d.ts +4 -0
  4. package/dist/config.js +2 -2
  5. package/dist/index.js +1 -1
  6. package/dist/routes/ai-sources.js +1 -1
  7. package/dist/routes/capabilities.d.ts +2 -0
  8. package/dist/routes/capabilities.js +2 -0
  9. package/dist/routes/instance.d.ts +0 -1
  10. package/dist/routes/instance.js +1 -1
  11. package/dist/routes/mcp-extra.d.ts +2 -0
  12. package/dist/routes/mcp-extra.js +3 -0
  13. package/dist/routes/mcp.d.ts +1 -0
  14. package/dist/routes/mcp.js +1 -1
  15. package/dist/routes/plugins.d.ts +2 -0
  16. package/dist/routes/plugins.js +2 -0
  17. package/dist/routes/skills.d.ts +1 -0
  18. package/dist/routes/skills.js +1 -1
  19. package/dist/routes/terminal.js +25 -25
  20. package/dist/services/agent-capability-sync.d.ts +7 -0
  21. package/dist/services/agent-capability-sync.js +2 -0
  22. package/{package/cc-switch-sdk/dist → dist}/services/ai-config-service.d.ts +3 -0
  23. package/dist/services/ai-config-service.js +4 -0
  24. package/dist/services/ai-source-apply.d.ts +1 -1
  25. package/dist/services/ai-source-apply.js +1 -1
  26. package/dist/services/capability-config.d.ts +21 -0
  27. package/dist/services/capability-config.js +3 -0
  28. package/dist/services/instance-ai-config-service.d.ts +1 -0
  29. package/dist/services/instance-ai-config-service.js +1 -1
  30. package/dist/services/instance-features.d.ts +21 -0
  31. package/dist/services/instance-features.js +1 -1
  32. package/dist/services/instance-init-service.d.ts +7 -4
  33. package/dist/services/instance-init-service.js +1 -1
  34. package/dist/services/instance-state.js +1 -1
  35. package/dist/services/legacy-path-migration.d.ts +2 -0
  36. package/dist/services/legacy-path-migration.js +1 -1
  37. package/dist/services/mcp-deploy.d.ts +49 -0
  38. package/dist/services/mcp-deploy.js +4 -0
  39. package/dist/services/plugin-event-buffer.d.ts +49 -0
  40. package/dist/services/plugin-event-buffer.js +2 -0
  41. package/dist/services/plugin-manager.d.ts +240 -0
  42. package/dist/services/plugin-manager.js +10 -0
  43. package/dist/services/plugin-package.d.ts +8 -0
  44. package/dist/services/plugin-package.js +2 -0
  45. package/dist/services/skill-manager.d.ts +41 -0
  46. package/dist/services/skill-manager.js +3 -0
  47. package/dist/types.d.ts +11 -61
  48. package/dist/utils/file-utils.d.ts +9 -6
  49. package/dist/utils/file-utils.js +2 -2
  50. package/dist/utils/mcp-utils.d.ts +1 -37
  51. package/dist/utils/mcp-utils.js +1 -1
  52. package/package/acode/dist/built-in-file-tools.js +2 -2
  53. package/package/acode/dist/commands/commandRegistry.d.ts +2 -0
  54. package/package/acode/dist/commands/commandRegistry.js +1 -1
  55. package/package/acode/dist/index.d.ts +2 -0
  56. package/package/acode/dist/index.js +1 -1
  57. package/package/acode/dist/plugin-tools.d.ts +14 -0
  58. package/package/acode/dist/plugin-tools.js +14 -0
  59. package/package/acode/dist/plugin-types.d.ts +109 -0
  60. package/package/acode/dist/runtime.d.ts +2 -0
  61. package/package/acode/dist/runtime.js +14 -14
  62. package/package/acode/dist/sub-agent-manager.js +1 -1
  63. package/package/acode/dist/types.d.ts +3 -0
  64. package/package/aws-client-agent-mcp/dist/agent-client.d.ts +9 -1
  65. package/package/aws-client-agent-mcp/dist/agent-client.js +1 -1
  66. package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +11 -0
  67. package/package/aws-client-agent-mcp/dist/mcp-server.js +21 -21
  68. package/package/aws-client-agent-mcp/dist/mcp-tools.js +2 -4
  69. package/package/aws-client-agent-mcp/dist/memory-tools.js +8 -10
  70. package/package/aws-client-agent-mcp/dist/types.d.ts +21 -0
  71. package/package.json +4 -10
  72. package/dist/adapters/cc-switch/common.d.ts +0 -41
  73. package/dist/adapters/cc-switch/common.js +0 -2
  74. package/dist/adapters/cc-switch/index.d.ts +0 -19
  75. package/dist/adapters/cc-switch/index.js +0 -2
  76. package/dist/adapters/cc-switch/mcp-acode.d.ts +0 -10
  77. package/dist/adapters/cc-switch/mcp-acode.js +0 -2
  78. package/dist/adapters/cc-switch/mcp-claude.d.ts +0 -10
  79. package/dist/adapters/cc-switch/mcp-claude.js +0 -2
  80. package/dist/adapters/cc-switch/mcp-claudecode.d.ts +0 -10
  81. package/dist/adapters/cc-switch/mcp-claudecode.js +0 -2
  82. package/dist/adapters/cc-switch/mcp-codex.d.ts +0 -10
  83. package/dist/adapters/cc-switch/mcp-codex.js +0 -11
  84. package/dist/adapters/cc-switch/mcp-opencode.d.ts +0 -14
  85. package/dist/adapters/cc-switch/mcp-opencode.js +0 -2
  86. package/dist/adapters/cc-switch/mcp-placeholder.d.ts +0 -9
  87. package/dist/adapters/cc-switch/mcp-placeholder.js +0 -2
  88. package/dist/adapters/cc-switch/skill-acode.d.ts +0 -5
  89. package/dist/adapters/cc-switch/skill-acode.js +0 -2
  90. package/dist/adapters/cc-switch/skill-claude.d.ts +0 -5
  91. package/dist/adapters/cc-switch/skill-claude.js +0 -2
  92. package/dist/adapters/cc-switch/skill-claudecode.d.ts +0 -5
  93. package/dist/adapters/cc-switch/skill-claudecode.js +0 -2
  94. package/dist/adapters/cc-switch/skill-codex.d.ts +0 -4
  95. package/dist/adapters/cc-switch/skill-codex.js +0 -2
  96. package/dist/adapters/cc-switch/skill-directory.d.ts +0 -9
  97. package/dist/adapters/cc-switch/skill-directory.js +0 -3
  98. package/dist/adapters/cc-switch/skill-opencode.d.ts +0 -5
  99. package/dist/adapters/cc-switch/skill-opencode.js +0 -2
  100. package/dist/adapters/cc-switch/skill-placeholder.d.ts +0 -9
  101. package/dist/adapters/cc-switch/skill-placeholder.js +0 -2
  102. package/dist/services/cc-switch-sdk.d.ts +0 -17
  103. package/dist/services/cc-switch-sdk.js +0 -2
  104. package/dist/services/instance-service.d.ts +0 -78
  105. package/dist/services/instance-service.js +0 -2
  106. package/node_modules/@cc-switch/sdk/README.md +0 -541
  107. package/node_modules/@cc-switch/sdk/dist/constants.d.ts +0 -8
  108. package/node_modules/@cc-switch/sdk/dist/constants.js +0 -2
  109. package/node_modules/@cc-switch/sdk/dist/errors.d.ts +0 -5
  110. package/node_modules/@cc-switch/sdk/dist/errors.js +0 -2
  111. package/node_modules/@cc-switch/sdk/dist/index.d.ts +0 -5
  112. package/node_modules/@cc-switch/sdk/dist/index.js +0 -2
  113. package/node_modules/@cc-switch/sdk/dist/schemas.d.ts +0 -7
  114. package/node_modules/@cc-switch/sdk/dist/schemas.js +0 -2
  115. package/node_modules/@cc-switch/sdk/dist/sdk.d.ts +0 -59
  116. package/node_modules/@cc-switch/sdk/dist/sdk.js +0 -2
  117. package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.d.ts +0 -81
  118. package/node_modules/@cc-switch/sdk/dist/services/ai-config-service.js +0 -4
  119. package/node_modules/@cc-switch/sdk/dist/services/mcp-model.d.ts +0 -16
  120. package/node_modules/@cc-switch/sdk/dist/services/mcp-model.js +0 -2
  121. package/node_modules/@cc-switch/sdk/dist/services/mcp-service.d.ts +0 -17
  122. package/node_modules/@cc-switch/sdk/dist/services/mcp-service.js +0 -2
  123. package/node_modules/@cc-switch/sdk/dist/services/skill-model.d.ts +0 -16
  124. package/node_modules/@cc-switch/sdk/dist/services/skill-model.js +0 -2
  125. package/node_modules/@cc-switch/sdk/dist/services/skill-service.d.ts +0 -16
  126. package/node_modules/@cc-switch/sdk/dist/services/skill-service.js +0 -2
  127. package/node_modules/@cc-switch/sdk/dist/state.d.ts +0 -3
  128. package/node_modules/@cc-switch/sdk/dist/state.js +0 -2
  129. package/node_modules/@cc-switch/sdk/dist/types.d.ts +0 -78
  130. package/node_modules/@cc-switch/sdk/dist/utils/fs.d.ts +0 -10
  131. package/node_modules/@cc-switch/sdk/dist/utils/fs.js +0 -3
  132. package/node_modules/@cc-switch/sdk/dist/utils/id.d.ts +0 -3
  133. package/node_modules/@cc-switch/sdk/dist/utils/id.js +0 -2
  134. package/node_modules/@cc-switch/sdk/package.json +0 -31
  135. package/node_modules/zod/LICENSE +0 -21
  136. package/node_modules/zod/README.md +0 -208
  137. package/node_modules/zod/index.cjs +0 -33
  138. package/node_modules/zod/index.d.cts +0 -4
  139. package/node_modules/zod/index.d.ts +0 -4
  140. package/node_modules/zod/index.js +0 -4
  141. package/node_modules/zod/locales/index.cjs +0 -17
  142. package/node_modules/zod/locales/index.d.cts +0 -1
  143. package/node_modules/zod/locales/index.d.ts +0 -1
  144. package/node_modules/zod/locales/index.js +0 -1
  145. package/node_modules/zod/locales/package.json +0 -6
  146. package/node_modules/zod/mini/index.cjs +0 -17
  147. package/node_modules/zod/mini/index.d.cts +0 -1
  148. package/node_modules/zod/mini/index.d.ts +0 -1
  149. package/node_modules/zod/mini/index.js +0 -1
  150. package/node_modules/zod/mini/package.json +0 -6
  151. package/node_modules/zod/package.json +0 -135
  152. package/node_modules/zod/src/index.ts +0 -4
  153. package/node_modules/zod/src/locales/index.ts +0 -1
  154. package/node_modules/zod/src/mini/index.ts +0 -1
  155. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  156. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  157. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  158. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  159. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  160. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  161. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  162. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  163. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  164. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  165. package/node_modules/zod/src/v3/errors.ts +0 -13
  166. package/node_modules/zod/src/v3/external.ts +0 -6
  167. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  168. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  169. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  170. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  171. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  172. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  173. package/node_modules/zod/src/v3/index.ts +0 -4
  174. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  175. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  176. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  177. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  178. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  179. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  180. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  181. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  182. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  183. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  184. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  185. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  186. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  187. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -56
  188. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  189. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  190. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  191. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  192. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  193. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  194. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  195. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  196. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  197. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  198. package/node_modules/zod/src/v3/tests/function.test.ts +0 -257
  199. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  200. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  201. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  202. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  203. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  204. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  205. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  206. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  207. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  208. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -21
  209. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  210. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  211. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  212. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  213. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  214. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  215. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  216. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  217. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  218. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  219. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  220. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  221. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  222. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  223. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  224. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  225. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  226. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  227. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  228. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  229. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  230. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  231. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  232. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  233. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  234. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  235. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  236. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  237. package/node_modules/zod/src/v3/types.ts +0 -5138
  238. package/node_modules/zod/src/v4/classic/checks.ts +0 -31
  239. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  240. package/node_modules/zod/src/v4/classic/compat.ts +0 -70
  241. package/node_modules/zod/src/v4/classic/errors.ts +0 -82
  242. package/node_modules/zod/src/v4/classic/external.ts +0 -50
  243. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  244. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  245. package/node_modules/zod/src/v4/classic/parse.ts +0 -82
  246. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2197
  247. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  248. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  249. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  250. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  251. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  252. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  253. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  254. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -63
  255. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -276
  256. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  257. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
  258. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -562
  259. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  260. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -352
  261. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  262. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -31
  263. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
  264. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -365
  265. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  266. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -661
  267. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  268. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -595
  269. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  270. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
  271. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
  272. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -308
  273. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  274. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
  275. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -844
  276. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -34
  277. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -171
  278. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -108
  279. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  280. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
  281. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -196
  282. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  283. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  284. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
  285. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  286. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -270
  287. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -609
  288. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -136
  289. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -340
  290. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -127
  291. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
  292. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
  293. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -282
  294. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  295. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  296. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  297. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  298. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -356
  299. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -582
  300. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -605
  301. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -204
  302. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
  303. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -57
  304. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
  305. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1080
  306. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
  307. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -763
  308. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2622
  309. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -361
  310. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -163
  311. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -181
  312. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  313. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  314. package/node_modules/zod/src/v4/core/api.ts +0 -1621
  315. package/node_modules/zod/src/v4/core/checks.ts +0 -1287
  316. package/node_modules/zod/src/v4/core/config.ts +0 -15
  317. package/node_modules/zod/src/v4/core/core.ts +0 -115
  318. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  319. package/node_modules/zod/src/v4/core/errors.ts +0 -413
  320. package/node_modules/zod/src/v4/core/index.ts +0 -14
  321. package/node_modules/zod/src/v4/core/json-schema.ts +0 -147
  322. package/node_modules/zod/src/v4/core/parse.ts +0 -195
  323. package/node_modules/zod/src/v4/core/regexes.ts +0 -177
  324. package/node_modules/zod/src/v4/core/registries.ts +0 -97
  325. package/node_modules/zod/src/v4/core/schemas.ts +0 -4317
  326. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -64
  327. package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -18
  328. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  329. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  330. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  331. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
  332. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  333. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  334. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -1044
  335. package/node_modules/zod/src/v4/core/util.ts +0 -910
  336. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  337. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  338. package/node_modules/zod/src/v4/index.ts +0 -4
  339. package/node_modules/zod/src/v4/locales/ar.ts +0 -125
  340. package/node_modules/zod/src/v4/locales/az.ts +0 -121
  341. package/node_modules/zod/src/v4/locales/be.ts +0 -184
  342. package/node_modules/zod/src/v4/locales/bg.ts +0 -136
  343. package/node_modules/zod/src/v4/locales/ca.ts +0 -127
  344. package/node_modules/zod/src/v4/locales/cs.ts +0 -142
  345. package/node_modules/zod/src/v4/locales/da.ts +0 -141
  346. package/node_modules/zod/src/v4/locales/de.ts +0 -124
  347. package/node_modules/zod/src/v4/locales/en.ts +0 -127
  348. package/node_modules/zod/src/v4/locales/eo.ts +0 -125
  349. package/node_modules/zod/src/v4/locales/es.ts +0 -159
  350. package/node_modules/zod/src/v4/locales/fa.ts +0 -134
  351. package/node_modules/zod/src/v4/locales/fi.ts +0 -131
  352. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -126
  353. package/node_modules/zod/src/v4/locales/fr.ts +0 -124
  354. package/node_modules/zod/src/v4/locales/he.ts +0 -125
  355. package/node_modules/zod/src/v4/locales/hu.ts +0 -126
  356. package/node_modules/zod/src/v4/locales/id.ts +0 -125
  357. package/node_modules/zod/src/v4/locales/index.ts +0 -47
  358. package/node_modules/zod/src/v4/locales/is.ts +0 -127
  359. package/node_modules/zod/src/v4/locales/it.ts +0 -125
  360. package/node_modules/zod/src/v4/locales/ja.ts +0 -122
  361. package/node_modules/zod/src/v4/locales/ka.ts +0 -138
  362. package/node_modules/zod/src/v4/locales/kh.ts +0 -7
  363. package/node_modules/zod/src/v4/locales/km.ts +0 -126
  364. package/node_modules/zod/src/v4/locales/ko.ts +0 -131
  365. package/node_modules/zod/src/v4/locales/lt.ts +0 -265
  366. package/node_modules/zod/src/v4/locales/mk.ts +0 -127
  367. package/node_modules/zod/src/v4/locales/ms.ts +0 -124
  368. package/node_modules/zod/src/v4/locales/nl.ts +0 -126
  369. package/node_modules/zod/src/v4/locales/no.ts +0 -124
  370. package/node_modules/zod/src/v4/locales/ota.ts +0 -125
  371. package/node_modules/zod/src/v4/locales/pl.ts +0 -126
  372. package/node_modules/zod/src/v4/locales/ps.ts +0 -133
  373. package/node_modules/zod/src/v4/locales/pt.ts +0 -123
  374. package/node_modules/zod/src/v4/locales/ru.ts +0 -184
  375. package/node_modules/zod/src/v4/locales/sl.ts +0 -126
  376. package/node_modules/zod/src/v4/locales/sv.ts +0 -127
  377. package/node_modules/zod/src/v4/locales/ta.ts +0 -125
  378. package/node_modules/zod/src/v4/locales/th.ts +0 -126
  379. package/node_modules/zod/src/v4/locales/tr.ts +0 -121
  380. package/node_modules/zod/src/v4/locales/ua.ts +0 -7
  381. package/node_modules/zod/src/v4/locales/uk.ts +0 -126
  382. package/node_modules/zod/src/v4/locales/ur.ts +0 -126
  383. package/node_modules/zod/src/v4/locales/vi.ts +0 -125
  384. package/node_modules/zod/src/v4/locales/yo.ts +0 -131
  385. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -123
  386. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -125
  387. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  388. package/node_modules/zod/src/v4/mini/coerce.ts +0 -22
  389. package/node_modules/zod/src/v4/mini/external.ts +0 -40
  390. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  391. package/node_modules/zod/src/v4/mini/iso.ts +0 -62
  392. package/node_modules/zod/src/v4/mini/parse.ts +0 -14
  393. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1725
  394. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  395. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -51
  396. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  397. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -529
  398. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  399. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  400. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -43
  401. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -899
  402. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  403. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -200
  404. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  405. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  406. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -315
  407. package/node_modules/zod/src/v4-mini/index.ts +0 -1
  408. package/node_modules/zod/v3/ZodError.cjs +0 -138
  409. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  410. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  411. package/node_modules/zod/v3/ZodError.js +0 -133
  412. package/node_modules/zod/v3/errors.cjs +0 -17
  413. package/node_modules/zod/v3/errors.d.cts +0 -5
  414. package/node_modules/zod/v3/errors.d.ts +0 -5
  415. package/node_modules/zod/v3/errors.js +0 -9
  416. package/node_modules/zod/v3/external.cjs +0 -22
  417. package/node_modules/zod/v3/external.d.cts +0 -6
  418. package/node_modules/zod/v3/external.d.ts +0 -6
  419. package/node_modules/zod/v3/external.js +0 -6
  420. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  421. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  422. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  423. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  424. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  425. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  426. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  427. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  428. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  429. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  430. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  431. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  432. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  433. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  434. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  435. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  436. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  437. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  438. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  439. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  440. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  441. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  442. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  443. package/node_modules/zod/v3/helpers/util.js +0 -133
  444. package/node_modules/zod/v3/index.cjs +0 -33
  445. package/node_modules/zod/v3/index.d.cts +0 -4
  446. package/node_modules/zod/v3/index.d.ts +0 -4
  447. package/node_modules/zod/v3/index.js +0 -4
  448. package/node_modules/zod/v3/locales/en.cjs +0 -112
  449. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  450. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  451. package/node_modules/zod/v3/locales/en.js +0 -109
  452. package/node_modules/zod/v3/package.json +0 -6
  453. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  454. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  455. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  456. package/node_modules/zod/v3/standard-schema.js +0 -1
  457. package/node_modules/zod/v3/types.cjs +0 -3777
  458. package/node_modules/zod/v3/types.d.cts +0 -1034
  459. package/node_modules/zod/v3/types.d.ts +0 -1034
  460. package/node_modules/zod/v3/types.js +0 -3695
  461. package/node_modules/zod/v4/classic/checks.cjs +0 -32
  462. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  463. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  464. package/node_modules/zod/v4/classic/checks.js +0 -1
  465. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  466. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  467. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  468. package/node_modules/zod/v4/classic/coerce.js +0 -17
  469. package/node_modules/zod/v4/classic/compat.cjs +0 -61
  470. package/node_modules/zod/v4/classic/compat.d.cts +0 -50
  471. package/node_modules/zod/v4/classic/compat.d.ts +0 -50
  472. package/node_modules/zod/v4/classic/compat.js +0 -31
  473. package/node_modules/zod/v4/classic/errors.cjs +0 -74
  474. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  475. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  476. package/node_modules/zod/v4/classic/errors.js +0 -48
  477. package/node_modules/zod/v4/classic/external.cjs +0 -70
  478. package/node_modules/zod/v4/classic/external.d.cts +0 -13
  479. package/node_modules/zod/v4/classic/external.d.ts +0 -13
  480. package/node_modules/zod/v4/classic/external.js +0 -18
  481. package/node_modules/zod/v4/classic/index.cjs +0 -33
  482. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  483. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  484. package/node_modules/zod/v4/classic/index.js +0 -4
  485. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  486. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  487. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  488. package/node_modules/zod/v4/classic/iso.js +0 -30
  489. package/node_modules/zod/v4/classic/package.json +0 -6
  490. package/node_modules/zod/v4/classic/parse.cjs +0 -41
  491. package/node_modules/zod/v4/classic/parse.d.cts +0 -31
  492. package/node_modules/zod/v4/classic/parse.d.ts +0 -31
  493. package/node_modules/zod/v4/classic/parse.js +0 -15
  494. package/node_modules/zod/v4/classic/schemas.cjs +0 -1151
  495. package/node_modules/zod/v4/classic/schemas.d.cts +0 -673
  496. package/node_modules/zod/v4/classic/schemas.d.ts +0 -673
  497. package/node_modules/zod/v4/classic/schemas.js +0 -1040
  498. package/node_modules/zod/v4/core/api.cjs +0 -1060
  499. package/node_modules/zod/v4/core/api.d.cts +0 -295
  500. package/node_modules/zod/v4/core/api.d.ts +0 -295
  501. package/node_modules/zod/v4/core/api.js +0 -925
  502. package/node_modules/zod/v4/core/checks.cjs +0 -595
  503. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  504. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  505. package/node_modules/zod/v4/core/checks.js +0 -569
  506. package/node_modules/zod/v4/core/core.cjs +0 -74
  507. package/node_modules/zod/v4/core/core.d.cts +0 -52
  508. package/node_modules/zod/v4/core/core.d.ts +0 -52
  509. package/node_modules/zod/v4/core/core.js +0 -67
  510. package/node_modules/zod/v4/core/doc.cjs +0 -39
  511. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  512. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  513. package/node_modules/zod/v4/core/doc.js +0 -35
  514. package/node_modules/zod/v4/core/errors.cjs +0 -213
  515. package/node_modules/zod/v4/core/errors.d.cts +0 -210
  516. package/node_modules/zod/v4/core/errors.d.ts +0 -210
  517. package/node_modules/zod/v4/core/errors.js +0 -182
  518. package/node_modules/zod/v4/core/index.cjs +0 -43
  519. package/node_modules/zod/v4/core/index.d.cts +0 -14
  520. package/node_modules/zod/v4/core/index.d.ts +0 -14
  521. package/node_modules/zod/v4/core/index.js +0 -14
  522. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  523. package/node_modules/zod/v4/core/json-schema.d.cts +0 -88
  524. package/node_modules/zod/v4/core/json-schema.d.ts +0 -88
  525. package/node_modules/zod/v4/core/json-schema.js +0 -1
  526. package/node_modules/zod/v4/core/package.json +0 -6
  527. package/node_modules/zod/v4/core/parse.cjs +0 -131
  528. package/node_modules/zod/v4/core/parse.d.cts +0 -49
  529. package/node_modules/zod/v4/core/parse.d.ts +0 -49
  530. package/node_modules/zod/v4/core/parse.js +0 -93
  531. package/node_modules/zod/v4/core/regexes.cjs +0 -136
  532. package/node_modules/zod/v4/core/regexes.d.cts +0 -78
  533. package/node_modules/zod/v4/core/regexes.d.ts +0 -78
  534. package/node_modules/zod/v4/core/regexes.js +0 -127
  535. package/node_modules/zod/v4/core/registries.cjs +0 -57
  536. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  537. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  538. package/node_modules/zod/v4/core/registries.js +0 -52
  539. package/node_modules/zod/v4/core/schemas.cjs +0 -1986
  540. package/node_modules/zod/v4/core/schemas.d.cts +0 -1113
  541. package/node_modules/zod/v4/core/schemas.d.ts +0 -1113
  542. package/node_modules/zod/v4/core/schemas.js +0 -1955
  543. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  544. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -55
  545. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -55
  546. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  547. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -920
  548. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -90
  549. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -90
  550. package/node_modules/zod/v4/core/to-json-schema.js +0 -915
  551. package/node_modules/zod/v4/core/util.cjs +0 -658
  552. package/node_modules/zod/v4/core/util.d.cts +0 -197
  553. package/node_modules/zod/v4/core/util.d.ts +0 -197
  554. package/node_modules/zod/v4/core/util.js +0 -601
  555. package/node_modules/zod/v4/core/versions.cjs +0 -8
  556. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  557. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  558. package/node_modules/zod/v4/core/versions.js +0 -5
  559. package/node_modules/zod/v4/index.cjs +0 -22
  560. package/node_modules/zod/v4/index.d.cts +0 -3
  561. package/node_modules/zod/v4/index.d.ts +0 -3
  562. package/node_modules/zod/v4/index.js +0 -3
  563. package/node_modules/zod/v4/locales/ar.cjs +0 -143
  564. package/node_modules/zod/v4/locales/ar.d.cts +0 -5
  565. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  566. package/node_modules/zod/v4/locales/ar.js +0 -116
  567. package/node_modules/zod/v4/locales/az.cjs +0 -142
  568. package/node_modules/zod/v4/locales/az.d.cts +0 -5
  569. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  570. package/node_modules/zod/v4/locales/az.js +0 -115
  571. package/node_modules/zod/v4/locales/be.cjs +0 -191
  572. package/node_modules/zod/v4/locales/be.d.cts +0 -5
  573. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  574. package/node_modules/zod/v4/locales/be.js +0 -164
  575. package/node_modules/zod/v4/locales/bg.cjs +0 -156
  576. package/node_modules/zod/v4/locales/bg.d.cts +0 -5
  577. package/node_modules/zod/v4/locales/bg.d.ts +0 -5
  578. package/node_modules/zod/v4/locales/bg.js +0 -128
  579. package/node_modules/zod/v4/locales/ca.cjs +0 -145
  580. package/node_modules/zod/v4/locales/ca.d.cts +0 -5
  581. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  582. package/node_modules/zod/v4/locales/ca.js +0 -118
  583. package/node_modules/zod/v4/locales/cs.cjs +0 -162
  584. package/node_modules/zod/v4/locales/cs.d.cts +0 -5
  585. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  586. package/node_modules/zod/v4/locales/cs.js +0 -135
  587. package/node_modules/zod/v4/locales/da.cjs +0 -158
  588. package/node_modules/zod/v4/locales/da.d.cts +0 -5
  589. package/node_modules/zod/v4/locales/da.d.ts +0 -4
  590. package/node_modules/zod/v4/locales/da.js +0 -131
  591. package/node_modules/zod/v4/locales/de.cjs +0 -143
  592. package/node_modules/zod/v4/locales/de.d.cts +0 -5
  593. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  594. package/node_modules/zod/v4/locales/de.js +0 -116
  595. package/node_modules/zod/v4/locales/en.cjs +0 -145
  596. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  597. package/node_modules/zod/v4/locales/en.d.ts +0 -5
  598. package/node_modules/zod/v4/locales/en.js +0 -117
  599. package/node_modules/zod/v4/locales/eo.cjs +0 -144
  600. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  601. package/node_modules/zod/v4/locales/eo.d.ts +0 -5
  602. package/node_modules/zod/v4/locales/eo.js +0 -116
  603. package/node_modules/zod/v4/locales/es.cjs +0 -176
  604. package/node_modules/zod/v4/locales/es.d.cts +0 -5
  605. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  606. package/node_modules/zod/v4/locales/es.js +0 -149
  607. package/node_modules/zod/v4/locales/fa.cjs +0 -149
  608. package/node_modules/zod/v4/locales/fa.d.cts +0 -5
  609. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  610. package/node_modules/zod/v4/locales/fa.js +0 -122
  611. package/node_modules/zod/v4/locales/fi.cjs +0 -149
  612. package/node_modules/zod/v4/locales/fi.d.cts +0 -5
  613. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  614. package/node_modules/zod/v4/locales/fi.js +0 -122
  615. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -144
  616. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
  617. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  618. package/node_modules/zod/v4/locales/fr-CA.js +0 -117
  619. package/node_modules/zod/v4/locales/fr.cjs +0 -143
  620. package/node_modules/zod/v4/locales/fr.d.cts +0 -5
  621. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  622. package/node_modules/zod/v4/locales/fr.js +0 -116
  623. package/node_modules/zod/v4/locales/he.cjs +0 -144
  624. package/node_modules/zod/v4/locales/he.d.cts +0 -5
  625. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  626. package/node_modules/zod/v4/locales/he.js +0 -117
  627. package/node_modules/zod/v4/locales/hu.cjs +0 -144
  628. package/node_modules/zod/v4/locales/hu.d.cts +0 -5
  629. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  630. package/node_modules/zod/v4/locales/hu.js +0 -117
  631. package/node_modules/zod/v4/locales/id.cjs +0 -143
  632. package/node_modules/zod/v4/locales/id.d.cts +0 -5
  633. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  634. package/node_modules/zod/v4/locales/id.js +0 -116
  635. package/node_modules/zod/v4/locales/index.cjs +0 -100
  636. package/node_modules/zod/v4/locales/index.d.cts +0 -47
  637. package/node_modules/zod/v4/locales/index.d.ts +0 -47
  638. package/node_modules/zod/v4/locales/index.js +0 -47
  639. package/node_modules/zod/v4/locales/is.cjs +0 -145
  640. package/node_modules/zod/v4/locales/is.d.cts +0 -5
  641. package/node_modules/zod/v4/locales/is.d.ts +0 -5
  642. package/node_modules/zod/v4/locales/is.js +0 -117
  643. package/node_modules/zod/v4/locales/it.cjs +0 -144
  644. package/node_modules/zod/v4/locales/it.d.cts +0 -5
  645. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  646. package/node_modules/zod/v4/locales/it.js +0 -117
  647. package/node_modules/zod/v4/locales/ja.cjs +0 -142
  648. package/node_modules/zod/v4/locales/ja.d.cts +0 -5
  649. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  650. package/node_modules/zod/v4/locales/ja.js +0 -115
  651. package/node_modules/zod/v4/locales/ka.cjs +0 -153
  652. package/node_modules/zod/v4/locales/ka.d.cts +0 -5
  653. package/node_modules/zod/v4/locales/ka.d.ts +0 -5
  654. package/node_modules/zod/v4/locales/ka.js +0 -125
  655. package/node_modules/zod/v4/locales/kh.cjs +0 -12
  656. package/node_modules/zod/v4/locales/kh.d.cts +0 -5
  657. package/node_modules/zod/v4/locales/kh.d.ts +0 -5
  658. package/node_modules/zod/v4/locales/kh.js +0 -5
  659. package/node_modules/zod/v4/locales/km.cjs +0 -144
  660. package/node_modules/zod/v4/locales/km.d.cts +0 -5
  661. package/node_modules/zod/v4/locales/km.d.ts +0 -4
  662. package/node_modules/zod/v4/locales/km.js +0 -117
  663. package/node_modules/zod/v4/locales/ko.cjs +0 -148
  664. package/node_modules/zod/v4/locales/ko.d.cts +0 -5
  665. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  666. package/node_modules/zod/v4/locales/ko.js +0 -121
  667. package/node_modules/zod/v4/locales/lt.cjs +0 -258
  668. package/node_modules/zod/v4/locales/lt.d.cts +0 -5
  669. package/node_modules/zod/v4/locales/lt.d.ts +0 -5
  670. package/node_modules/zod/v4/locales/lt.js +0 -230
  671. package/node_modules/zod/v4/locales/mk.cjs +0 -145
  672. package/node_modules/zod/v4/locales/mk.d.cts +0 -5
  673. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  674. package/node_modules/zod/v4/locales/mk.js +0 -118
  675. package/node_modules/zod/v4/locales/ms.cjs +0 -143
  676. package/node_modules/zod/v4/locales/ms.d.cts +0 -5
  677. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  678. package/node_modules/zod/v4/locales/ms.js +0 -116
  679. package/node_modules/zod/v4/locales/nl.cjs +0 -144
  680. package/node_modules/zod/v4/locales/nl.d.cts +0 -5
  681. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  682. package/node_modules/zod/v4/locales/nl.js +0 -117
  683. package/node_modules/zod/v4/locales/no.cjs +0 -143
  684. package/node_modules/zod/v4/locales/no.d.cts +0 -5
  685. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  686. package/node_modules/zod/v4/locales/no.js +0 -116
  687. package/node_modules/zod/v4/locales/ota.cjs +0 -144
  688. package/node_modules/zod/v4/locales/ota.d.cts +0 -5
  689. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  690. package/node_modules/zod/v4/locales/ota.js +0 -117
  691. package/node_modules/zod/v4/locales/package.json +0 -6
  692. package/node_modules/zod/v4/locales/pl.cjs +0 -144
  693. package/node_modules/zod/v4/locales/pl.d.cts +0 -5
  694. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  695. package/node_modules/zod/v4/locales/pl.js +0 -117
  696. package/node_modules/zod/v4/locales/ps.cjs +0 -149
  697. package/node_modules/zod/v4/locales/ps.d.cts +0 -5
  698. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  699. package/node_modules/zod/v4/locales/ps.js +0 -122
  700. package/node_modules/zod/v4/locales/pt.cjs +0 -143
  701. package/node_modules/zod/v4/locales/pt.d.cts +0 -5
  702. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  703. package/node_modules/zod/v4/locales/pt.js +0 -116
  704. package/node_modules/zod/v4/locales/ru.cjs +0 -191
  705. package/node_modules/zod/v4/locales/ru.d.cts +0 -5
  706. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  707. package/node_modules/zod/v4/locales/ru.js +0 -164
  708. package/node_modules/zod/v4/locales/sl.cjs +0 -144
  709. package/node_modules/zod/v4/locales/sl.d.cts +0 -5
  710. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  711. package/node_modules/zod/v4/locales/sl.js +0 -117
  712. package/node_modules/zod/v4/locales/sv.cjs +0 -145
  713. package/node_modules/zod/v4/locales/sv.d.cts +0 -5
  714. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  715. package/node_modules/zod/v4/locales/sv.js +0 -118
  716. package/node_modules/zod/v4/locales/ta.cjs +0 -144
  717. package/node_modules/zod/v4/locales/ta.d.cts +0 -5
  718. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  719. package/node_modules/zod/v4/locales/ta.js +0 -117
  720. package/node_modules/zod/v4/locales/th.cjs +0 -144
  721. package/node_modules/zod/v4/locales/th.d.cts +0 -5
  722. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  723. package/node_modules/zod/v4/locales/th.js +0 -117
  724. package/node_modules/zod/v4/locales/tr.cjs +0 -143
  725. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  726. package/node_modules/zod/v4/locales/tr.d.ts +0 -5
  727. package/node_modules/zod/v4/locales/tr.js +0 -115
  728. package/node_modules/zod/v4/locales/ua.cjs +0 -12
  729. package/node_modules/zod/v4/locales/ua.d.cts +0 -5
  730. package/node_modules/zod/v4/locales/ua.d.ts +0 -5
  731. package/node_modules/zod/v4/locales/ua.js +0 -5
  732. package/node_modules/zod/v4/locales/uk.cjs +0 -144
  733. package/node_modules/zod/v4/locales/uk.d.cts +0 -5
  734. package/node_modules/zod/v4/locales/uk.d.ts +0 -4
  735. package/node_modules/zod/v4/locales/uk.js +0 -117
  736. package/node_modules/zod/v4/locales/ur.cjs +0 -144
  737. package/node_modules/zod/v4/locales/ur.d.cts +0 -5
  738. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  739. package/node_modules/zod/v4/locales/ur.js +0 -117
  740. package/node_modules/zod/v4/locales/vi.cjs +0 -143
  741. package/node_modules/zod/v4/locales/vi.d.cts +0 -5
  742. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  743. package/node_modules/zod/v4/locales/vi.js +0 -116
  744. package/node_modules/zod/v4/locales/yo.cjs +0 -142
  745. package/node_modules/zod/v4/locales/yo.d.cts +0 -5
  746. package/node_modules/zod/v4/locales/yo.d.ts +0 -4
  747. package/node_modules/zod/v4/locales/yo.js +0 -115
  748. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -143
  749. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
  750. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  751. package/node_modules/zod/v4/locales/zh-CN.js +0 -116
  752. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -144
  753. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
  754. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  755. package/node_modules/zod/v4/locales/zh-TW.js +0 -117
  756. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  757. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  758. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  759. package/node_modules/zod/v4/mini/checks.js +0 -1
  760. package/node_modules/zod/v4/mini/coerce.cjs +0 -47
  761. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  762. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  763. package/node_modules/zod/v4/mini/coerce.js +0 -17
  764. package/node_modules/zod/v4/mini/external.cjs +0 -62
  765. package/node_modules/zod/v4/mini/external.d.cts +0 -11
  766. package/node_modules/zod/v4/mini/external.d.ts +0 -11
  767. package/node_modules/zod/v4/mini/external.js +0 -13
  768. package/node_modules/zod/v4/mini/index.cjs +0 -32
  769. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  770. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  771. package/node_modules/zod/v4/mini/index.js +0 -3
  772. package/node_modules/zod/v4/mini/iso.cjs +0 -60
  773. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  774. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  775. package/node_modules/zod/v4/mini/iso.js +0 -30
  776. package/node_modules/zod/v4/mini/package.json +0 -6
  777. package/node_modules/zod/v4/mini/parse.cjs +0 -16
  778. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  779. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  780. package/node_modules/zod/v4/mini/parse.js +0 -1
  781. package/node_modules/zod/v4/mini/schemas.cjs +0 -892
  782. package/node_modules/zod/v4/mini/schemas.d.cts +0 -407
  783. package/node_modules/zod/v4/mini/schemas.d.ts +0 -407
  784. package/node_modules/zod/v4/mini/schemas.js +0 -775
  785. package/node_modules/zod/v4/package.json +0 -6
  786. package/node_modules/zod/v4-mini/index.cjs +0 -17
  787. package/node_modules/zod/v4-mini/index.d.cts +0 -1
  788. package/node_modules/zod/v4-mini/index.d.ts +0 -1
  789. package/node_modules/zod/v4-mini/index.js +0 -1
  790. package/node_modules/zod/v4-mini/package.json +0 -6
  791. package/package/cc-switch-sdk/README.md +0 -541
  792. package/package/cc-switch-sdk/dist/constants.d.ts +0 -8
  793. package/package/cc-switch-sdk/dist/constants.js +0 -2
  794. package/package/cc-switch-sdk/dist/errors.d.ts +0 -5
  795. package/package/cc-switch-sdk/dist/errors.js +0 -2
  796. package/package/cc-switch-sdk/dist/index.d.ts +0 -5
  797. package/package/cc-switch-sdk/dist/index.js +0 -2
  798. package/package/cc-switch-sdk/dist/schemas.d.ts +0 -7
  799. package/package/cc-switch-sdk/dist/schemas.js +0 -2
  800. package/package/cc-switch-sdk/dist/sdk.d.ts +0 -59
  801. package/package/cc-switch-sdk/dist/sdk.js +0 -2
  802. package/package/cc-switch-sdk/dist/services/ai-config-service.js +0 -4
  803. package/package/cc-switch-sdk/dist/services/mcp-model.d.ts +0 -16
  804. package/package/cc-switch-sdk/dist/services/mcp-model.js +0 -2
  805. package/package/cc-switch-sdk/dist/services/mcp-service.d.ts +0 -17
  806. package/package/cc-switch-sdk/dist/services/mcp-service.js +0 -2
  807. package/package/cc-switch-sdk/dist/services/skill-model.d.ts +0 -16
  808. package/package/cc-switch-sdk/dist/services/skill-model.js +0 -2
  809. package/package/cc-switch-sdk/dist/services/skill-service.d.ts +0 -16
  810. package/package/cc-switch-sdk/dist/services/skill-service.js +0 -2
  811. package/package/cc-switch-sdk/dist/state.d.ts +0 -3
  812. package/package/cc-switch-sdk/dist/state.js +0 -2
  813. package/package/cc-switch-sdk/dist/types.d.ts +0 -78
  814. package/package/cc-switch-sdk/dist/types.js +0 -1
  815. package/package/cc-switch-sdk/dist/utils/fs.d.ts +0 -10
  816. package/package/cc-switch-sdk/dist/utils/fs.js +0 -3
  817. package/package/cc-switch-sdk/dist/utils/id.d.ts +0 -3
  818. package/package/cc-switch-sdk/dist/utils/id.js +0 -2
  819. package/package/cc-switch-sdk/package.json +0 -31
  820. /package/{node_modules/@cc-switch/sdk/dist/types.js → package/acode/dist/plugin-types.js} +0 -0
@@ -1,1986 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObjectJIT = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
- exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = void 0;
28
- exports.isValidBase64 = isValidBase64;
29
- exports.isValidBase64URL = isValidBase64URL;
30
- exports.isValidJWT = isValidJWT;
31
- const checks = __importStar(require("./checks.cjs"));
32
- const core = __importStar(require("./core.cjs"));
33
- const doc_js_1 = require("./doc.cjs");
34
- const parse_js_1 = require("./parse.cjs");
35
- const regexes = __importStar(require("./regexes.cjs"));
36
- const util = __importStar(require("./util.cjs"));
37
- const versions_js_1 = require("./versions.cjs");
38
- exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
39
- var _a;
40
- inst ?? (inst = {});
41
- inst._zod.def = def; // set _def property
42
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
43
- inst._zod.version = versions_js_1.version;
44
- const checks = [...(inst._zod.def.checks ?? [])];
45
- // if inst is itself a checks.$ZodCheck, run it as a check
46
- if (inst._zod.traits.has("$ZodCheck")) {
47
- checks.unshift(inst);
48
- }
49
- for (const ch of checks) {
50
- for (const fn of ch._zod.onattach) {
51
- fn(inst);
52
- }
53
- }
54
- if (checks.length === 0) {
55
- // deferred initializer
56
- // inst._zod.parse is not yet defined
57
- (_a = inst._zod).deferred ?? (_a.deferred = []);
58
- inst._zod.deferred?.push(() => {
59
- inst._zod.run = inst._zod.parse;
60
- });
61
- }
62
- else {
63
- const runChecks = (payload, checks, ctx) => {
64
- let isAborted = util.aborted(payload);
65
- let asyncResult;
66
- for (const ch of checks) {
67
- if (ch._zod.def.when) {
68
- const shouldRun = ch._zod.def.when(payload);
69
- if (!shouldRun)
70
- continue;
71
- }
72
- else if (isAborted) {
73
- continue;
74
- }
75
- const currLen = payload.issues.length;
76
- const _ = ch._zod.check(payload);
77
- if (_ instanceof Promise && ctx?.async === false) {
78
- throw new core.$ZodAsyncError();
79
- }
80
- if (asyncResult || _ instanceof Promise) {
81
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
82
- await _;
83
- const nextLen = payload.issues.length;
84
- if (nextLen === currLen)
85
- return;
86
- if (!isAborted)
87
- isAborted = util.aborted(payload, currLen);
88
- });
89
- }
90
- else {
91
- const nextLen = payload.issues.length;
92
- if (nextLen === currLen)
93
- continue;
94
- if (!isAborted)
95
- isAborted = util.aborted(payload, currLen);
96
- }
97
- }
98
- if (asyncResult) {
99
- return asyncResult.then(() => {
100
- return payload;
101
- });
102
- }
103
- return payload;
104
- };
105
- // const handleChecksResult = (
106
- // checkResult: ParsePayload,
107
- // originalResult: ParsePayload,
108
- // ctx: ParseContextInternal
109
- // ): util.MaybeAsync<ParsePayload> => {
110
- // // if the checks mutated the value && there are no issues, re-parse the result
111
- // if (checkResult.value !== originalResult.value && !checkResult.issues.length)
112
- // return inst._zod.parse(checkResult, ctx);
113
- // return originalResult;
114
- // };
115
- const handleCanaryResult = (canary, payload, ctx) => {
116
- // abort if the canary is aborted
117
- if (util.aborted(canary)) {
118
- canary.aborted = true;
119
- return canary;
120
- }
121
- // run checks first, then
122
- const checkResult = runChecks(payload, checks, ctx);
123
- if (checkResult instanceof Promise) {
124
- if (ctx.async === false)
125
- throw new core.$ZodAsyncError();
126
- return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
127
- }
128
- return inst._zod.parse(checkResult, ctx);
129
- };
130
- inst._zod.run = (payload, ctx) => {
131
- if (ctx.skipChecks) {
132
- return inst._zod.parse(payload, ctx);
133
- }
134
- if (ctx.direction === "backward") {
135
- // run canary
136
- // initial pass (no checks)
137
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
138
- if (canary instanceof Promise) {
139
- return canary.then((canary) => {
140
- return handleCanaryResult(canary, payload, ctx);
141
- });
142
- }
143
- return handleCanaryResult(canary, payload, ctx);
144
- }
145
- // forward
146
- const result = inst._zod.parse(payload, ctx);
147
- if (result instanceof Promise) {
148
- if (ctx.async === false)
149
- throw new core.$ZodAsyncError();
150
- return result.then((result) => runChecks(result, checks, ctx));
151
- }
152
- return runChecks(result, checks, ctx);
153
- };
154
- }
155
- inst["~standard"] = {
156
- validate: (value) => {
157
- try {
158
- const r = (0, parse_js_1.safeParse)(inst, value);
159
- return r.success ? { value: r.data } : { issues: r.error?.issues };
160
- }
161
- catch (_) {
162
- return (0, parse_js_1.safeParseAsync)(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
163
- }
164
- },
165
- vendor: "zod",
166
- version: 1,
167
- };
168
- });
169
- var util_js_1 = require("./util.cjs");
170
- Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return util_js_1.clone; } });
171
- exports.$ZodString = core.$constructor("$ZodString", (inst, def) => {
172
- exports.$ZodType.init(inst, def);
173
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
174
- inst._zod.parse = (payload, _) => {
175
- if (def.coerce)
176
- try {
177
- payload.value = String(payload.value);
178
- }
179
- catch (_) { }
180
- if (typeof payload.value === "string")
181
- return payload;
182
- payload.issues.push({
183
- expected: "string",
184
- code: "invalid_type",
185
- input: payload.value,
186
- inst,
187
- });
188
- return payload;
189
- };
190
- });
191
- exports.$ZodStringFormat = core.$constructor("$ZodStringFormat", (inst, def) => {
192
- // check initialization must come first
193
- checks.$ZodCheckStringFormat.init(inst, def);
194
- exports.$ZodString.init(inst, def);
195
- });
196
- exports.$ZodGUID = core.$constructor("$ZodGUID", (inst, def) => {
197
- def.pattern ?? (def.pattern = regexes.guid);
198
- exports.$ZodStringFormat.init(inst, def);
199
- });
200
- exports.$ZodUUID = core.$constructor("$ZodUUID", (inst, def) => {
201
- if (def.version) {
202
- const versionMap = {
203
- v1: 1,
204
- v2: 2,
205
- v3: 3,
206
- v4: 4,
207
- v5: 5,
208
- v6: 6,
209
- v7: 7,
210
- v8: 8,
211
- };
212
- const v = versionMap[def.version];
213
- if (v === undefined)
214
- throw new Error(`Invalid UUID version: "${def.version}"`);
215
- def.pattern ?? (def.pattern = regexes.uuid(v));
216
- }
217
- else
218
- def.pattern ?? (def.pattern = regexes.uuid());
219
- exports.$ZodStringFormat.init(inst, def);
220
- });
221
- exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
222
- def.pattern ?? (def.pattern = regexes.email);
223
- exports.$ZodStringFormat.init(inst, def);
224
- });
225
- exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
226
- exports.$ZodStringFormat.init(inst, def);
227
- inst._zod.check = (payload) => {
228
- try {
229
- // Trim whitespace from input
230
- const trimmed = payload.value.trim();
231
- // @ts-ignore
232
- const url = new URL(trimmed);
233
- if (def.hostname) {
234
- def.hostname.lastIndex = 0;
235
- if (!def.hostname.test(url.hostname)) {
236
- payload.issues.push({
237
- code: "invalid_format",
238
- format: "url",
239
- note: "Invalid hostname",
240
- pattern: regexes.hostname.source,
241
- input: payload.value,
242
- inst,
243
- continue: !def.abort,
244
- });
245
- }
246
- }
247
- if (def.protocol) {
248
- def.protocol.lastIndex = 0;
249
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
250
- payload.issues.push({
251
- code: "invalid_format",
252
- format: "url",
253
- note: "Invalid protocol",
254
- pattern: def.protocol.source,
255
- input: payload.value,
256
- inst,
257
- continue: !def.abort,
258
- });
259
- }
260
- }
261
- // Set the output value based on normalize flag
262
- if (def.normalize) {
263
- // Use normalized URL
264
- payload.value = url.href;
265
- }
266
- else {
267
- // Preserve the original input (trimmed)
268
- payload.value = trimmed;
269
- }
270
- return;
271
- }
272
- catch (_) {
273
- payload.issues.push({
274
- code: "invalid_format",
275
- format: "url",
276
- input: payload.value,
277
- inst,
278
- continue: !def.abort,
279
- });
280
- }
281
- };
282
- });
283
- exports.$ZodEmoji = core.$constructor("$ZodEmoji", (inst, def) => {
284
- def.pattern ?? (def.pattern = regexes.emoji());
285
- exports.$ZodStringFormat.init(inst, def);
286
- });
287
- exports.$ZodNanoID = core.$constructor("$ZodNanoID", (inst, def) => {
288
- def.pattern ?? (def.pattern = regexes.nanoid);
289
- exports.$ZodStringFormat.init(inst, def);
290
- });
291
- exports.$ZodCUID = core.$constructor("$ZodCUID", (inst, def) => {
292
- def.pattern ?? (def.pattern = regexes.cuid);
293
- exports.$ZodStringFormat.init(inst, def);
294
- });
295
- exports.$ZodCUID2 = core.$constructor("$ZodCUID2", (inst, def) => {
296
- def.pattern ?? (def.pattern = regexes.cuid2);
297
- exports.$ZodStringFormat.init(inst, def);
298
- });
299
- exports.$ZodULID = core.$constructor("$ZodULID", (inst, def) => {
300
- def.pattern ?? (def.pattern = regexes.ulid);
301
- exports.$ZodStringFormat.init(inst, def);
302
- });
303
- exports.$ZodXID = core.$constructor("$ZodXID", (inst, def) => {
304
- def.pattern ?? (def.pattern = regexes.xid);
305
- exports.$ZodStringFormat.init(inst, def);
306
- });
307
- exports.$ZodKSUID = core.$constructor("$ZodKSUID", (inst, def) => {
308
- def.pattern ?? (def.pattern = regexes.ksuid);
309
- exports.$ZodStringFormat.init(inst, def);
310
- });
311
- exports.$ZodISODateTime = core.$constructor("$ZodISODateTime", (inst, def) => {
312
- def.pattern ?? (def.pattern = regexes.datetime(def));
313
- exports.$ZodStringFormat.init(inst, def);
314
- });
315
- exports.$ZodISODate = core.$constructor("$ZodISODate", (inst, def) => {
316
- def.pattern ?? (def.pattern = regexes.date);
317
- exports.$ZodStringFormat.init(inst, def);
318
- });
319
- exports.$ZodISOTime = core.$constructor("$ZodISOTime", (inst, def) => {
320
- def.pattern ?? (def.pattern = regexes.time(def));
321
- exports.$ZodStringFormat.init(inst, def);
322
- });
323
- exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
324
- def.pattern ?? (def.pattern = regexes.duration);
325
- exports.$ZodStringFormat.init(inst, def);
326
- });
327
- exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
328
- def.pattern ?? (def.pattern = regexes.ipv4);
329
- exports.$ZodStringFormat.init(inst, def);
330
- inst._zod.onattach.push((inst) => {
331
- const bag = inst._zod.bag;
332
- bag.format = `ipv4`;
333
- });
334
- });
335
- exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
336
- def.pattern ?? (def.pattern = regexes.ipv6);
337
- exports.$ZodStringFormat.init(inst, def);
338
- inst._zod.onattach.push((inst) => {
339
- const bag = inst._zod.bag;
340
- bag.format = `ipv6`;
341
- });
342
- inst._zod.check = (payload) => {
343
- try {
344
- // @ts-ignore
345
- new URL(`http://[${payload.value}]`);
346
- // return;
347
- }
348
- catch {
349
- payload.issues.push({
350
- code: "invalid_format",
351
- format: "ipv6",
352
- input: payload.value,
353
- inst,
354
- continue: !def.abort,
355
- });
356
- }
357
- };
358
- });
359
- exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
360
- def.pattern ?? (def.pattern = regexes.cidrv4);
361
- exports.$ZodStringFormat.init(inst, def);
362
- });
363
- exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
364
- def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
365
- exports.$ZodStringFormat.init(inst, def);
366
- inst._zod.check = (payload) => {
367
- const parts = payload.value.split("/");
368
- try {
369
- if (parts.length !== 2)
370
- throw new Error();
371
- const [address, prefix] = parts;
372
- if (!prefix)
373
- throw new Error();
374
- const prefixNum = Number(prefix);
375
- if (`${prefixNum}` !== prefix)
376
- throw new Error();
377
- if (prefixNum < 0 || prefixNum > 128)
378
- throw new Error();
379
- // @ts-ignore
380
- new URL(`http://[${address}]`);
381
- }
382
- catch {
383
- payload.issues.push({
384
- code: "invalid_format",
385
- format: "cidrv6",
386
- input: payload.value,
387
- inst,
388
- continue: !def.abort,
389
- });
390
- }
391
- };
392
- });
393
- ////////////////////////////// ZodBase64 //////////////////////////////
394
- function isValidBase64(data) {
395
- if (data === "")
396
- return true;
397
- if (data.length % 4 !== 0)
398
- return false;
399
- try {
400
- // @ts-ignore
401
- atob(data);
402
- return true;
403
- }
404
- catch {
405
- return false;
406
- }
407
- }
408
- exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
409
- def.pattern ?? (def.pattern = regexes.base64);
410
- exports.$ZodStringFormat.init(inst, def);
411
- inst._zod.onattach.push((inst) => {
412
- inst._zod.bag.contentEncoding = "base64";
413
- });
414
- inst._zod.check = (payload) => {
415
- if (isValidBase64(payload.value))
416
- return;
417
- payload.issues.push({
418
- code: "invalid_format",
419
- format: "base64",
420
- input: payload.value,
421
- inst,
422
- continue: !def.abort,
423
- });
424
- };
425
- });
426
- ////////////////////////////// ZodBase64 //////////////////////////////
427
- function isValidBase64URL(data) {
428
- if (!regexes.base64url.test(data))
429
- return false;
430
- const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
431
- const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
432
- return isValidBase64(padded);
433
- }
434
- exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
435
- def.pattern ?? (def.pattern = regexes.base64url);
436
- exports.$ZodStringFormat.init(inst, def);
437
- inst._zod.onattach.push((inst) => {
438
- inst._zod.bag.contentEncoding = "base64url";
439
- });
440
- inst._zod.check = (payload) => {
441
- if (isValidBase64URL(payload.value))
442
- return;
443
- payload.issues.push({
444
- code: "invalid_format",
445
- format: "base64url",
446
- input: payload.value,
447
- inst,
448
- continue: !def.abort,
449
- });
450
- };
451
- });
452
- exports.$ZodE164 = core.$constructor("$ZodE164", (inst, def) => {
453
- def.pattern ?? (def.pattern = regexes.e164);
454
- exports.$ZodStringFormat.init(inst, def);
455
- });
456
- ////////////////////////////// ZodJWT //////////////////////////////
457
- function isValidJWT(token, algorithm = null) {
458
- try {
459
- const tokensParts = token.split(".");
460
- if (tokensParts.length !== 3)
461
- return false;
462
- const [header] = tokensParts;
463
- if (!header)
464
- return false;
465
- // @ts-ignore
466
- const parsedHeader = JSON.parse(atob(header));
467
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
468
- return false;
469
- if (!parsedHeader.alg)
470
- return false;
471
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
472
- return false;
473
- return true;
474
- }
475
- catch {
476
- return false;
477
- }
478
- }
479
- exports.$ZodJWT = core.$constructor("$ZodJWT", (inst, def) => {
480
- exports.$ZodStringFormat.init(inst, def);
481
- inst._zod.check = (payload) => {
482
- if (isValidJWT(payload.value, def.alg))
483
- return;
484
- payload.issues.push({
485
- code: "invalid_format",
486
- format: "jwt",
487
- input: payload.value,
488
- inst,
489
- continue: !def.abort,
490
- });
491
- };
492
- });
493
- exports.$ZodCustomStringFormat = core.$constructor("$ZodCustomStringFormat", (inst, def) => {
494
- exports.$ZodStringFormat.init(inst, def);
495
- inst._zod.check = (payload) => {
496
- if (def.fn(payload.value))
497
- return;
498
- payload.issues.push({
499
- code: "invalid_format",
500
- format: def.format,
501
- input: payload.value,
502
- inst,
503
- continue: !def.abort,
504
- });
505
- };
506
- });
507
- exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
508
- exports.$ZodType.init(inst, def);
509
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
510
- inst._zod.parse = (payload, _ctx) => {
511
- if (def.coerce)
512
- try {
513
- payload.value = Number(payload.value);
514
- }
515
- catch (_) { }
516
- const input = payload.value;
517
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
518
- return payload;
519
- }
520
- const received = typeof input === "number"
521
- ? Number.isNaN(input)
522
- ? "NaN"
523
- : !Number.isFinite(input)
524
- ? "Infinity"
525
- : undefined
526
- : undefined;
527
- payload.issues.push({
528
- expected: "number",
529
- code: "invalid_type",
530
- input,
531
- inst,
532
- ...(received ? { received } : {}),
533
- });
534
- return payload;
535
- };
536
- });
537
- exports.$ZodNumberFormat = core.$constructor("$ZodNumber", (inst, def) => {
538
- checks.$ZodCheckNumberFormat.init(inst, def);
539
- exports.$ZodNumber.init(inst, def); // no format checksp
540
- });
541
- exports.$ZodBoolean = core.$constructor("$ZodBoolean", (inst, def) => {
542
- exports.$ZodType.init(inst, def);
543
- inst._zod.pattern = regexes.boolean;
544
- inst._zod.parse = (payload, _ctx) => {
545
- if (def.coerce)
546
- try {
547
- payload.value = Boolean(payload.value);
548
- }
549
- catch (_) { }
550
- const input = payload.value;
551
- if (typeof input === "boolean")
552
- return payload;
553
- payload.issues.push({
554
- expected: "boolean",
555
- code: "invalid_type",
556
- input,
557
- inst,
558
- });
559
- return payload;
560
- };
561
- });
562
- exports.$ZodBigInt = core.$constructor("$ZodBigInt", (inst, def) => {
563
- exports.$ZodType.init(inst, def);
564
- inst._zod.pattern = regexes.bigint;
565
- inst._zod.parse = (payload, _ctx) => {
566
- if (def.coerce)
567
- try {
568
- payload.value = BigInt(payload.value);
569
- }
570
- catch (_) { }
571
- if (typeof payload.value === "bigint")
572
- return payload;
573
- payload.issues.push({
574
- expected: "bigint",
575
- code: "invalid_type",
576
- input: payload.value,
577
- inst,
578
- });
579
- return payload;
580
- };
581
- });
582
- exports.$ZodBigIntFormat = core.$constructor("$ZodBigInt", (inst, def) => {
583
- checks.$ZodCheckBigIntFormat.init(inst, def);
584
- exports.$ZodBigInt.init(inst, def); // no format checks
585
- });
586
- exports.$ZodSymbol = core.$constructor("$ZodSymbol", (inst, def) => {
587
- exports.$ZodType.init(inst, def);
588
- inst._zod.parse = (payload, _ctx) => {
589
- const input = payload.value;
590
- if (typeof input === "symbol")
591
- return payload;
592
- payload.issues.push({
593
- expected: "symbol",
594
- code: "invalid_type",
595
- input,
596
- inst,
597
- });
598
- return payload;
599
- };
600
- });
601
- exports.$ZodUndefined = core.$constructor("$ZodUndefined", (inst, def) => {
602
- exports.$ZodType.init(inst, def);
603
- inst._zod.pattern = regexes.undefined;
604
- inst._zod.values = new Set([undefined]);
605
- inst._zod.optin = "optional";
606
- inst._zod.optout = "optional";
607
- inst._zod.parse = (payload, _ctx) => {
608
- const input = payload.value;
609
- if (typeof input === "undefined")
610
- return payload;
611
- payload.issues.push({
612
- expected: "undefined",
613
- code: "invalid_type",
614
- input,
615
- inst,
616
- });
617
- return payload;
618
- };
619
- });
620
- exports.$ZodNull = core.$constructor("$ZodNull", (inst, def) => {
621
- exports.$ZodType.init(inst, def);
622
- inst._zod.pattern = regexes.null;
623
- inst._zod.values = new Set([null]);
624
- inst._zod.parse = (payload, _ctx) => {
625
- const input = payload.value;
626
- if (input === null)
627
- return payload;
628
- payload.issues.push({
629
- expected: "null",
630
- code: "invalid_type",
631
- input,
632
- inst,
633
- });
634
- return payload;
635
- };
636
- });
637
- exports.$ZodAny = core.$constructor("$ZodAny", (inst, def) => {
638
- exports.$ZodType.init(inst, def);
639
- inst._zod.parse = (payload) => payload;
640
- });
641
- exports.$ZodUnknown = core.$constructor("$ZodUnknown", (inst, def) => {
642
- exports.$ZodType.init(inst, def);
643
- inst._zod.parse = (payload) => payload;
644
- });
645
- exports.$ZodNever = core.$constructor("$ZodNever", (inst, def) => {
646
- exports.$ZodType.init(inst, def);
647
- inst._zod.parse = (payload, _ctx) => {
648
- payload.issues.push({
649
- expected: "never",
650
- code: "invalid_type",
651
- input: payload.value,
652
- inst,
653
- });
654
- return payload;
655
- };
656
- });
657
- exports.$ZodVoid = core.$constructor("$ZodVoid", (inst, def) => {
658
- exports.$ZodType.init(inst, def);
659
- inst._zod.parse = (payload, _ctx) => {
660
- const input = payload.value;
661
- if (typeof input === "undefined")
662
- return payload;
663
- payload.issues.push({
664
- expected: "void",
665
- code: "invalid_type",
666
- input,
667
- inst,
668
- });
669
- return payload;
670
- };
671
- });
672
- exports.$ZodDate = core.$constructor("$ZodDate", (inst, def) => {
673
- exports.$ZodType.init(inst, def);
674
- inst._zod.parse = (payload, _ctx) => {
675
- if (def.coerce) {
676
- try {
677
- payload.value = new Date(payload.value);
678
- }
679
- catch (_err) { }
680
- }
681
- const input = payload.value;
682
- const isDate = input instanceof Date;
683
- const isValidDate = isDate && !Number.isNaN(input.getTime());
684
- if (isValidDate)
685
- return payload;
686
- payload.issues.push({
687
- expected: "date",
688
- code: "invalid_type",
689
- input,
690
- ...(isDate ? { received: "Invalid Date" } : {}),
691
- inst,
692
- });
693
- return payload;
694
- };
695
- });
696
- function handleArrayResult(result, final, index) {
697
- if (result.issues.length) {
698
- final.issues.push(...util.prefixIssues(index, result.issues));
699
- }
700
- final.value[index] = result.value;
701
- }
702
- exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
703
- exports.$ZodType.init(inst, def);
704
- inst._zod.parse = (payload, ctx) => {
705
- const input = payload.value;
706
- if (!Array.isArray(input)) {
707
- payload.issues.push({
708
- expected: "array",
709
- code: "invalid_type",
710
- input,
711
- inst,
712
- });
713
- return payload;
714
- }
715
- payload.value = Array(input.length);
716
- const proms = [];
717
- for (let i = 0; i < input.length; i++) {
718
- const item = input[i];
719
- const result = def.element._zod.run({
720
- value: item,
721
- issues: [],
722
- }, ctx);
723
- if (result instanceof Promise) {
724
- proms.push(result.then((result) => handleArrayResult(result, payload, i)));
725
- }
726
- else {
727
- handleArrayResult(result, payload, i);
728
- }
729
- }
730
- if (proms.length) {
731
- return Promise.all(proms).then(() => payload);
732
- }
733
- return payload; //handleArrayResultsAsync(parseResults, final);
734
- };
735
- });
736
- function handlePropertyResult(result, final, key, input) {
737
- if (result.issues.length) {
738
- final.issues.push(...util.prefixIssues(key, result.issues));
739
- }
740
- if (result.value === undefined) {
741
- if (key in input) {
742
- final.value[key] = undefined;
743
- }
744
- }
745
- else {
746
- final.value[key] = result.value;
747
- }
748
- }
749
- function normalizeDef(def) {
750
- const keys = Object.keys(def.shape);
751
- for (const k of keys) {
752
- if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
753
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
754
- }
755
- }
756
- const okeys = util.optionalKeys(def.shape);
757
- return {
758
- ...def,
759
- keys,
760
- keySet: new Set(keys),
761
- numKeys: keys.length,
762
- optionalKeys: new Set(okeys),
763
- };
764
- }
765
- function handleCatchall(proms, input, payload, ctx, def, inst) {
766
- const unrecognized = [];
767
- // iterate over input keys
768
- const keySet = def.keySet;
769
- const _catchall = def.catchall._zod;
770
- const t = _catchall.def.type;
771
- for (const key of Object.keys(input)) {
772
- if (keySet.has(key))
773
- continue;
774
- if (t === "never") {
775
- unrecognized.push(key);
776
- continue;
777
- }
778
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
779
- if (r instanceof Promise) {
780
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
781
- }
782
- else {
783
- handlePropertyResult(r, payload, key, input);
784
- }
785
- }
786
- if (unrecognized.length) {
787
- payload.issues.push({
788
- code: "unrecognized_keys",
789
- keys: unrecognized,
790
- input,
791
- inst,
792
- });
793
- }
794
- if (!proms.length)
795
- return payload;
796
- return Promise.all(proms).then(() => {
797
- return payload;
798
- });
799
- }
800
- exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
801
- // requires cast because technically $ZodObject doesn't extend
802
- exports.$ZodType.init(inst, def);
803
- // const sh = def.shape;
804
- const desc = Object.getOwnPropertyDescriptor(def, "shape");
805
- if (!desc?.get) {
806
- const sh = def.shape;
807
- Object.defineProperty(def, "shape", {
808
- get: () => {
809
- const newSh = { ...sh };
810
- Object.defineProperty(def, "shape", {
811
- value: newSh,
812
- });
813
- return newSh;
814
- },
815
- });
816
- }
817
- const _normalized = util.cached(() => normalizeDef(def));
818
- util.defineLazy(inst._zod, "propValues", () => {
819
- const shape = def.shape;
820
- const propValues = {};
821
- for (const key in shape) {
822
- const field = shape[key]._zod;
823
- if (field.values) {
824
- propValues[key] ?? (propValues[key] = new Set());
825
- for (const v of field.values)
826
- propValues[key].add(v);
827
- }
828
- }
829
- return propValues;
830
- });
831
- const isObject = util.isObject;
832
- const catchall = def.catchall;
833
- let value;
834
- inst._zod.parse = (payload, ctx) => {
835
- value ?? (value = _normalized.value);
836
- const input = payload.value;
837
- if (!isObject(input)) {
838
- payload.issues.push({
839
- expected: "object",
840
- code: "invalid_type",
841
- input,
842
- inst,
843
- });
844
- return payload;
845
- }
846
- payload.value = {};
847
- const proms = [];
848
- const shape = value.shape;
849
- for (const key of value.keys) {
850
- const el = shape[key];
851
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
852
- if (r instanceof Promise) {
853
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
854
- }
855
- else {
856
- handlePropertyResult(r, payload, key, input);
857
- }
858
- }
859
- if (!catchall) {
860
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
861
- }
862
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
863
- };
864
- });
865
- exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
866
- // requires cast because technically $ZodObject doesn't extend
867
- exports.$ZodObject.init(inst, def);
868
- const superParse = inst._zod.parse;
869
- const _normalized = util.cached(() => normalizeDef(def));
870
- const generateFastpass = (shape) => {
871
- const doc = new doc_js_1.Doc(["shape", "payload", "ctx"]);
872
- const normalized = _normalized.value;
873
- const parseStr = (key) => {
874
- const k = util.esc(key);
875
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
876
- };
877
- doc.write(`const input = payload.value;`);
878
- const ids = Object.create(null);
879
- let counter = 0;
880
- for (const key of normalized.keys) {
881
- ids[key] = `key_${counter++}`;
882
- }
883
- // A: preserve key order {
884
- doc.write(`const newResult = {};`);
885
- for (const key of normalized.keys) {
886
- const id = ids[key];
887
- const k = util.esc(key);
888
- doc.write(`const ${id} = ${parseStr(key)};`);
889
- doc.write(`
890
- if (${id}.issues.length) {
891
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
892
- ...iss,
893
- path: iss.path ? [${k}, ...iss.path] : [${k}]
894
- })));
895
- }
896
-
897
-
898
- if (${id}.value === undefined) {
899
- if (${k} in input) {
900
- newResult[${k}] = undefined;
901
- }
902
- } else {
903
- newResult[${k}] = ${id}.value;
904
- }
905
-
906
- `);
907
- }
908
- doc.write(`payload.value = newResult;`);
909
- doc.write(`return payload;`);
910
- const fn = doc.compile();
911
- return (payload, ctx) => fn(shape, payload, ctx);
912
- };
913
- let fastpass;
914
- const isObject = util.isObject;
915
- const jit = !core.globalConfig.jitless;
916
- const allowsEval = util.allowsEval;
917
- const fastEnabled = jit && allowsEval.value; // && !def.catchall;
918
- const catchall = def.catchall;
919
- let value;
920
- inst._zod.parse = (payload, ctx) => {
921
- value ?? (value = _normalized.value);
922
- const input = payload.value;
923
- if (!isObject(input)) {
924
- payload.issues.push({
925
- expected: "object",
926
- code: "invalid_type",
927
- input,
928
- inst,
929
- });
930
- return payload;
931
- }
932
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
933
- // always synchronous
934
- if (!fastpass)
935
- fastpass = generateFastpass(def.shape);
936
- payload = fastpass(payload, ctx);
937
- if (!catchall)
938
- return payload;
939
- return handleCatchall([], input, payload, ctx, value, inst);
940
- }
941
- return superParse(payload, ctx);
942
- };
943
- });
944
- function handleUnionResults(results, final, inst, ctx) {
945
- for (const result of results) {
946
- if (result.issues.length === 0) {
947
- final.value = result.value;
948
- return final;
949
- }
950
- }
951
- const nonaborted = results.filter((r) => !util.aborted(r));
952
- if (nonaborted.length === 1) {
953
- final.value = nonaborted[0].value;
954
- return nonaborted[0];
955
- }
956
- final.issues.push({
957
- code: "invalid_union",
958
- input: final.value,
959
- inst,
960
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
961
- });
962
- return final;
963
- }
964
- exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
965
- exports.$ZodType.init(inst, def);
966
- util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
967
- util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
968
- util.defineLazy(inst._zod, "values", () => {
969
- if (def.options.every((o) => o._zod.values)) {
970
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
971
- }
972
- return undefined;
973
- });
974
- util.defineLazy(inst._zod, "pattern", () => {
975
- if (def.options.every((o) => o._zod.pattern)) {
976
- const patterns = def.options.map((o) => o._zod.pattern);
977
- return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
978
- }
979
- return undefined;
980
- });
981
- const single = def.options.length === 1;
982
- const first = def.options[0]._zod.run;
983
- inst._zod.parse = (payload, ctx) => {
984
- if (single) {
985
- return first(payload, ctx);
986
- }
987
- let async = false;
988
- const results = [];
989
- for (const option of def.options) {
990
- const result = option._zod.run({
991
- value: payload.value,
992
- issues: [],
993
- }, ctx);
994
- if (result instanceof Promise) {
995
- results.push(result);
996
- async = true;
997
- }
998
- else {
999
- if (result.issues.length === 0)
1000
- return result;
1001
- results.push(result);
1002
- }
1003
- }
1004
- if (!async)
1005
- return handleUnionResults(results, payload, inst, ctx);
1006
- return Promise.all(results).then((results) => {
1007
- return handleUnionResults(results, payload, inst, ctx);
1008
- });
1009
- };
1010
- });
1011
- exports.$ZodDiscriminatedUnion =
1012
- /*@__PURE__*/
1013
- core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
1014
- exports.$ZodUnion.init(inst, def);
1015
- const _super = inst._zod.parse;
1016
- util.defineLazy(inst._zod, "propValues", () => {
1017
- const propValues = {};
1018
- for (const option of def.options) {
1019
- const pv = option._zod.propValues;
1020
- if (!pv || Object.keys(pv).length === 0)
1021
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1022
- for (const [k, v] of Object.entries(pv)) {
1023
- if (!propValues[k])
1024
- propValues[k] = new Set();
1025
- for (const val of v) {
1026
- propValues[k].add(val);
1027
- }
1028
- }
1029
- }
1030
- return propValues;
1031
- });
1032
- const disc = util.cached(() => {
1033
- const opts = def.options;
1034
- const map = new Map();
1035
- for (const o of opts) {
1036
- const values = o._zod.propValues?.[def.discriminator];
1037
- if (!values || values.size === 0)
1038
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
1039
- for (const v of values) {
1040
- if (map.has(v)) {
1041
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
1042
- }
1043
- map.set(v, o);
1044
- }
1045
- }
1046
- return map;
1047
- });
1048
- inst._zod.parse = (payload, ctx) => {
1049
- const input = payload.value;
1050
- if (!util.isObject(input)) {
1051
- payload.issues.push({
1052
- code: "invalid_type",
1053
- expected: "object",
1054
- input,
1055
- inst,
1056
- });
1057
- return payload;
1058
- }
1059
- const opt = disc.value.get(input?.[def.discriminator]);
1060
- if (opt) {
1061
- return opt._zod.run(payload, ctx);
1062
- }
1063
- if (def.unionFallback) {
1064
- return _super(payload, ctx);
1065
- }
1066
- // no matching discriminator
1067
- payload.issues.push({
1068
- code: "invalid_union",
1069
- errors: [],
1070
- note: "No matching discriminator",
1071
- discriminator: def.discriminator,
1072
- input,
1073
- path: [def.discriminator],
1074
- inst,
1075
- });
1076
- return payload;
1077
- };
1078
- });
1079
- exports.$ZodIntersection = core.$constructor("$ZodIntersection", (inst, def) => {
1080
- exports.$ZodType.init(inst, def);
1081
- inst._zod.parse = (payload, ctx) => {
1082
- const input = payload.value;
1083
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1084
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1085
- const async = left instanceof Promise || right instanceof Promise;
1086
- if (async) {
1087
- return Promise.all([left, right]).then(([left, right]) => {
1088
- return handleIntersectionResults(payload, left, right);
1089
- });
1090
- }
1091
- return handleIntersectionResults(payload, left, right);
1092
- };
1093
- });
1094
- function mergeValues(a, b) {
1095
- // const aType = parse.t(a);
1096
- // const bType = parse.t(b);
1097
- if (a === b) {
1098
- return { valid: true, data: a };
1099
- }
1100
- if (a instanceof Date && b instanceof Date && +a === +b) {
1101
- return { valid: true, data: a };
1102
- }
1103
- if (util.isPlainObject(a) && util.isPlainObject(b)) {
1104
- const bKeys = Object.keys(b);
1105
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1106
- const newObj = { ...a, ...b };
1107
- for (const key of sharedKeys) {
1108
- const sharedValue = mergeValues(a[key], b[key]);
1109
- if (!sharedValue.valid) {
1110
- return {
1111
- valid: false,
1112
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
1113
- };
1114
- }
1115
- newObj[key] = sharedValue.data;
1116
- }
1117
- return { valid: true, data: newObj };
1118
- }
1119
- if (Array.isArray(a) && Array.isArray(b)) {
1120
- if (a.length !== b.length) {
1121
- return { valid: false, mergeErrorPath: [] };
1122
- }
1123
- const newArray = [];
1124
- for (let index = 0; index < a.length; index++) {
1125
- const itemA = a[index];
1126
- const itemB = b[index];
1127
- const sharedValue = mergeValues(itemA, itemB);
1128
- if (!sharedValue.valid) {
1129
- return {
1130
- valid: false,
1131
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
1132
- };
1133
- }
1134
- newArray.push(sharedValue.data);
1135
- }
1136
- return { valid: true, data: newArray };
1137
- }
1138
- return { valid: false, mergeErrorPath: [] };
1139
- }
1140
- function handleIntersectionResults(result, left, right) {
1141
- if (left.issues.length) {
1142
- result.issues.push(...left.issues);
1143
- }
1144
- if (right.issues.length) {
1145
- result.issues.push(...right.issues);
1146
- }
1147
- if (util.aborted(result))
1148
- return result;
1149
- const merged = mergeValues(left.value, right.value);
1150
- if (!merged.valid) {
1151
- throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
1152
- }
1153
- result.value = merged.data;
1154
- return result;
1155
- }
1156
- exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
1157
- exports.$ZodType.init(inst, def);
1158
- const items = def.items;
1159
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1160
- inst._zod.parse = (payload, ctx) => {
1161
- const input = payload.value;
1162
- if (!Array.isArray(input)) {
1163
- payload.issues.push({
1164
- input,
1165
- inst,
1166
- expected: "tuple",
1167
- code: "invalid_type",
1168
- });
1169
- return payload;
1170
- }
1171
- payload.value = [];
1172
- const proms = [];
1173
- if (!def.rest) {
1174
- const tooBig = input.length > items.length;
1175
- const tooSmall = input.length < optStart - 1;
1176
- if (tooBig || tooSmall) {
1177
- payload.issues.push({
1178
- ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
1179
- input,
1180
- inst,
1181
- origin: "array",
1182
- });
1183
- return payload;
1184
- }
1185
- }
1186
- let i = -1;
1187
- for (const item of items) {
1188
- i++;
1189
- if (i >= input.length)
1190
- if (i >= optStart)
1191
- continue;
1192
- const result = item._zod.run({
1193
- value: input[i],
1194
- issues: [],
1195
- }, ctx);
1196
- if (result instanceof Promise) {
1197
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1198
- }
1199
- else {
1200
- handleTupleResult(result, payload, i);
1201
- }
1202
- }
1203
- if (def.rest) {
1204
- const rest = input.slice(items.length);
1205
- for (const el of rest) {
1206
- i++;
1207
- const result = def.rest._zod.run({
1208
- value: el,
1209
- issues: [],
1210
- }, ctx);
1211
- if (result instanceof Promise) {
1212
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1213
- }
1214
- else {
1215
- handleTupleResult(result, payload, i);
1216
- }
1217
- }
1218
- }
1219
- if (proms.length)
1220
- return Promise.all(proms).then(() => payload);
1221
- return payload;
1222
- };
1223
- });
1224
- function handleTupleResult(result, final, index) {
1225
- if (result.issues.length) {
1226
- final.issues.push(...util.prefixIssues(index, result.issues));
1227
- }
1228
- final.value[index] = result.value;
1229
- }
1230
- exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
1231
- exports.$ZodType.init(inst, def);
1232
- inst._zod.parse = (payload, ctx) => {
1233
- const input = payload.value;
1234
- if (!util.isPlainObject(input)) {
1235
- payload.issues.push({
1236
- expected: "record",
1237
- code: "invalid_type",
1238
- input,
1239
- inst,
1240
- });
1241
- return payload;
1242
- }
1243
- const proms = [];
1244
- if (def.keyType._zod.values) {
1245
- const values = def.keyType._zod.values;
1246
- payload.value = {};
1247
- for (const key of values) {
1248
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1249
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1250
- if (result instanceof Promise) {
1251
- proms.push(result.then((result) => {
1252
- if (result.issues.length) {
1253
- payload.issues.push(...util.prefixIssues(key, result.issues));
1254
- }
1255
- payload.value[key] = result.value;
1256
- }));
1257
- }
1258
- else {
1259
- if (result.issues.length) {
1260
- payload.issues.push(...util.prefixIssues(key, result.issues));
1261
- }
1262
- payload.value[key] = result.value;
1263
- }
1264
- }
1265
- }
1266
- let unrecognized;
1267
- for (const key in input) {
1268
- if (!values.has(key)) {
1269
- unrecognized = unrecognized ?? [];
1270
- unrecognized.push(key);
1271
- }
1272
- }
1273
- if (unrecognized && unrecognized.length > 0) {
1274
- payload.issues.push({
1275
- code: "unrecognized_keys",
1276
- input,
1277
- inst,
1278
- keys: unrecognized,
1279
- });
1280
- }
1281
- }
1282
- else {
1283
- payload.value = {};
1284
- for (const key of Reflect.ownKeys(input)) {
1285
- if (key === "__proto__")
1286
- continue;
1287
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1288
- if (keyResult instanceof Promise) {
1289
- throw new Error("Async schemas not supported in object keys currently");
1290
- }
1291
- if (keyResult.issues.length) {
1292
- payload.issues.push({
1293
- code: "invalid_key",
1294
- origin: "record",
1295
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1296
- input: key,
1297
- path: [key],
1298
- inst,
1299
- });
1300
- payload.value[keyResult.value] = keyResult.value;
1301
- continue;
1302
- }
1303
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1304
- if (result instanceof Promise) {
1305
- proms.push(result.then((result) => {
1306
- if (result.issues.length) {
1307
- payload.issues.push(...util.prefixIssues(key, result.issues));
1308
- }
1309
- payload.value[keyResult.value] = result.value;
1310
- }));
1311
- }
1312
- else {
1313
- if (result.issues.length) {
1314
- payload.issues.push(...util.prefixIssues(key, result.issues));
1315
- }
1316
- payload.value[keyResult.value] = result.value;
1317
- }
1318
- }
1319
- }
1320
- if (proms.length) {
1321
- return Promise.all(proms).then(() => payload);
1322
- }
1323
- return payload;
1324
- };
1325
- });
1326
- exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
1327
- exports.$ZodType.init(inst, def);
1328
- inst._zod.parse = (payload, ctx) => {
1329
- const input = payload.value;
1330
- if (!(input instanceof Map)) {
1331
- payload.issues.push({
1332
- expected: "map",
1333
- code: "invalid_type",
1334
- input,
1335
- inst,
1336
- });
1337
- return payload;
1338
- }
1339
- const proms = [];
1340
- payload.value = new Map();
1341
- for (const [key, value] of input) {
1342
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1343
- const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
1344
- if (keyResult instanceof Promise || valueResult instanceof Promise) {
1345
- proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
1346
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1347
- }));
1348
- }
1349
- else {
1350
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1351
- }
1352
- }
1353
- if (proms.length)
1354
- return Promise.all(proms).then(() => payload);
1355
- return payload;
1356
- };
1357
- });
1358
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
1359
- if (keyResult.issues.length) {
1360
- if (util.propertyKeyTypes.has(typeof key)) {
1361
- final.issues.push(...util.prefixIssues(key, keyResult.issues));
1362
- }
1363
- else {
1364
- final.issues.push({
1365
- code: "invalid_key",
1366
- origin: "map",
1367
- input,
1368
- inst,
1369
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1370
- });
1371
- }
1372
- }
1373
- if (valueResult.issues.length) {
1374
- if (util.propertyKeyTypes.has(typeof key)) {
1375
- final.issues.push(...util.prefixIssues(key, valueResult.issues));
1376
- }
1377
- else {
1378
- final.issues.push({
1379
- origin: "map",
1380
- code: "invalid_element",
1381
- input,
1382
- inst,
1383
- key: key,
1384
- issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1385
- });
1386
- }
1387
- }
1388
- final.value.set(keyResult.value, valueResult.value);
1389
- }
1390
- exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
1391
- exports.$ZodType.init(inst, def);
1392
- inst._zod.parse = (payload, ctx) => {
1393
- const input = payload.value;
1394
- if (!(input instanceof Set)) {
1395
- payload.issues.push({
1396
- input,
1397
- inst,
1398
- expected: "set",
1399
- code: "invalid_type",
1400
- });
1401
- return payload;
1402
- }
1403
- const proms = [];
1404
- payload.value = new Set();
1405
- for (const item of input) {
1406
- const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
1407
- if (result instanceof Promise) {
1408
- proms.push(result.then((result) => handleSetResult(result, payload)));
1409
- }
1410
- else
1411
- handleSetResult(result, payload);
1412
- }
1413
- if (proms.length)
1414
- return Promise.all(proms).then(() => payload);
1415
- return payload;
1416
- };
1417
- });
1418
- function handleSetResult(result, final) {
1419
- if (result.issues.length) {
1420
- final.issues.push(...result.issues);
1421
- }
1422
- final.value.add(result.value);
1423
- }
1424
- exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
1425
- exports.$ZodType.init(inst, def);
1426
- const values = util.getEnumValues(def.entries);
1427
- const valuesSet = new Set(values);
1428
- inst._zod.values = valuesSet;
1429
- inst._zod.pattern = new RegExp(`^(${values
1430
- .filter((k) => util.propertyKeyTypes.has(typeof k))
1431
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
1432
- .join("|")})$`);
1433
- inst._zod.parse = (payload, _ctx) => {
1434
- const input = payload.value;
1435
- if (valuesSet.has(input)) {
1436
- return payload;
1437
- }
1438
- payload.issues.push({
1439
- code: "invalid_value",
1440
- values,
1441
- input,
1442
- inst,
1443
- });
1444
- return payload;
1445
- };
1446
- });
1447
- exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
1448
- exports.$ZodType.init(inst, def);
1449
- if (def.values.length === 0) {
1450
- throw new Error("Cannot create literal schema with no valid values");
1451
- }
1452
- inst._zod.values = new Set(def.values);
1453
- inst._zod.pattern = new RegExp(`^(${def.values
1454
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
1455
- .join("|")})$`);
1456
- inst._zod.parse = (payload, _ctx) => {
1457
- const input = payload.value;
1458
- if (inst._zod.values.has(input)) {
1459
- return payload;
1460
- }
1461
- payload.issues.push({
1462
- code: "invalid_value",
1463
- values: def.values,
1464
- input,
1465
- inst,
1466
- });
1467
- return payload;
1468
- };
1469
- });
1470
- exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
1471
- exports.$ZodType.init(inst, def);
1472
- inst._zod.parse = (payload, _ctx) => {
1473
- const input = payload.value;
1474
- // @ts-ignore
1475
- if (input instanceof File)
1476
- return payload;
1477
- payload.issues.push({
1478
- expected: "file",
1479
- code: "invalid_type",
1480
- input,
1481
- inst,
1482
- });
1483
- return payload;
1484
- };
1485
- });
1486
- exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
1487
- exports.$ZodType.init(inst, def);
1488
- inst._zod.parse = (payload, ctx) => {
1489
- if (ctx.direction === "backward") {
1490
- throw new core.$ZodEncodeError(inst.constructor.name);
1491
- }
1492
- const _out = def.transform(payload.value, payload);
1493
- if (ctx.async) {
1494
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1495
- return output.then((output) => {
1496
- payload.value = output;
1497
- return payload;
1498
- });
1499
- }
1500
- if (_out instanceof Promise) {
1501
- throw new core.$ZodAsyncError();
1502
- }
1503
- payload.value = _out;
1504
- return payload;
1505
- };
1506
- });
1507
- function handleOptionalResult(result, input) {
1508
- if (result.issues.length && input === undefined) {
1509
- return { issues: [], value: undefined };
1510
- }
1511
- return result;
1512
- }
1513
- exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
1514
- exports.$ZodType.init(inst, def);
1515
- inst._zod.optin = "optional";
1516
- inst._zod.optout = "optional";
1517
- util.defineLazy(inst._zod, "values", () => {
1518
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
1519
- });
1520
- util.defineLazy(inst._zod, "pattern", () => {
1521
- const pattern = def.innerType._zod.pattern;
1522
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1523
- });
1524
- inst._zod.parse = (payload, ctx) => {
1525
- if (def.innerType._zod.optin === "optional") {
1526
- const result = def.innerType._zod.run(payload, ctx);
1527
- if (result instanceof Promise)
1528
- return result.then((r) => handleOptionalResult(r, payload.value));
1529
- return handleOptionalResult(result, payload.value);
1530
- }
1531
- if (payload.value === undefined) {
1532
- return payload;
1533
- }
1534
- return def.innerType._zod.run(payload, ctx);
1535
- };
1536
- });
1537
- exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
1538
- exports.$ZodType.init(inst, def);
1539
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1540
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1541
- util.defineLazy(inst._zod, "pattern", () => {
1542
- const pattern = def.innerType._zod.pattern;
1543
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
1544
- });
1545
- util.defineLazy(inst._zod, "values", () => {
1546
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
1547
- });
1548
- inst._zod.parse = (payload, ctx) => {
1549
- // Forward direction (decode): allow null to pass through
1550
- if (payload.value === null)
1551
- return payload;
1552
- return def.innerType._zod.run(payload, ctx);
1553
- };
1554
- });
1555
- exports.$ZodDefault = core.$constructor("$ZodDefault", (inst, def) => {
1556
- exports.$ZodType.init(inst, def);
1557
- // inst._zod.qin = "true";
1558
- inst._zod.optin = "optional";
1559
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1560
- inst._zod.parse = (payload, ctx) => {
1561
- if (ctx.direction === "backward") {
1562
- return def.innerType._zod.run(payload, ctx);
1563
- }
1564
- // Forward direction (decode): apply defaults for undefined input
1565
- if (payload.value === undefined) {
1566
- payload.value = def.defaultValue;
1567
- /**
1568
- * $ZodDefault returns the default value immediately in forward direction.
1569
- * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
1570
- return payload;
1571
- }
1572
- // Forward direction: continue with default handling
1573
- const result = def.innerType._zod.run(payload, ctx);
1574
- if (result instanceof Promise) {
1575
- return result.then((result) => handleDefaultResult(result, def));
1576
- }
1577
- return handleDefaultResult(result, def);
1578
- };
1579
- });
1580
- function handleDefaultResult(payload, def) {
1581
- if (payload.value === undefined) {
1582
- payload.value = def.defaultValue;
1583
- }
1584
- return payload;
1585
- }
1586
- exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
1587
- exports.$ZodType.init(inst, def);
1588
- inst._zod.optin = "optional";
1589
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1590
- inst._zod.parse = (payload, ctx) => {
1591
- if (ctx.direction === "backward") {
1592
- return def.innerType._zod.run(payload, ctx);
1593
- }
1594
- // Forward direction (decode): apply prefault for undefined input
1595
- if (payload.value === undefined) {
1596
- payload.value = def.defaultValue;
1597
- }
1598
- return def.innerType._zod.run(payload, ctx);
1599
- };
1600
- });
1601
- exports.$ZodNonOptional = core.$constructor("$ZodNonOptional", (inst, def) => {
1602
- exports.$ZodType.init(inst, def);
1603
- util.defineLazy(inst._zod, "values", () => {
1604
- const v = def.innerType._zod.values;
1605
- return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
1606
- });
1607
- inst._zod.parse = (payload, ctx) => {
1608
- const result = def.innerType._zod.run(payload, ctx);
1609
- if (result instanceof Promise) {
1610
- return result.then((result) => handleNonOptionalResult(result, inst));
1611
- }
1612
- return handleNonOptionalResult(result, inst);
1613
- };
1614
- });
1615
- function handleNonOptionalResult(payload, inst) {
1616
- if (!payload.issues.length && payload.value === undefined) {
1617
- payload.issues.push({
1618
- code: "invalid_type",
1619
- expected: "nonoptional",
1620
- input: payload.value,
1621
- inst,
1622
- });
1623
- }
1624
- return payload;
1625
- }
1626
- exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
1627
- exports.$ZodType.init(inst, def);
1628
- inst._zod.parse = (payload, ctx) => {
1629
- if (ctx.direction === "backward") {
1630
- throw new core.$ZodEncodeError("ZodSuccess");
1631
- }
1632
- const result = def.innerType._zod.run(payload, ctx);
1633
- if (result instanceof Promise) {
1634
- return result.then((result) => {
1635
- payload.value = result.issues.length === 0;
1636
- return payload;
1637
- });
1638
- }
1639
- payload.value = result.issues.length === 0;
1640
- return payload;
1641
- };
1642
- });
1643
- exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
1644
- exports.$ZodType.init(inst, def);
1645
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1646
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1647
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1648
- inst._zod.parse = (payload, ctx) => {
1649
- if (ctx.direction === "backward") {
1650
- return def.innerType._zod.run(payload, ctx);
1651
- }
1652
- // Forward direction (decode): apply catch logic
1653
- const result = def.innerType._zod.run(payload, ctx);
1654
- if (result instanceof Promise) {
1655
- return result.then((result) => {
1656
- payload.value = result.value;
1657
- if (result.issues.length) {
1658
- payload.value = def.catchValue({
1659
- ...payload,
1660
- error: {
1661
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1662
- },
1663
- input: payload.value,
1664
- });
1665
- payload.issues = [];
1666
- }
1667
- return payload;
1668
- });
1669
- }
1670
- payload.value = result.value;
1671
- if (result.issues.length) {
1672
- payload.value = def.catchValue({
1673
- ...payload,
1674
- error: {
1675
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1676
- },
1677
- input: payload.value,
1678
- });
1679
- payload.issues = [];
1680
- }
1681
- return payload;
1682
- };
1683
- });
1684
- exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
1685
- exports.$ZodType.init(inst, def);
1686
- inst._zod.parse = (payload, _ctx) => {
1687
- if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
1688
- payload.issues.push({
1689
- input: payload.value,
1690
- inst,
1691
- expected: "nan",
1692
- code: "invalid_type",
1693
- });
1694
- return payload;
1695
- }
1696
- return payload;
1697
- };
1698
- });
1699
- exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
1700
- exports.$ZodType.init(inst, def);
1701
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1702
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1703
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1704
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1705
- inst._zod.parse = (payload, ctx) => {
1706
- if (ctx.direction === "backward") {
1707
- const right = def.out._zod.run(payload, ctx);
1708
- if (right instanceof Promise) {
1709
- return right.then((right) => handlePipeResult(right, def.in, ctx));
1710
- }
1711
- return handlePipeResult(right, def.in, ctx);
1712
- }
1713
- const left = def.in._zod.run(payload, ctx);
1714
- if (left instanceof Promise) {
1715
- return left.then((left) => handlePipeResult(left, def.out, ctx));
1716
- }
1717
- return handlePipeResult(left, def.out, ctx);
1718
- };
1719
- });
1720
- function handlePipeResult(left, next, ctx) {
1721
- if (left.issues.length) {
1722
- // prevent further checks
1723
- left.aborted = true;
1724
- return left;
1725
- }
1726
- return next._zod.run({ value: left.value, issues: left.issues }, ctx);
1727
- }
1728
- exports.$ZodCodec = core.$constructor("$ZodCodec", (inst, def) => {
1729
- exports.$ZodType.init(inst, def);
1730
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1731
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1732
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1733
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1734
- inst._zod.parse = (payload, ctx) => {
1735
- const direction = ctx.direction || "forward";
1736
- if (direction === "forward") {
1737
- const left = def.in._zod.run(payload, ctx);
1738
- if (left instanceof Promise) {
1739
- return left.then((left) => handleCodecAResult(left, def, ctx));
1740
- }
1741
- return handleCodecAResult(left, def, ctx);
1742
- }
1743
- else {
1744
- const right = def.out._zod.run(payload, ctx);
1745
- if (right instanceof Promise) {
1746
- return right.then((right) => handleCodecAResult(right, def, ctx));
1747
- }
1748
- return handleCodecAResult(right, def, ctx);
1749
- }
1750
- };
1751
- });
1752
- function handleCodecAResult(result, def, ctx) {
1753
- if (result.issues.length) {
1754
- // prevent further checks
1755
- result.aborted = true;
1756
- return result;
1757
- }
1758
- const direction = ctx.direction || "forward";
1759
- if (direction === "forward") {
1760
- const transformed = def.transform(result.value, result);
1761
- if (transformed instanceof Promise) {
1762
- return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
1763
- }
1764
- return handleCodecTxResult(result, transformed, def.out, ctx);
1765
- }
1766
- else {
1767
- const transformed = def.reverseTransform(result.value, result);
1768
- if (transformed instanceof Promise) {
1769
- return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
1770
- }
1771
- return handleCodecTxResult(result, transformed, def.in, ctx);
1772
- }
1773
- }
1774
- function handleCodecTxResult(left, value, nextSchema, ctx) {
1775
- // Check if transform added any issues
1776
- if (left.issues.length) {
1777
- left.aborted = true;
1778
- return left;
1779
- }
1780
- return nextSchema._zod.run({ value, issues: left.issues }, ctx);
1781
- }
1782
- exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
1783
- exports.$ZodType.init(inst, def);
1784
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1785
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1786
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1787
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1788
- inst._zod.parse = (payload, ctx) => {
1789
- if (ctx.direction === "backward") {
1790
- return def.innerType._zod.run(payload, ctx);
1791
- }
1792
- const result = def.innerType._zod.run(payload, ctx);
1793
- if (result instanceof Promise) {
1794
- return result.then(handleReadonlyResult);
1795
- }
1796
- return handleReadonlyResult(result);
1797
- };
1798
- });
1799
- function handleReadonlyResult(payload) {
1800
- payload.value = Object.freeze(payload.value);
1801
- return payload;
1802
- }
1803
- exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
1804
- exports.$ZodType.init(inst, def);
1805
- const regexParts = [];
1806
- for (const part of def.parts) {
1807
- if (typeof part === "object" && part !== null) {
1808
- // is Zod schema
1809
- if (!part._zod.pattern) {
1810
- // if (!source)
1811
- throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
1812
- }
1813
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
1814
- if (!source)
1815
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
1816
- const start = source.startsWith("^") ? 1 : 0;
1817
- const end = source.endsWith("$") ? source.length - 1 : source.length;
1818
- regexParts.push(source.slice(start, end));
1819
- }
1820
- else if (part === null || util.primitiveTypes.has(typeof part)) {
1821
- regexParts.push(util.escapeRegex(`${part}`));
1822
- }
1823
- else {
1824
- throw new Error(`Invalid template literal part: ${part}`);
1825
- }
1826
- }
1827
- inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
1828
- inst._zod.parse = (payload, _ctx) => {
1829
- if (typeof payload.value !== "string") {
1830
- payload.issues.push({
1831
- input: payload.value,
1832
- inst,
1833
- expected: "template_literal",
1834
- code: "invalid_type",
1835
- });
1836
- return payload;
1837
- }
1838
- inst._zod.pattern.lastIndex = 0;
1839
- if (!inst._zod.pattern.test(payload.value)) {
1840
- payload.issues.push({
1841
- input: payload.value,
1842
- inst,
1843
- code: "invalid_format",
1844
- format: def.format ?? "template_literal",
1845
- pattern: inst._zod.pattern.source,
1846
- });
1847
- return payload;
1848
- }
1849
- return payload;
1850
- };
1851
- });
1852
- exports.$ZodFunction = core.$constructor("$ZodFunction", (inst, def) => {
1853
- exports.$ZodType.init(inst, def);
1854
- inst._def = def;
1855
- inst._zod.def = def;
1856
- inst.implement = (func) => {
1857
- if (typeof func !== "function") {
1858
- throw new Error("implement() must be called with a function");
1859
- }
1860
- return function (...args) {
1861
- const parsedArgs = inst._def.input ? (0, parse_js_1.parse)(inst._def.input, args) : args;
1862
- const result = Reflect.apply(func, this, parsedArgs);
1863
- if (inst._def.output) {
1864
- return (0, parse_js_1.parse)(inst._def.output, result);
1865
- }
1866
- return result;
1867
- };
1868
- };
1869
- inst.implementAsync = (func) => {
1870
- if (typeof func !== "function") {
1871
- throw new Error("implementAsync() must be called with a function");
1872
- }
1873
- return async function (...args) {
1874
- const parsedArgs = inst._def.input ? await (0, parse_js_1.parseAsync)(inst._def.input, args) : args;
1875
- const result = await Reflect.apply(func, this, parsedArgs);
1876
- if (inst._def.output) {
1877
- return await (0, parse_js_1.parseAsync)(inst._def.output, result);
1878
- }
1879
- return result;
1880
- };
1881
- };
1882
- inst._zod.parse = (payload, _ctx) => {
1883
- if (typeof payload.value !== "function") {
1884
- payload.issues.push({
1885
- code: "invalid_type",
1886
- expected: "function",
1887
- input: payload.value,
1888
- inst,
1889
- });
1890
- return payload;
1891
- }
1892
- // Check if output is a promise type to determine if we should use async implementation
1893
- const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
1894
- if (hasPromiseOutput) {
1895
- payload.value = inst.implementAsync(payload.value);
1896
- }
1897
- else {
1898
- payload.value = inst.implement(payload.value);
1899
- }
1900
- return payload;
1901
- };
1902
- inst.input = (...args) => {
1903
- const F = inst.constructor;
1904
- if (Array.isArray(args[0])) {
1905
- return new F({
1906
- type: "function",
1907
- input: new exports.$ZodTuple({
1908
- type: "tuple",
1909
- items: args[0],
1910
- rest: args[1],
1911
- }),
1912
- output: inst._def.output,
1913
- });
1914
- }
1915
- return new F({
1916
- type: "function",
1917
- input: args[0],
1918
- output: inst._def.output,
1919
- });
1920
- };
1921
- inst.output = (output) => {
1922
- const F = inst.constructor;
1923
- return new F({
1924
- type: "function",
1925
- input: inst._def.input,
1926
- output,
1927
- });
1928
- };
1929
- return inst;
1930
- });
1931
- exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
1932
- exports.$ZodType.init(inst, def);
1933
- inst._zod.parse = (payload, ctx) => {
1934
- return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
1935
- };
1936
- });
1937
- exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
1938
- exports.$ZodType.init(inst, def);
1939
- // let _innerType!: any;
1940
- // util.defineLazy(def, "getter", () => {
1941
- // if (!_innerType) {
1942
- // _innerType = def.getter();
1943
- // }
1944
- // return () => _innerType;
1945
- // });
1946
- util.defineLazy(inst._zod, "innerType", () => def.getter());
1947
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
1948
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
1949
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
1950
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
1951
- inst._zod.parse = (payload, ctx) => {
1952
- const inner = inst._zod.innerType;
1953
- return inner._zod.run(payload, ctx);
1954
- };
1955
- });
1956
- exports.$ZodCustom = core.$constructor("$ZodCustom", (inst, def) => {
1957
- checks.$ZodCheck.init(inst, def);
1958
- exports.$ZodType.init(inst, def);
1959
- inst._zod.parse = (payload, _) => {
1960
- return payload;
1961
- };
1962
- inst._zod.check = (payload) => {
1963
- const input = payload.value;
1964
- const r = def.fn(input);
1965
- if (r instanceof Promise) {
1966
- return r.then((r) => handleRefineResult(r, payload, input, inst));
1967
- }
1968
- handleRefineResult(r, payload, input, inst);
1969
- return;
1970
- };
1971
- });
1972
- function handleRefineResult(result, payload, input, inst) {
1973
- if (!result) {
1974
- const _iss = {
1975
- code: "custom",
1976
- input,
1977
- inst, // incorporates params.error into issue reporting
1978
- path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
1979
- continue: !inst._zod.def.abort,
1980
- // params: inst._zod.def.params,
1981
- };
1982
- if (inst._zod.def.params)
1983
- _iss.params = inst._zod.def.params;
1984
- payload.issues.push(util.issue(_iss));
1985
- }
1986
- }