bupkis 0.18.0 → 0.18.2

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 (377) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -4
  3. package/src/assertion/assertion-types.ts +4 -4
  4. package/src/assertion/impl/async-parametric.ts +4 -21
  5. package/src/assertion/impl/sync-parametric.ts +5 -17
  6. package/src/expect.ts +0 -4
  7. package/src/guards.ts +24 -24
  8. package/src/internal-schema.ts +16 -32
  9. package/src/value-to-schema.ts +1 -1
  10. package/dist/assertion/assertion-async.cjs +0 -268
  11. package/dist/assertion/assertion-async.cjs.map +0 -1
  12. package/dist/assertion/assertion-async.d.cts +0 -40
  13. package/dist/assertion/assertion-async.d.cts.map +0 -1
  14. package/dist/assertion/assertion-async.d.ts +0 -40
  15. package/dist/assertion/assertion-async.d.ts.map +0 -1
  16. package/dist/assertion/assertion-async.js +0 -259
  17. package/dist/assertion/assertion-async.js.map +0 -1
  18. package/dist/assertion/assertion-standard-schema-async.cjs +0 -132
  19. package/dist/assertion/assertion-standard-schema-async.cjs.map +0 -1
  20. package/dist/assertion/assertion-standard-schema-async.d.cts +0 -52
  21. package/dist/assertion/assertion-standard-schema-async.d.cts.map +0 -1
  22. package/dist/assertion/assertion-standard-schema-async.d.ts +0 -52
  23. package/dist/assertion/assertion-standard-schema-async.d.ts.map +0 -1
  24. package/dist/assertion/assertion-standard-schema-async.js +0 -128
  25. package/dist/assertion/assertion-standard-schema-async.js.map +0 -1
  26. package/dist/assertion/assertion-standard-schema-sync.cjs +0 -141
  27. package/dist/assertion/assertion-standard-schema-sync.cjs.map +0 -1
  28. package/dist/assertion/assertion-standard-schema-sync.d.cts +0 -52
  29. package/dist/assertion/assertion-standard-schema-sync.d.cts.map +0 -1
  30. package/dist/assertion/assertion-standard-schema-sync.d.ts +0 -52
  31. package/dist/assertion/assertion-standard-schema-sync.d.ts.map +0 -1
  32. package/dist/assertion/assertion-standard-schema-sync.js +0 -137
  33. package/dist/assertion/assertion-standard-schema-sync.js.map +0 -1
  34. package/dist/assertion/assertion-sync.cjs +0 -284
  35. package/dist/assertion/assertion-sync.cjs.map +0 -1
  36. package/dist/assertion/assertion-sync.d.cts +0 -60
  37. package/dist/assertion/assertion-sync.d.cts.map +0 -1
  38. package/dist/assertion/assertion-sync.d.ts +0 -60
  39. package/dist/assertion/assertion-sync.d.ts.map +0 -1
  40. package/dist/assertion/assertion-sync.js +0 -275
  41. package/dist/assertion/assertion-sync.js.map +0 -1
  42. package/dist/assertion/assertion-types.cjs +0 -20
  43. package/dist/assertion/assertion-types.cjs.map +0 -1
  44. package/dist/assertion/assertion-types.d.cts +0 -1086
  45. package/dist/assertion/assertion-types.d.cts.map +0 -1
  46. package/dist/assertion/assertion-types.d.ts +0 -1086
  47. package/dist/assertion/assertion-types.d.ts.map +0 -1
  48. package/dist/assertion/assertion-types.js +0 -19
  49. package/dist/assertion/assertion-types.js.map +0 -1
  50. package/dist/assertion/assertion.cjs +0 -382
  51. package/dist/assertion/assertion.cjs.map +0 -1
  52. package/dist/assertion/assertion.d.cts +0 -109
  53. package/dist/assertion/assertion.d.cts.map +0 -1
  54. package/dist/assertion/assertion.d.ts +0 -109
  55. package/dist/assertion/assertion.d.ts.map +0 -1
  56. package/dist/assertion/assertion.js +0 -375
  57. package/dist/assertion/assertion.js.map +0 -1
  58. package/dist/assertion/create.cjs +0 -148
  59. package/dist/assertion/create.cjs.map +0 -1
  60. package/dist/assertion/create.d.cts +0 -85
  61. package/dist/assertion/create.d.cts.map +0 -1
  62. package/dist/assertion/create.d.ts +0 -85
  63. package/dist/assertion/create.d.ts.map +0 -1
  64. package/dist/assertion/create.js +0 -143
  65. package/dist/assertion/create.js.map +0 -1
  66. package/dist/assertion/format-assertion-failure.cjs +0 -63
  67. package/dist/assertion/format-assertion-failure.cjs.map +0 -1
  68. package/dist/assertion/format-assertion-failure.d.cts +0 -21
  69. package/dist/assertion/format-assertion-failure.d.cts.map +0 -1
  70. package/dist/assertion/format-assertion-failure.d.ts +0 -21
  71. package/dist/assertion/format-assertion-failure.d.ts.map +0 -1
  72. package/dist/assertion/format-assertion-failure.js +0 -59
  73. package/dist/assertion/format-assertion-failure.js.map +0 -1
  74. package/dist/assertion/impl/assertion-util.cjs +0 -68
  75. package/dist/assertion/impl/assertion-util.cjs.map +0 -1
  76. package/dist/assertion/impl/assertion-util.d.cts +0 -36
  77. package/dist/assertion/impl/assertion-util.d.cts.map +0 -1
  78. package/dist/assertion/impl/assertion-util.d.ts +0 -36
  79. package/dist/assertion/impl/assertion-util.d.ts.map +0 -1
  80. package/dist/assertion/impl/assertion-util.js +0 -62
  81. package/dist/assertion/impl/assertion-util.js.map +0 -1
  82. package/dist/assertion/impl/async-iterable.cjs +0 -627
  83. package/dist/assertion/impl/async-iterable.cjs.map +0 -1
  84. package/dist/assertion/impl/async-iterable.d.cts +0 -406
  85. package/dist/assertion/impl/async-iterable.d.cts.map +0 -1
  86. package/dist/assertion/impl/async-iterable.d.ts +0 -406
  87. package/dist/assertion/impl/async-iterable.d.ts.map +0 -1
  88. package/dist/assertion/impl/async-iterable.js +0 -624
  89. package/dist/assertion/impl/async-iterable.js.map +0 -1
  90. package/dist/assertion/impl/async-parametric.cjs +0 -423
  91. package/dist/assertion/impl/async-parametric.cjs.map +0 -1
  92. package/dist/assertion/impl/async-parametric.d.cts +0 -278
  93. package/dist/assertion/impl/async-parametric.d.cts.map +0 -1
  94. package/dist/assertion/impl/async-parametric.d.ts +0 -278
  95. package/dist/assertion/impl/async-parametric.d.ts.map +0 -1
  96. package/dist/assertion/impl/async-parametric.js +0 -420
  97. package/dist/assertion/impl/async-parametric.js.map +0 -1
  98. package/dist/assertion/impl/async.cjs +0 -56
  99. package/dist/assertion/impl/async.cjs.map +0 -1
  100. package/dist/assertion/impl/async.d.cts +0 -179
  101. package/dist/assertion/impl/async.d.cts.map +0 -1
  102. package/dist/assertion/impl/async.d.ts +0 -179
  103. package/dist/assertion/impl/async.d.ts.map +0 -1
  104. package/dist/assertion/impl/async.js +0 -39
  105. package/dist/assertion/impl/async.js.map +0 -1
  106. package/dist/assertion/impl/index.cjs +0 -37
  107. package/dist/assertion/impl/index.cjs.map +0 -1
  108. package/dist/assertion/impl/index.d.cts +0 -21
  109. package/dist/assertion/impl/index.d.cts.map +0 -1
  110. package/dist/assertion/impl/index.d.ts +0 -21
  111. package/dist/assertion/impl/index.d.ts.map +0 -1
  112. package/dist/assertion/impl/index.js +0 -21
  113. package/dist/assertion/impl/index.js.map +0 -1
  114. package/dist/assertion/impl/iteration-util.cjs +0 -297
  115. package/dist/assertion/impl/iteration-util.cjs.map +0 -1
  116. package/dist/assertion/impl/iteration-util.d.cts +0 -12
  117. package/dist/assertion/impl/iteration-util.d.cts.map +0 -1
  118. package/dist/assertion/impl/iteration-util.d.ts +0 -12
  119. package/dist/assertion/impl/iteration-util.d.ts.map +0 -1
  120. package/dist/assertion/impl/iteration-util.js +0 -282
  121. package/dist/assertion/impl/iteration-util.js.map +0 -1
  122. package/dist/assertion/impl/snapshot.cjs +0 -276
  123. package/dist/assertion/impl/snapshot.cjs.map +0 -1
  124. package/dist/assertion/impl/snapshot.d.cts +0 -278
  125. package/dist/assertion/impl/snapshot.d.cts.map +0 -1
  126. package/dist/assertion/impl/snapshot.d.ts +0 -278
  127. package/dist/assertion/impl/snapshot.d.ts.map +0 -1
  128. package/dist/assertion/impl/snapshot.js +0 -273
  129. package/dist/assertion/impl/snapshot.js.map +0 -1
  130. package/dist/assertion/impl/sync-basic.cjs +0 -553
  131. package/dist/assertion/impl/sync-basic.cjs.map +0 -1
  132. package/dist/assertion/impl/sync-basic.d.cts +0 -528
  133. package/dist/assertion/impl/sync-basic.d.cts.map +0 -1
  134. package/dist/assertion/impl/sync-basic.d.ts +0 -528
  135. package/dist/assertion/impl/sync-basic.d.ts.map +0 -1
  136. package/dist/assertion/impl/sync-basic.js +0 -550
  137. package/dist/assertion/impl/sync-basic.js.map +0 -1
  138. package/dist/assertion/impl/sync-collection.cjs +0 -856
  139. package/dist/assertion/impl/sync-collection.cjs.map +0 -1
  140. package/dist/assertion/impl/sync-collection.d.cts +0 -607
  141. package/dist/assertion/impl/sync-collection.d.cts.map +0 -1
  142. package/dist/assertion/impl/sync-collection.d.ts +0 -607
  143. package/dist/assertion/impl/sync-collection.d.ts.map +0 -1
  144. package/dist/assertion/impl/sync-collection.js +0 -850
  145. package/dist/assertion/impl/sync-collection.js.map +0 -1
  146. package/dist/assertion/impl/sync-date.cjs +0 -341
  147. package/dist/assertion/impl/sync-date.cjs.map +0 -1
  148. package/dist/assertion/impl/sync-date.d.cts +0 -209
  149. package/dist/assertion/impl/sync-date.d.cts.map +0 -1
  150. package/dist/assertion/impl/sync-date.d.ts +0 -209
  151. package/dist/assertion/impl/sync-date.d.ts.map +0 -1
  152. package/dist/assertion/impl/sync-date.js +0 -338
  153. package/dist/assertion/impl/sync-date.js.map +0 -1
  154. package/dist/assertion/impl/sync-esoteric.cjs +0 -214
  155. package/dist/assertion/impl/sync-esoteric.cjs.map +0 -1
  156. package/dist/assertion/impl/sync-esoteric.d.cts +0 -191
  157. package/dist/assertion/impl/sync-esoteric.d.cts.map +0 -1
  158. package/dist/assertion/impl/sync-esoteric.d.ts +0 -191
  159. package/dist/assertion/impl/sync-esoteric.d.ts.map +0 -1
  160. package/dist/assertion/impl/sync-esoteric.js +0 -211
  161. package/dist/assertion/impl/sync-esoteric.js.map +0 -1
  162. package/dist/assertion/impl/sync-iterable.cjs +0 -512
  163. package/dist/assertion/impl/sync-iterable.cjs.map +0 -1
  164. package/dist/assertion/impl/sync-iterable.d.cts +0 -334
  165. package/dist/assertion/impl/sync-iterable.d.cts.map +0 -1
  166. package/dist/assertion/impl/sync-iterable.d.ts +0 -334
  167. package/dist/assertion/impl/sync-iterable.d.ts.map +0 -1
  168. package/dist/assertion/impl/sync-iterable.js +0 -509
  169. package/dist/assertion/impl/sync-iterable.js.map +0 -1
  170. package/dist/assertion/impl/sync-parametric.cjs +0 -812
  171. package/dist/assertion/impl/sync-parametric.cjs.map +0 -1
  172. package/dist/assertion/impl/sync-parametric.d.cts +0 -560
  173. package/dist/assertion/impl/sync-parametric.d.cts.map +0 -1
  174. package/dist/assertion/impl/sync-parametric.d.ts +0 -560
  175. package/dist/assertion/impl/sync-parametric.d.ts.map +0 -1
  176. package/dist/assertion/impl/sync-parametric.js +0 -809
  177. package/dist/assertion/impl/sync-parametric.js.map +0 -1
  178. package/dist/assertion/impl/sync.cjs +0 -214
  179. package/dist/assertion/impl/sync.cjs.map +0 -1
  180. package/dist/assertion/impl/sync.d.cts +0 -512
  181. package/dist/assertion/impl/sync.d.cts.map +0 -1
  182. package/dist/assertion/impl/sync.d.ts +0 -512
  183. package/dist/assertion/impl/sync.d.ts.map +0 -1
  184. package/dist/assertion/impl/sync.js +0 -197
  185. package/dist/assertion/impl/sync.js.map +0 -1
  186. package/dist/assertion/index.cjs +0 -38
  187. package/dist/assertion/index.cjs.map +0 -1
  188. package/dist/assertion/index.d.cts +0 -18
  189. package/dist/assertion/index.d.cts.map +0 -1
  190. package/dist/assertion/index.d.ts +0 -18
  191. package/dist/assertion/index.d.ts.map +0 -1
  192. package/dist/assertion/index.js +0 -17
  193. package/dist/assertion/index.js.map +0 -1
  194. package/dist/assertion/slotify.cjs +0 -165
  195. package/dist/assertion/slotify.cjs.map +0 -1
  196. package/dist/assertion/slotify.d.cts +0 -11
  197. package/dist/assertion/slotify.d.cts.map +0 -1
  198. package/dist/assertion/slotify.d.ts +0 -11
  199. package/dist/assertion/slotify.d.ts.map +0 -1
  200. package/dist/assertion/slotify.js +0 -161
  201. package/dist/assertion/slotify.js.map +0 -1
  202. package/dist/bootstrap.cjs +0 -43
  203. package/dist/bootstrap.cjs.map +0 -1
  204. package/dist/bootstrap.d.cts +0 -27
  205. package/dist/bootstrap.d.cts.map +0 -1
  206. package/dist/bootstrap.d.ts +0 -27
  207. package/dist/bootstrap.d.ts.map +0 -1
  208. package/dist/bootstrap.js +0 -40
  209. package/dist/bootstrap.js.map +0 -1
  210. package/dist/constant.cjs +0 -82
  211. package/dist/constant.cjs.map +0 -1
  212. package/dist/constant.d.cts +0 -69
  213. package/dist/constant.d.cts.map +0 -1
  214. package/dist/constant.d.ts +0 -69
  215. package/dist/constant.d.ts.map +0 -1
  216. package/dist/constant.js +0 -79
  217. package/dist/constant.js.map +0 -1
  218. package/dist/diff.cjs +0 -340
  219. package/dist/diff.cjs.map +0 -1
  220. package/dist/diff.d.cts +0 -51
  221. package/dist/diff.d.cts.map +0 -1
  222. package/dist/diff.d.ts +0 -51
  223. package/dist/diff.d.ts.map +0 -1
  224. package/dist/diff.js +0 -334
  225. package/dist/diff.js.map +0 -1
  226. package/dist/error.cjs +0 -204
  227. package/dist/error.cjs.map +0 -1
  228. package/dist/error.d.cts +0 -212
  229. package/dist/error.d.cts.map +0 -1
  230. package/dist/error.d.ts +0 -212
  231. package/dist/error.d.ts.map +0 -1
  232. package/dist/error.js +0 -191
  233. package/dist/error.js.map +0 -1
  234. package/dist/expect.cjs +0 -590
  235. package/dist/expect.cjs.map +0 -1
  236. package/dist/expect.d.cts +0 -138
  237. package/dist/expect.d.cts.map +0 -1
  238. package/dist/expect.d.ts +0 -138
  239. package/dist/expect.d.ts.map +0 -1
  240. package/dist/expect.js +0 -582
  241. package/dist/expect.js.map +0 -1
  242. package/dist/guards.cjs +0 -297
  243. package/dist/guards.cjs.map +0 -1
  244. package/dist/guards.d.cts +0 -231
  245. package/dist/guards.d.cts.map +0 -1
  246. package/dist/guards.d.ts +0 -231
  247. package/dist/guards.d.ts.map +0 -1
  248. package/dist/guards.js +0 -277
  249. package/dist/guards.js.map +0 -1
  250. package/dist/index.cjs +0 -111
  251. package/dist/index.cjs.map +0 -1
  252. package/dist/index.d.cts +0 -448
  253. package/dist/index.d.cts.map +0 -1
  254. package/dist/index.d.ts +0 -448
  255. package/dist/index.d.ts.map +0 -1
  256. package/dist/index.js +0 -71
  257. package/dist/index.js.map +0 -1
  258. package/dist/internal-schema.cjs +0 -253
  259. package/dist/internal-schema.cjs.map +0 -1
  260. package/dist/internal-schema.d.cts +0 -8
  261. package/dist/internal-schema.d.cts.map +0 -1
  262. package/dist/internal-schema.d.ts +0 -8
  263. package/dist/internal-schema.d.ts.map +0 -1
  264. package/dist/internal-schema.js +0 -248
  265. package/dist/internal-schema.js.map +0 -1
  266. package/dist/metadata.cjs +0 -57
  267. package/dist/metadata.cjs.map +0 -1
  268. package/dist/metadata.d.cts +0 -27
  269. package/dist/metadata.d.cts.map +0 -1
  270. package/dist/metadata.d.ts +0 -27
  271. package/dist/metadata.d.ts.map +0 -1
  272. package/dist/metadata.js +0 -54
  273. package/dist/metadata.js.map +0 -1
  274. package/dist/schema.cjs +0 -1522
  275. package/dist/schema.cjs.map +0 -1
  276. package/dist/schema.d.cts +0 -1196
  277. package/dist/schema.d.cts.map +0 -1
  278. package/dist/schema.d.ts +0 -1196
  279. package/dist/schema.d.ts.map +0 -1
  280. package/dist/schema.js +0 -1516
  281. package/dist/schema.js.map +0 -1
  282. package/dist/snapshot/adapter.cjs +0 -31
  283. package/dist/snapshot/adapter.cjs.map +0 -1
  284. package/dist/snapshot/adapter.d.cts +0 -258
  285. package/dist/snapshot/adapter.d.cts.map +0 -1
  286. package/dist/snapshot/adapter.d.ts +0 -258
  287. package/dist/snapshot/adapter.d.ts.map +0 -1
  288. package/dist/snapshot/adapter.js +0 -27
  289. package/dist/snapshot/adapter.js.map +0 -1
  290. package/dist/snapshot/adapters/fallback.cjs +0 -453
  291. package/dist/snapshot/adapters/fallback.cjs.map +0 -1
  292. package/dist/snapshot/adapters/fallback.d.cts +0 -185
  293. package/dist/snapshot/adapters/fallback.d.cts.map +0 -1
  294. package/dist/snapshot/adapters/fallback.d.ts +0 -185
  295. package/dist/snapshot/adapters/fallback.d.ts.map +0 -1
  296. package/dist/snapshot/adapters/fallback.js +0 -446
  297. package/dist/snapshot/adapters/fallback.js.map +0 -1
  298. package/dist/snapshot/adapters/node-test.cjs +0 -301
  299. package/dist/snapshot/adapters/node-test.cjs.map +0 -1
  300. package/dist/snapshot/adapters/node-test.d.cts +0 -131
  301. package/dist/snapshot/adapters/node-test.d.cts.map +0 -1
  302. package/dist/snapshot/adapters/node-test.d.ts +0 -131
  303. package/dist/snapshot/adapters/node-test.d.ts.map +0 -1
  304. package/dist/snapshot/adapters/node-test.js +0 -297
  305. package/dist/snapshot/adapters/node-test.js.map +0 -1
  306. package/dist/snapshot/index.cjs +0 -61
  307. package/dist/snapshot/index.cjs.map +0 -1
  308. package/dist/snapshot/index.d.cts +0 -40
  309. package/dist/snapshot/index.d.cts.map +0 -1
  310. package/dist/snapshot/index.d.ts +0 -40
  311. package/dist/snapshot/index.d.ts.map +0 -1
  312. package/dist/snapshot/index.js +0 -44
  313. package/dist/snapshot/index.js.map +0 -1
  314. package/dist/snapshot/node-version.cjs +0 -49
  315. package/dist/snapshot/node-version.cjs.map +0 -1
  316. package/dist/snapshot/node-version.d.cts +0 -34
  317. package/dist/snapshot/node-version.d.cts.map +0 -1
  318. package/dist/snapshot/node-version.d.ts +0 -34
  319. package/dist/snapshot/node-version.d.ts.map +0 -1
  320. package/dist/snapshot/node-version.js +0 -44
  321. package/dist/snapshot/node-version.js.map +0 -1
  322. package/dist/snapshot/select-adapter.cjs +0 -170
  323. package/dist/snapshot/select-adapter.cjs.map +0 -1
  324. package/dist/snapshot/select-adapter.d.cts +0 -128
  325. package/dist/snapshot/select-adapter.d.cts.map +0 -1
  326. package/dist/snapshot/select-adapter.d.ts +0 -128
  327. package/dist/snapshot/select-adapter.d.ts.map +0 -1
  328. package/dist/snapshot/select-adapter.js +0 -164
  329. package/dist/snapshot/select-adapter.js.map +0 -1
  330. package/dist/snapshot/serializer.cjs +0 -246
  331. package/dist/snapshot/serializer.cjs.map +0 -1
  332. package/dist/snapshot/serializer.d.cts +0 -126
  333. package/dist/snapshot/serializer.d.cts.map +0 -1
  334. package/dist/snapshot/serializer.d.ts +0 -126
  335. package/dist/snapshot/serializer.d.ts.map +0 -1
  336. package/dist/snapshot/serializer.js +0 -238
  337. package/dist/snapshot/serializer.js.map +0 -1
  338. package/dist/standard-schema.cjs +0 -13
  339. package/dist/standard-schema.cjs.map +0 -1
  340. package/dist/standard-schema.d.cts +0 -192
  341. package/dist/standard-schema.d.cts.map +0 -1
  342. package/dist/standard-schema.d.ts +0 -192
  343. package/dist/standard-schema.d.ts.map +0 -1
  344. package/dist/standard-schema.js +0 -12
  345. package/dist/standard-schema.js.map +0 -1
  346. package/dist/types.cjs +0 -22
  347. package/dist/types.cjs.map +0 -1
  348. package/dist/types.d.cts +0 -905
  349. package/dist/types.d.cts.map +0 -1
  350. package/dist/types.d.ts +0 -905
  351. package/dist/types.d.ts.map +0 -1
  352. package/dist/types.js +0 -21
  353. package/dist/types.js.map +0 -1
  354. package/dist/use.cjs +0 -240
  355. package/dist/use.cjs.map +0 -1
  356. package/dist/use.d.cts +0 -8
  357. package/dist/use.d.cts.map +0 -1
  358. package/dist/use.d.ts +0 -8
  359. package/dist/use.d.ts.map +0 -1
  360. package/dist/use.js +0 -236
  361. package/dist/use.js.map +0 -1
  362. package/dist/util.cjs +0 -255
  363. package/dist/util.cjs.map +0 -1
  364. package/dist/util.d.cts +0 -141
  365. package/dist/util.d.cts.map +0 -1
  366. package/dist/util.d.ts +0 -141
  367. package/dist/util.d.ts.map +0 -1
  368. package/dist/util.js +0 -234
  369. package/dist/util.js.map +0 -1
  370. package/dist/value-to-schema.cjs +0 -537
  371. package/dist/value-to-schema.cjs.map +0 -1
  372. package/dist/value-to-schema.d.cts +0 -144
  373. package/dist/value-to-schema.d.cts.map +0 -1
  374. package/dist/value-to-schema.d.ts +0 -144
  375. package/dist/value-to-schema.d.ts.map +0 -1
  376. package/dist/value-to-schema.js +0 -533
  377. package/dist/value-to-schema.js.map +0 -1
package/dist/schema.d.ts DELETED
@@ -1,1196 +0,0 @@
1
- /**
2
- * Arguably-useful Zod schemas for common types and validation patterns.
3
- *
4
- * This module provides reusable Zod schemas for validating constructors,
5
- * functions, property keys, promises, and other common JavaScript types used
6
- * throughout the assertion system. These tend to work around the impedance
7
- * mismatch between **BUPKIS** and Zod.
8
- *
9
- * These are used internally, but consumers may also find them useful.
10
- *
11
- * For example, we have {@link FunctionSchema} which accepts any
12
- * function—regardless of its signature. We need this because Zod v4's
13
- * `z.function()` no longer returns a `ZodType` (ref:
14
- * {@link https://zod.dev/v4/changelog | Zod v4 Migration Guide}) and so behaves
15
- * differently. `FunctionSchema` allows us to work with functions as _values_
16
- * instead of something to be implemented.
17
- *
18
- * Similarly—but not a new development—`z.promise()` does not parse a
19
- * {@link Promise} object; it parses the _fulfilled value_. This is not what we
20
- * want for "is a Promise" assertions, but it _can_ be useful for making sense
21
- * of the fulfilled value. To solve this, we have
22
- * {@link WrappedPromiseLikeSchema} (which explicitly supports
23
- * {@link PromiseLike}/"thenable" objects).
24
- *
25
- * @module schema
26
- * @category API
27
- * @example
28
- *
29
- * ```ts
30
- * import * as schema from 'bupkis/schema';
31
- * ```
32
- *
33
- * @groupDescription Schema
34
- * Schemas for common types and validation patterns.
35
- */
36
- import { z } from 'zod';
37
- import { type Constructor, type Keypath, type MutableOrReadonly } from "./types.js";
38
- /**
39
- * A Zod schema that validates JavaScript constructible functions.
40
- *
41
- * This schema validates values that can be used as constructors, including ES6
42
- * classes, traditional constructor functions, and built-in constructors. It
43
- * uses the {@link isConstructible} guard function to determine if a value can be
44
- * invoked with the `new` operator to create object instances.
45
- *
46
- * @privateRemarks
47
- * The schema is registered in the {@link BupkisRegistry} with the name
48
- * `ConstructibleSchema` for later reference and type checking purposes.
49
- * @example Direct Usage
50
- *
51
- * ```typescript
52
- * class MyClass {}
53
- * function MyConstructor() {}
54
- *
55
- * ConstructibleSchema.parse(MyClass); // ✓ Valid
56
- * ConstructibleSchema.parse(MyConstructor); // ✓ Valid
57
- * ConstructibleSchema.parse(Array); // ✓ Valid
58
- * ConstructibleSchema.parse(Date); // ✓ Valid
59
- * ConstructibleSchema.parse(() => {}); // ✗ Throws validation error
60
- * ConstructibleSchema.parse({}); // ✗ Throws validation error
61
- * ```
62
- *
63
- * @example Assertion Creation
64
- *
65
- * ```ts
66
- * import { createAssertion, use } from 'bupkis';
67
- * import { ConstructibleSchema } from 'bupkis/schema';
68
- *
69
- * const classAssertion = createAssertion(
70
- * [ConstructibleSchema, 'to be a subclass of Error'],
71
- * ConstructibleSchema.refine(
72
- * (subject) => subject.prototype instanceof Error,
73
- * ),
74
- * );
75
- *
76
- * const { expect } = use([classAssertion]);
77
- * expect(class MyError extends Error {}, 'to be a subclass of Error');
78
- * ```
79
- *
80
- * @group Schema
81
- */
82
- export declare const ConstructibleSchema: z.ZodCustom<Constructor, Constructor>;
83
- /**
84
- * A Zod schema that validates any JavaScript function.
85
- *
86
- * This schema accepts a function having any signature and avoids Zod's parsing
87
- * overhead.
88
- *
89
- * @remarks
90
- * Zod v~4.0.0 changed how {@link z.function z.function()} worked, which made it
91
- * unsuitable for validation. This was reverted in Zod v4.1.0.
92
- * @privateRemarks
93
- * The schema is registered in the {@link BupkisRegistry} with the name
94
- * `FunctionSchema` for later reference and type checking purposes.
95
- * @example Direct Usage
96
- *
97
- * ```typescript
98
- * FunctionSchema.parse(function () {}); // ✓ Valid
99
- * FunctionSchema.parse(() => {}); // ✓ Valid
100
- * FunctionSchema.parse(async () => {}); // ✓ Valid
101
- * FunctionSchema.parse(function* () {}); // ✓ Valid
102
- * FunctionSchema.parse(Math.max); // ✓ Valid
103
- * FunctionSchema.parse('not a function'); // ✗ Throws validation error
104
- * FunctionSchema.parse({}); // ✗ Throws validation error
105
- * ```
106
- *
107
- * @example Assertion Creation
108
- *
109
- * ```ts
110
- * import { createAssertion, use } from 'bupkis';
111
- * import { FunctionSchema } from 'bupkis/schema';
112
- *
113
- * const fnAssertion = createAssertion(
114
- * [FunctionSchema, 'to be a function with arity 2'],
115
- * FunctionSchema.refine((subject) => subject.length === 2),
116
- * );
117
- * const { expect } = use([fnAssertion]);
118
- * function add(a: number, b: number) {
119
- * return a + b;
120
- * }
121
- * expect(add, 'to be a function with arity 2');
122
- * ```
123
- *
124
- * @group Schema
125
- */
126
- export declare const FunctionSchema: z.ZodCustom<(...args: MutableOrReadonly<unknown[]>) => unknown, (...args: MutableOrReadonly<unknown[]>) => unknown>;
127
- /**
128
- * A Zod schema that validates non-collection objects and functions.
129
- *
130
- * Accepts plain objects, functions, arrays, dates, etc. but rejects collection
131
- * types like `Map`, `Set`, `WeakMap`, and `WeakSet`.
132
- *
133
- * @example Direct Usage
134
- *
135
- * ```typescript
136
- * NonCollectionObjectSchema.parse({}); // ✓ Valid
137
- * NonCollectionObjectSchema.parse({ key: 'value' }); // ✓ Valid
138
- * NonCollectionObjectSchema.parse(function () {}); // ✓ Valid
139
- * NonCollectionObjectSchema.parse(() => {}); // ✓ Valid
140
- * NonCollectionObjectSchema.parse(new Map()); // ✗ Throws validation error
141
- * NonCollectionObjectSchema.parse(new Set()); // ✗ Throws validation error
142
- * NonCollectionObjectSchema.parse(null); // ✗ Throws validation error
143
- * NonCollectionObjectSchema.parse(42); // ✗ Throws validation error
144
- * ```
145
- *
146
- * @example Assertion Creation
147
- *
148
- * ```ts
149
- * import { createAssertion, use } from 'bupkis';
150
- * import { NonCollectionObjectSchema } from 'bupkis/schema';
151
- *
152
- * const nonCollectionAssertion = createAssertion(
153
- * [NonCollectionObjectSchema, 'to be a non-collection object'],
154
- * NonCollectionObjectSchema,
155
- * );
156
- * const { expect } = use([nonCollectionAssertion]);
157
- * expect({ key: 'value' }, 'to be a non-collection object');
158
- * ```
159
- *
160
- * @group Schema
161
- */
162
- export declare const NonCollectionObjectSchema: z.ZodCustom<Record<PropertyKey, unknown> | ((...args: any[]) => any), Record<PropertyKey, unknown> | ((...args: any[]) => any)>;
163
- /**
164
- * A Zod schema that validates JavaScript property keys.
165
- *
166
- * This schema validates values that can be used as object property keys in
167
- * JavaScript, which includes strings, numbers, and symbols. These are the three
168
- * types that JavaScript automatically converts to property keys when used in
169
- * object access or assignment operations.
170
- *
171
- * @privateRemarks
172
- * The schema is registered in the `BupkisRegistry` with the name
173
- * `PropertyKeySchema` for later reference and type checking purposes.
174
- * @example Direct Usage
175
- *
176
- * ```typescript
177
- * PropertyKeySchema.parse('stringKey'); // ✓ Valid
178
- * PropertyKeySchema.parse(42); // ✓ Valid
179
- * PropertyKeySchema.parse(Symbol('symbolKey')); // ✓ Valid
180
- * PropertyKeySchema.parse({}); // ✗ Throws validation error
181
- * PropertyKeySchema.parse(null); // ✗ Throws validation error
182
- * ```
183
- *
184
- * @example Assertion Creation
185
- *
186
- * ```ts
187
- * import { createAssertion, use } from 'bupkis';
188
- * import { PropertyKeySchema } from 'bupkis/schema';
189
- * const unknownRecordAssertion = createAssertion(
190
- * ['to be a record of anything'],
191
- * z.record(PropertyKeySchema, z.unknown()),
192
- * );
193
- *
194
- * const { expect } = use([unknownRecordAssertion]);
195
- * expect(
196
- * { 42: pants, shirts: 'foo', [Symbol('baz')]: null },
197
- * 'to be a record of anything',
198
- * );
199
- * ```
200
- *
201
- * @group Schema
202
- */
203
- export declare const PropertyKeySchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodSymbol]>;
204
- /**
205
- * A Zod schema that validates a keypath, which is a string featuring dot
206
- * notation or bracket notation, used to access nested object properties.
207
- *
208
- * Bare numbers must be wrapped in a string.
209
- *
210
- * @example Direct Usage
211
- *
212
- * ```typescript
213
- * KeypathSchema.parse('foo.bar'); // ✓ Valid
214
- * KeypathSchema.parse('arr[0].item'); // ✓ Valid
215
- * KeypathSchema.parse('obj["key"].prop'); // ✓ Valid
216
- * KeypathSchema.parse("obj['key'].prop"); // ✓ Valid
217
- * KeypathSchema.parse('simpleKey'); // ✓ Valid
218
- * KeypathSchema.parse('42'); // ✓ Valid
219
- * KeypathSchema.parse('invalid keypath!'); // ✗ Throws validation error
220
- * KeypathSchema.parse('foo..bar'); // ✗ Throws validation error
221
- * KeypathSchema.parse('foo[bar]'); // ✗ Throws validation error
222
- * KeypathSchema.parse(42); // ✗ Throws validation error
223
- * ```
224
- *
225
- * @example Assertion Creation
226
- *
227
- * ```ts
228
- * import { createAssertion, use } from 'bupkis';
229
- * import { KeypathSchema } from 'bupkis/schema';
230
- *
231
- * const hasKeypathAssertion = createAssertion(
232
- * [KeypathSchema, 'to be a keypath'],
233
- * KeypathSchema,
234
- * );
235
- *
236
- * const { expect } = use([hasKeypathAssertion]);
237
- * expect('foo.bar[0]["baz"]', 'to be a keypath');
238
- * ```
239
- *
240
- * @group Schema
241
- */
242
- export declare const KeypathSchema: z.ZodType<Keypath>;
243
- /**
244
- * A Zod schema that validates "thenable" objects with a `.then()` method.
245
- *
246
- * This schema validates objects that implement the PromiseLike interface by
247
- * having a `.then()` method, which includes Promises and other thenable
248
- * objects.
249
- *
250
- * Unlike Zod's built-in `z.promise()`, this schema does not unwrap the resolved
251
- * value, meaning the result of parsing remains a Promise or thenable object.
252
- *
253
- * @privateRemarks
254
- * The schema is registered in the `BupkisRegistry` with the name
255
- * `WrappedPromiseLikeSchema` for later reference and type checking purposes.
256
- * This is useful when you need to validate that something is thenable without
257
- * automatically resolving it.
258
- * @example Direct Usage
259
- *
260
- * ```typescript
261
- * WrappedPromiseLikeSchema.parse(Promise.resolve(42)); // ✓ Valid (returns Promise)
262
- * WrappedPromiseLikeSchema.parse({ then: () => {} }); // ✓ Valid (thenable)
263
- * WrappedPromiseLikeSchema.parse(42); // ✗ Throws validation error
264
- * WrappedPromiseLikeSchema.parse({}); // ✗ Throws validation error
265
- * ```
266
- *
267
- * @example Assertion Creation
268
- *
269
- * ```ts
270
- * import { createAssertion, use } from 'bupkis';
271
- * import { WrappedPromiseLikeSchema } from 'bupkis/schema';
272
- *
273
- * const thenableAssertion = createAssertion(
274
- * [WrappedPromiseLikeSchema, 'to be a thenable'],
275
- * WrappedPromiseLikeSchema,
276
- * );
277
- *
278
- * const { expect } = use([thenableAssertion]);
279
- * // does nothing with 'pants'; await it elsewhere
280
- * expect({ then: () => Promise.resolve('pants') }, 'to be a thenable');
281
- * ```
282
- *
283
- * @group Schema
284
- */
285
- export declare const WrappedPromiseLikeSchema: z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>;
286
- /**
287
- * A Zod schema that validates plain objects with null prototypes.
288
- *
289
- * > Aliases: {@link NullProtoObjectSchema}, {@link DictionarySchema}
290
- *
291
- * This schema validates objects that have been created with
292
- * `Object.create(null)` or otherwise have their prototype set to `null`. Such
293
- * objects are "plain" objects without any inherited properties or methods from
294
- * `Object.prototype`, making them useful as pure data containers or
295
- * dictionaries.
296
- *
297
- * @privateRemarks
298
- * The schema is registered in the `BupkisRegistry` with the name
299
- * `ObjectWithNullPrototype` for later reference and type checking purposes.
300
- *
301
- * Changing this to be a `ZodRecord` would be nice, but that would end up
302
- * blasting away the original object's prototype.
303
- * @example Direct Usage
304
- *
305
- * ```typescript
306
- * const nullProtoObj = Object.create(null);
307
- * nullProtoObj.key = 'value';
308
- * NullProtoObjectSchema.parse(nullProtoObj); // ✓ Valid
309
- *
310
- * const regularObj = { key: 'value' };
311
- * NullProtoObjectSchema.parse(regularObj); // ✗ Throws validation error
312
- *
313
- * const emptyObj = {};
314
- * NullProtoObjectSchema.parse(emptyObj); // ✗ Throws validation error
315
- * ```
316
- *
317
- * @example Assertion Creation
318
- *
319
- * ```ts
320
- * import { createAssertion, use } from 'bupkis';
321
- * import { DictionarySchema } from 'bupkis/schema';
322
- *
323
- * const dictAssertion = createAssertion(
324
- * [DictionarySchema, 'to be a dictionary of numbers'],
325
- * DictionarySchema.pipe(z.record(z.number())),
326
- * );
327
- *
328
- * const { expect } = use([dictAssertion]);
329
- *
330
- * expect(Object.create(null, { pants: { value: 42, enumerable: true } }),
331
- * ```
332
- *
333
- * @group Schema
334
- */
335
- export declare const DictionarySchema: z.ZodCustom<Record<PropertyKey, unknown>, Record<PropertyKey, unknown>>;
336
- /**
337
- * {@inheritDoc DictionarySchema}
338
- *
339
- * @group Schema
340
- */
341
- export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unknown>, Record<PropertyKey, unknown>>;
342
- /**
343
- * A Zod schema that validates functions declared with the `async` keyword.
344
- *
345
- * This schema validates functions that are explicitly declared as asynchronous
346
- * using the `async` keyword. It uses runtime introspection to check the
347
- * function's internal `[[ToString]]` representation to distinguish async
348
- * functions from regular functions that might return Promises.
349
- *
350
- * @remarks
351
- * **This schema _cannot_ match a function that returns a {@link Promise} but was
352
- * not declared via `async`.** Determining if a function returns a `Promise` is
353
- * only possible by execution of said function (which <span
354
- * class="bupkis">BUPKIS</span> avoids, naturally). This is a limitation of
355
- * JavaScript itself.
356
- * @example Direct Usage
357
- *
358
- * ```typescript
359
- * async function asyncFn() {
360
- * return 42;
361
- * }
362
- * AsyncFunctionSchema.parse(asyncFn); // ✓ Valid
363
- *
364
- * const asyncArrow = async () => 42;
365
- * AsyncFunctionSchema.parse(asyncArrow); // ✓ Valid
366
- *
367
- * function syncFn() {
368
- * return Promise.resolve(42);
369
- * }
370
- * AsyncFunctionSchema.parse(syncFn); // ✗ Throws validation error
371
- *
372
- * const regularFn = () => 42;
373
- * AsyncFunctionSchema.parse(regularFn); // ✗ Throws validation error
374
- * ```
375
- *
376
- * @example Assertion Creation
377
- *
378
- * ```ts
379
- * import { createAssertion, use } from 'bupkis';
380
- * import { AsyncFunctionSchema } from 'bupkis/schema';
381
- *
382
- * const asyncFnAssertion = createAssertion(
383
- * [AsyncFunctionSchema, 'to be an async function'],
384
- * AsyncFunctionSchema,
385
- * );
386
- *
387
- * const { expect } = use([asyncFnAssertion]);
388
- * expect(async () => {}, 'to be an async function');
389
- * ```
390
- *
391
- * @group Schema
392
- */
393
- export declare const AsyncFunctionSchema: z.ZodCustom<(...args: MutableOrReadonly<unknown[]>) => unknown, (...args: MutableOrReadonly<unknown[]>) => unknown>;
394
- /**
395
- * A Zod schema that validates truthy JavaScript values.
396
- *
397
- * This schema accepts any input value but only validates successfully if the
398
- * value is truthy according to JavaScript's truthiness rules. A value is truthy
399
- * if it converts to `true` when evaluated in a boolean context - essentially
400
- * any value that is not one of the eight falsy values.
401
- *
402
- * @privateRemarks
403
- * The schema is registered in the `BupkisRegistry` with the name `Truthy` and
404
- * indicates that it accepts anything as valid input for evaluation.
405
- * @example Direct Usage
406
- *
407
- * ```typescript
408
- * TruthySchema.parse(true); // ✓ Valid
409
- * TruthySchema.parse(1); // ✓ Valid
410
- * TruthySchema.parse('hello'); // ✓ Valid
411
- * TruthySchema.parse([]); // ✓ Valid (arrays are truthy)
412
- * TruthySchema.parse({}); // ✓ Valid (objects are truthy)
413
- * TruthySchema.parse(false); // ✗ Throws validation error
414
- * TruthySchema.parse(0); // ✗ Throws validation error
415
- * TruthySchema.parse(''); // ✗ Throws validation error
416
- * TruthySchema.parse(null); // ✗ Throws validation error
417
- * ```
418
- *
419
- * @example Assertion Creation
420
- *
421
- * ```ts
422
- * import { createAssertion, use } from 'bupkis';
423
- * import { TruthySchema } from 'bupkis/schema';
424
- *
425
- * const somethingAssertion = createAssertion(
426
- * ['to be something'],
427
- * TruthySchema,
428
- * );
429
- *
430
- * const { expect } = use([somethingAssertion]);
431
- *
432
- * expect('pants', 'to be something');
433
- * ```
434
- *
435
- * @group Schema
436
- * @see {@link FalsySchema}
437
- */
438
- export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
439
- /**
440
- * A Zod schema that validates falsy JavaScript values.
441
- *
442
- * This schema accepts any input value but only validates successfully if the
443
- * value is falsy according to JavaScript's truthiness rules. The falsy values
444
- * in JavaScript are: `false`, `0`, `-0`, `0n`, `""` (empty string), `null`,
445
- * `undefined`, and `NaN`.
446
- *
447
- * @privateRemarks
448
- * The schema is registered in the `BupkisRegistry` with the name `Falsy` and
449
- * indicates that it accepts anything as valid input for evaluation.
450
- * @example Direct Usage
451
- *
452
- * ```typescript
453
- * FalsySchema.parse(false); // ✓ Valid
454
- * FalsySchema.parse(0); // ✓ Valid
455
- * FalsySchema.parse(-0); // ✓ Valid
456
- * FalsySchema.parse(0n); // ✓ Valid (BigInt zero)
457
- * FalsySchema.parse(''); // ✓ Valid (empty string)
458
- * FalsySchema.parse(null); // ✓ Valid
459
- * FalsySchema.parse(undefined); // ✓ Valid
460
- * FalsySchema.parse(NaN); // ✓ Valid
461
- * FalsySchema.parse(true); // ✗ Throws validation error
462
- * FalsySchema.parse(1); // ✗ Throws validation error
463
- * FalsySchema.parse('hello'); // ✗ Throws validation error
464
- * FalsySchema.parse({}); // ✗ Throws validation error
465
- * ```
466
- *
467
- * @example Assertion Creation
468
- *
469
- * ```ts
470
- * import { createAssertion, use } from 'bupkis';
471
- * import { FalsySchema } from 'bupkis/schema';
472
- *
473
- * const falsyAssertion = createAssertion(['to be nothing'], FalsySchema);
474
- *
475
- * const { expect } = use([falsyAssertion]);
476
- *
477
- * expect('', 'to be nothing');
478
- * ```
479
- *
480
- * @group Schema
481
- * @see {@link TruthySchema}
482
- */
483
- export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
484
- /**
485
- * A Zod schema that validates primitive JavaScript values.
486
- *
487
- * This schema validates any of the seven primitive data types in JavaScript:
488
- * string, number, boolean, bigint, symbol, null, and undefined. Primitive
489
- * values are immutable and are passed by value rather than by reference,
490
- * distinguishing them from objects and functions which are non-primitive
491
- * reference types.
492
- *
493
- * @privateRemarks
494
- * The schema is registered in the `BupkisRegistry` with the name `Primitive`
495
- * and indicates that it accepts primitive values as valid input.
496
- * @example Direct Usage
497
- *
498
- * ```typescript
499
- * PrimitiveSchema.parse('hello'); // ✓ Valid (string)
500
- * PrimitiveSchema.parse(42); // ✓ Valid (number)
501
- * PrimitiveSchema.parse(true); // ✓ Valid (boolean)
502
- * PrimitiveSchema.parse(BigInt(123)); // ✓ Valid (bigint)
503
- * PrimitiveSchema.parse(Symbol('test')); // ✓ Valid (symbol)
504
- * PrimitiveSchema.parse(null); // ✓ Valid (null)
505
- * PrimitiveSchema.parse(undefined); // ✓ Valid (undefined)
506
- * PrimitiveSchema.parse({}); // ✗ Throws validation error (object)
507
- * PrimitiveSchema.parse([]); // ✗ Throws validation error (array)
508
- * PrimitiveSchema.parse(() => {}); // ✗ Throws validation error (function)
509
- * ```
510
- *
511
- * @example Assertion Creation
512
- *
513
- * ```ts
514
- * import { createAssertion, use } from 'bupkis';
515
- * import { PrimitiveSchema } from 'bupkis/schema';
516
- *
517
- * const primitiveAssertion = createAssertion(
518
- * ['to be a primitive, Date, or RegExp'],
519
- * PrimitiveSchema.or(z.instanceof(Date)).or(z.instanceof(RegExp)),
520
- * );
521
- *
522
- * const { expect } = use([primitiveAssertion]);
523
- *
524
- * expect('pants', 'to be a primitive, Date, or RegExp');
525
- * ```
526
- *
527
- * @group Schema
528
- */
529
- export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodBigInt, z.ZodSymbol, z.ZodNull, z.ZodUndefined]>;
530
- /**
531
- * A Zod schema that validates array-like structures including mutable and
532
- * readonly variants.
533
- *
534
- * This schema validates values that behave like arrays, including standard
535
- * arrays, tuples with rest elements, and their readonly counterparts. It
536
- * accepts any array-like structure that can hold elements of any type, making
537
- * it useful for validating collections where the specific array mutability or
538
- * tuple structure is not critical.
539
- *
540
- * @privateRemarks
541
- * The schema is registered in the {@link BupkisRegistry} with the name
542
- * `ArrayLike` for later reference and type checking purposes. This schema is
543
- * particularly useful when you need to accept various forms of array-like data
544
- * without being restrictive about mutability or exact tuple structure.
545
- * @example Direct Usage
546
- *
547
- * ```typescript
548
- * ArrayLikeSchema.parse([1, 2, 3]); // ✓ Valid (mutable array)
549
- * ArrayLikeSchema.parse(['a', 'b'] as const); // ✓ Valid (readonly array)
550
- * ArrayLikeSchema.parse([]); // ✓ Valid (empty array)
551
- * ArrayLikeSchema.parse([42, 'mixed', true]); // ✓ Valid (mixed types)
552
- * ArrayLikeSchema.parse('not an array'); // ✗ Throws validation error
553
- * ArrayLikeSchema.parse({}); // ✗ Throws validation error
554
- * ArrayLikeSchema.parse(null); // ✗ Throws validation error
555
- * ```
556
- *
557
- * @example Assertion Creation
558
- *
559
- * ```ts
560
- * import { createAssertion, use } from 'bupkis';
561
- * import { ArrayLikeSchema } from 'bupkis/schema';
562
- *
563
- * const argsAssertion = createAssertion(
564
- * [ArrayLikeSchema, 'to be a non-array arraylike object'],
565
- * ArrayLikeSchema.refine((subject) => !Array.isArray(subject)),
566
- * );
567
- *
568
- * const { expect } = use([argsAssertion]);
569
- * expect(
570
- * (function () {
571
- * return arguments;
572
- * })(),
573
- * 'to be a non-array arraylike object',
574
- * );
575
- * ```
576
- *
577
- * @group Schema
578
- */
579
- export declare const ArrayLikeSchema: z.ZodCustom<ArrayLike<unknown>, ArrayLike<unknown>>;
580
- /**
581
- * A Zod schema that validates RegExp instances.
582
- *
583
- * This schema validates values that are instances of the RegExp class,
584
- * including regular expressions created with both literal syntax
585
- * (`/pattern/flags`) and the RegExp constructor (`new RegExp(pattern, flags)`).
586
- * It ensures the validated value is a proper regular expression object with all
587
- * associated methods and properties.
588
- *
589
- * @privateRemarks
590
- * The schema is registered in the `BupkisRegistry` with the name `RegExp` for
591
- * later reference and type checking purposes.
592
- * @example Direct Usage
593
- *
594
- * ```typescript
595
- * RegExpSchema.parse(/abc/gi); // ✓ Valid (literal syntax)
596
- * RegExpSchema.parse(new RegExp('abc', 'gi')); // ✓ Valid (constructor)
597
- * RegExpSchema.parse(/test/); // ✓ Valid (no flags)
598
- * RegExpSchema.parse(new RegExp('')); // ✓ Valid (empty pattern)
599
- * RegExpSchema.parse('abc'); // ✗ Throws validation error (string)
600
- * RegExpSchema.parse(/abc/.source); // ✗ Throws validation error (string pattern)
601
- * RegExpSchema.parse({}); // ✗ Throws validation error (object)
602
- * ```
603
- *
604
- * @example Assertion Creation
605
- *
606
- * ```ts
607
- * import { createAssertion, use } from 'bupkis';
608
- * import { RegExpSchema } from 'bupkis/schema';
609
- *
610
- * const globalRegexAssertion = createAssertion(
611
- * [RegExpSchema, 'to be a RegExp with the global flag'],
612
- * RegExpSchema.refine((subject) => subject.flags.includes('g')),
613
- * );
614
- *
615
- * const { expect } = use([globalRegexAssertion]);
616
- *
617
- * expect(/pants/g, 'to be a RegExp with the global flag');
618
- * ```
619
- *
620
- * @group Schema
621
- */
622
- export declare const RegExpSchema: z.ZodCustom<RegExp, RegExp>;
623
- /**
624
- * A Zod schema that validates non-negative integer values.
625
- *
626
- * This schema validates numbers that are both integers (whole numbers without
627
- * decimal parts) and non-negative (greater than or equal to zero). It combines
628
- * Zod's integer validation with non-negative validation to ensure the value is
629
- * a valid count, index, or other non-negative discrete quantity.
630
- *
631
- * @privateRemarks
632
- * The schema is registered in the {@link BupkisRegistry} with the name
633
- * `nonnegative-integer` for later reference and type checking purposes.
634
- * @example Direct Usage
635
- *
636
- * ```typescript
637
- * NonNegativeIntegerSchema.parse(0); // ✓ Valid (zero)
638
- * NonNegativeIntegerSchema.parse(42); // ✓ Valid (positive integer)
639
- * NonNegativeIntegerSchema.parse(1000); // ✓ Valid (large positive integer)
640
- * NonNegativeIntegerSchema.parse(-1); // ✗ Throws validation error (negative)
641
- * NonNegativeIntegerSchema.parse(3.14); // ✗ Throws validation error (not integer)
642
- * NonNegativeIntegerSchema.parse(-3.14); // ✗ Throws validation error (negative and not integer)
643
- * NonNegativeIntegerSchema.parse('42'); // ✗ Throws validation error (string)
644
- * ```
645
- *
646
- * @example Assertion Creation
647
- *
648
- * ```ts
649
- * import { createAssertion, use } from 'bupkis';
650
- * import { NonNegativeIntegerSchema } from 'bupkis/schema';
651
- *
652
- * const arrayIndexAssertion = createAssertion(
653
- * [NonNegativeIntegerSchema, 'to be a valid array index'],
654
- * NonNegativeIntegerSchema,
655
- * );
656
- *
657
- * const { expect } = use([arrayIndexAssertion]);
658
- * expect(0, 'to be a valid array index'); // Valid array index
659
- * expect(5, 'to be a valid array index'); // Valid array index
660
- * ```
661
- *
662
- * @group Schema
663
- */
664
- export declare const NonNegativeIntegerSchema: z.ZodInt;
665
- /**
666
- * A Zod schema that validates numeric timestamps.
667
- *
668
- * This schema validates JavaScript timestamp values (milliseconds since Unix
669
- * epoch) within the valid range for JavaScript Date objects. It ensures the
670
- * timestamp is an integer between -8,640,000,000,000,000 and
671
- * 8,640,000,000,000,000 milliseconds, which corresponds to the range of dates
672
- * that can be represented by JavaScript's Date object (approximately April 20,
673
- * 271821 BCE to September 13, 275760 CE).
674
- *
675
- * @example
676
- *
677
- * ```typescript
678
- * TimestampFormatSchema.parse(Date.now()); // ✓ Valid current timestamp
679
- * TimestampFormatSchema.parse(0); // ✓ Valid Unix epoch
680
- * TimestampFormatSchema.parse(-62135596800000); // ✓ Valid timestamp (year 1 CE)
681
- * TimestampFormatSchema.parse(1.5); // ✗ Throws - not an integer
682
- * TimestampFormatSchema.parse(9e15); // ✗ Throws - exceeds maximum timestamp
683
- * TimestampFormatSchema.parse('1234567890000'); // ✗ Throws - string not number
684
- * ```
685
- *
686
- * @group Schema
687
- */
688
- export declare const TimestampFormatSchema: z.ZodInt;
689
- /**
690
- * A Zod schema that validates ISO date strings.
691
- *
692
- * This schema validates ISO 8601 date and datetime strings in various formats.
693
- * It accepts both date-only formats (YYYY-MM-DD) and full datetime formats with
694
- * optional timezone information. The schema supports local datetime strings and
695
- * those with timezone offsets.
696
- *
697
- * @example
698
- *
699
- * ```typescript
700
- * ISODateFormatSchema.parse('2025-01-01'); // ✓ Valid ISO date
701
- * ISODateFormatSchema.parse('2025-01-01T10:30:00'); // ✓ Valid local datetime
702
- * ISODateFormatSchema.parse('2025-01-01T10:30:00Z'); // ✓ Valid UTC datetime
703
- * ISODateFormatSchema.parse('2025-01-01T10:30:00+05:30'); // ✓ Valid with offset
704
- * ISODateFormatSchema.parse('2025-01-01T10:30:00.123Z'); // ✓ Valid with milliseconds
705
- * ISODateFormatSchema.parse('01/01/2025'); // ✗ Throws - not ISO format
706
- * ISODateFormatSchema.parse('2025-13-01'); // ✗ Throws - invalid month
707
- * ISODateFormatSchema.parse('not-a-date'); // ✗ Throws - invalid format
708
- * ```
709
- *
710
- * @group Schema
711
- */
712
- export declare const ISODateFormatSchema: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>;
713
- /**
714
- * A Zod schema that validates date-like values.
715
- *
716
- * This schema accepts any value that can represent a date: native JavaScript
717
- * Date objects, ISO 8601 date strings, or numeric timestamps. It provides a
718
- * unified validation approach for date inputs across different assertion types.
719
- * The schema is registered in the BupkisRegistry for use in assertion
720
- * creation.
721
- *
722
- * @privateRemarks
723
- * This schema is registered with the name 'date-like' in the BupkisRegistry and
724
- * is commonly used in temporal assertions throughout the library.
725
- * @example
726
- *
727
- * ```typescript
728
- * DateLikeFormatSchema.parse(new Date()); // ✓ Valid Date object
729
- * DateLikeFormatSchema.parse('2025-01-01'); // ✓ Valid ISO date string
730
- * DateLikeFormatSchema.parse('2025-01-01T10:30:00Z'); // ✓ Valid ISO datetime
731
- * DateLikeFormatSchema.parse(Date.now()); // ✓ Valid timestamp
732
- * DateLikeFormatSchema.parse(0); // ✓ Valid Unix epoch
733
- * DateLikeFormatSchema.parse('invalid-date'); // ✗ Throws - invalid format
734
- * DateLikeFormatSchema.parse({}); // ✗ Throws - not date-like
735
- * DateLikeFormatSchema.parse(null); // ✗ Throws - null not accepted
736
- * ```
737
- *
738
- * @group Schema
739
- */
740
- export declare const DateLikeFormatSchema: z.ZodUnion<readonly [z.ZodDate, z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>, z.ZodInt]>;
741
- /**
742
- * A Zod schema that validates duration string formats.
743
- *
744
- * This schema validates human-readable duration strings using a flexible format
745
- * that supports various time units with both full names and abbreviations. The
746
- * format is "{amount} {unit}" where amount is a positive integer and unit can
747
- * be any supported time unit. Extra whitespace is automatically trimmed.
748
- *
749
- * Supported units (case-insensitive):
750
- *
751
- * - Milliseconds: `millisecond`, `milliseconds`, `ms`
752
- * - Seconds: `second`, `seconds`, `s`
753
- * - Minutes: `minute`, `minutes`, `m`
754
- * - Hours: `hour`, `hours`, `h`
755
- * - Days: `day`, `days`, `d`
756
- * - Weeks: `week`, `weeks`, `w`
757
- * - Months: `month`, `months` (approximate: 30 days)
758
- * - Years: `year`, `years`, `y` (approximate: 365 days)
759
- *
760
- * @privateRemarks
761
- * This schema only validates the format; it does not perform any
762
- * transformations. For converting to milliseconds, use {@link DurationSchema}
763
- * instead. The schema is registered with the name 'duration' in the
764
- * BupkisRegistry.
765
- * @example
766
- *
767
- * ```typescript
768
- * DurationFormatSchema.parse('1 hour'); // ✓ Valid
769
- * DurationFormatSchema.parse('30 minutes'); // ✓ Valid
770
- * DurationFormatSchema.parse('2 days'); // ✓ Valid
771
- * DurationFormatSchema.parse(' 5 seconds '); // ✓ Valid (whitespace trimmed)
772
- * DurationFormatSchema.parse('1h'); // ✓ Valid abbreviation
773
- * DurationFormatSchema.parse('10 ms'); // ✓ Valid milliseconds
774
- * DurationFormatSchema.parse('-5 minutes'); // ✗ Throws - negative not allowed
775
- * DurationFormatSchema.parse('1.5 hours'); // ✗ Throws - decimal not allowed
776
- * DurationFormatSchema.parse('5'); // ✗ Throws - missing unit
777
- * DurationFormatSchema.parse('five minutes'); // ✗ Throws - non-numeric amount
778
- * ```
779
- *
780
- * @group Schema
781
- */
782
- export declare const DurationFormatSchema: z.ZodCustomStringFormat<"duration">;
783
- export declare const DurationSchema: z.ZodPipe<z.ZodCustomStringFormat<"duration">, z.ZodTransform<number, string>>;
784
- /**
785
- * Schema that matches any `Set` instance, including those with any element
786
- * types.
787
- *
788
- * This schema is designed for runtime type checking and assertion matching
789
- * rather than parsing or validation of Set contents. It uses `instanceof`
790
- * checking to verify that a value is a Set, regardless of what elements it
791
- * contains.
792
- *
793
- * **Usage in Assertions:**
794
- *
795
- * - Collection size validation: `expect(mySet, 'to have size', 3)`
796
- * - Set operations: `expect(setA, 'to be a subset of', setB)`
797
- * - Emptiness checks: `expect(mySet, 'to be empty')`
798
- * - Element containment: `expect(mySet, 'to contain', value)`
799
- *
800
- * **Why `instanceof` Instead of Zod's `z.set()`:**
801
- *
802
- * - `z.set()` requires knowing the element schema at compile time
803
- * - This schema works with Sets containing any element types
804
- * - Focuses on the Set structure rather than element validation
805
- * - Better performance for assertion matching scenarios
806
- *
807
- * @example
808
- *
809
- * ```ts
810
- * // Matches any Set regardless of element types
811
- * SetSchema.parse(new Set([1, 2, 3])); // ✓ passes
812
- * SetSchema.parse(new Set(['a', 'b'])); // ✓ passes
813
- * SetSchema.parse(new Set()); // ✓ passes (empty Set)
814
- * SetSchema.parse([]); // ✗ fails (not a Set)
815
- * SetSchema.parse(new WeakSet()); // ✗ fails (use AnySetSchema)
816
- * ```
817
- *
818
- * @group Schema
819
- */
820
- export declare const SetSchema: z.ZodCustom<Set<unknown>, Set<unknown>>;
821
- /**
822
- * Schema that matches either `Set` or `WeakSet` instances.
823
- *
824
- * This unified schema handles both strong and weak Set types, making it useful
825
- * for assertions that should work with either variant. The distinction between
826
- * Set and WeakSet is important for garbage collection behavior but often
827
- * irrelevant for structural assertions.
828
- *
829
- * **Key Differences Between Set and WeakSet:**
830
- *
831
- * - **Set**: Holds strong references, prevents GC, iterable, any value types
832
- * - **WeakSet**: Holds weak references, allows GC, not iterable, object keys only
833
- *
834
- * **Usage Scenarios:**
835
- *
836
- * - Generic containment checks that work with both types
837
- * - Polymorphic collection handling in assertion libraries
838
- * - APIs that accept either Set variant for flexibility
839
- *
840
- * **WeakSet Limitations:**
841
- *
842
- * - Only accepts object or symbol values (primitives will cause runtime errors)
843
- * - Cannot be iterated or have size checked
844
- * - Some Set-specific assertions may not work with WeakSet
845
- *
846
- * @example
847
- *
848
- * ```ts
849
- * // Accepts both Set and WeakSet
850
- * AnySetSchema.parse(new Set([1, 2, 3])); // ✓ passes
851
- * AnySetSchema.parse(new WeakSet([obj1, obj2])); // ✓ passes
852
- * AnySetSchema.parse(new Map()); // ✗ fails (wrong collection type)
853
- *
854
- * // Usage in assertions
855
- * expect(myWeakSet, 'to contain', someObject); // Works with WeakSet
856
- * expect(mySet, 'to contain', 'string'); // Works with Set
857
- * ```
858
- *
859
- * @group Schema
860
- */
861
- export declare const AnySetSchema: z.ZodUnion<[z.ZodCustom<Set<unknown>, Set<unknown>>, z.ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>]>;
862
- /**
863
- * Schema that matches any `Map` instance, including those with any key-value
864
- * types.
865
- *
866
- * This schema provides runtime type checking for Map instances without
867
- * requiring compile-time knowledge of key or value schemas. It uses
868
- * `instanceof` checking to verify Map structure while being agnostic about the
869
- * contained data types.
870
- *
871
- * **Usage in Assertions:**
872
- *
873
- * - Size validation: `expect(myMap, 'to have size', 5)`
874
- * - Key presence: `expect(myMap, 'to have key', 'someKey')`
875
- * - Value containment: `expect(myMap, 'to have value', expectedValue)`
876
- * - Entry validation: `expect(myMap, 'to have entry', [key, value])`
877
- * - Map equality: `expect(mapA, 'to equal', mapB)`
878
- *
879
- * **Advantages Over `z.map()`:**
880
- *
881
- * - Works with Maps having heterogeneous key/value types
882
- * - No need to specify key and value schemas upfront
883
- * - Optimized for structural validation rather than content parsing
884
- * - Better error messages for type mismatches in assertions
885
- *
886
- * @example
887
- *
888
- * ```ts
889
- * // Matches any Map regardless of key/value types
890
- * MapSchema.parse(new Map([['key', 'value']])); // ✓ passes
891
- * MapSchema.parse(
892
- * new Map([
893
- * [1, 'one'],
894
- * [2, 'two'],
895
- * ]),
896
- * ); // ✓ passes
897
- * MapSchema.parse(new Map()); // ✓ passes (empty Map)
898
- * MapSchema.parse({}); // ✗ fails (plain object)
899
- * MapSchema.parse(new WeakMap()); // ✗ fails (use AnyMapSchema)
900
- * ```
901
- *
902
- * @group Schema
903
- */
904
- export declare const MapSchema: z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>;
905
- export declare const WeakMapSchema: z.ZodCustom<WeakMap<WeakKey, unknown>, WeakMap<WeakKey, unknown>>;
906
- /**
907
- * Schema that matches either `Map` or `WeakMap` instances.
908
- *
909
- * This union schema accommodates both strong and weak Map variants, enabling
910
- * assertions to work polymorphically across both collection types. The choice
911
- * between Map and WeakMap affects memory management and iteration capabilities
912
- * but often doesn't impact structural validation logic.
913
- *
914
- * **Key Differences Between Map and WeakMap:**
915
- *
916
- * - **Map**: Strong references, enumerable, iterable, any key types, has `.size`
917
- * - **WeakMap**: Weak references, not enumerable, not iterable, object keys only,
918
- * no `.size`
919
- *
920
- * **Usage Considerations:**
921
- *
922
- * - Use for assertions that need to work with either Map type
923
- * - Particularly useful in library code that accepts either variant
924
- * - Some Map-specific operations (iteration, size) won't work with WeakMap
925
- * - WeakMap key restrictions (objects/symbols only) should be considered
926
- *
927
- * **Memory Management Implications:**
928
- *
929
- * - Map entries prevent garbage collection of keys
930
- * - WeakMap entries allow garbage collection when keys become unreachable
931
- * - This affects long-lived caches and memory-sensitive applications
932
- *
933
- * @example
934
- *
935
- * ```ts
936
- * // Accepts both Map and WeakMap
937
- * AnyMapSchema.parse(new Map([['key', 'value']])); // ✓ passes
938
- * AnyMapSchema.parse(new WeakMap([[obj, 'value']])); // ✓ passes
939
- * AnyMapSchema.parse(new Set()); // ✗ fails (wrong collection type)
940
- *
941
- * // Usage in assertions
942
- * expect(myWeakMap, 'to have key', someObject); // Works with WeakMap
943
- * expect(myMap, 'to have key', 'stringKey'); // Works with Map
944
- * expect(myWeakMap, 'to have size', 3); // ✗ Fails - WeakMap has no size
945
- * ```
946
- *
947
- * @group Schema
948
- */
949
- export declare const AnyMapSchema: z.ZodUnion<[z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, z.ZodCustom<WeakMap<WeakKey, unknown>, WeakMap<WeakKey, unknown>>]>;
950
- export declare const StringSchema: z.ZodString;
951
- export declare const NumberSchema: z.ZodNumber;
952
- export declare const InfinitySchema: z.ZodLiteral<number>;
953
- export declare const NegativeInfinitySchema: z.ZodLiteral<number>;
954
- export declare const BooleanSchema: z.ZodBoolean;
955
- export declare const PositiveNumberSchema: z.ZodNumber;
956
- export declare const NegativeNumberSchema: z.ZodNumber;
957
- export declare const BigintSchema: z.ZodBigInt;
958
- export declare const SymbolSchema: z.ZodSymbol;
959
- export declare const UnknownSchema: z.ZodUnknown;
960
- export declare const UnknownArraySchema: z.ZodArray<z.ZodUnknown>;
961
- export declare const DateSchema: z.ZodDate;
962
- export declare const UnknownRecordSchema: z.ZodRecord<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodSymbol]>, z.ZodUnknown>;
963
- export declare const ErrorSchema: z.ZodCustom<Error, Error>;
964
- export declare const RegexpSchema: z.ZodCustom<RegExp, RegExp>;
965
- export declare const NullSchema: z.ZodNull;
966
- export declare const UndefinedSchema: z.ZodUndefined;
967
- export declare const WeakSetSchema: z.ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>;
968
- export declare const WeakRefSchema: z.ZodCustom<WeakRef<WeakKey>, WeakRef<WeakKey>>;
969
- export declare const AnyObjectSchema: z.ZodObject<{}, z.core.$loose>;
970
- /**
971
- * Schema for snapshot options.
972
- */
973
- export declare const SnapshotOptionsSchema: z.ZodObject<{
974
- hint: z.ZodOptional<z.ZodString>;
975
- serializer: z.ZodOptional<z.ZodAny>;
976
- }, z.core.$strip>;
977
- /**
978
- * Schema matching any synchronous iterable (has `Symbol.iterator` method).
979
- *
980
- * This schema validates values that implement the synchronous iteration
981
- * protocol, meaning they have a `Symbol.iterator` method that returns an
982
- * iterator. This includes arrays, strings, Sets, Maps, generators, and custom
983
- * iterable objects.
984
- *
985
- * @example Direct Usage
986
- *
987
- * ```typescript
988
- * SyncIterableSchema.parse([1, 2, 3]); // ✓ Valid (array)
989
- * SyncIterableSchema.parse('hello'); // ✓ Valid (string)
990
- * SyncIterableSchema.parse(new Set()); // ✓ Valid (Set)
991
- * SyncIterableSchema.parse(new Map()); // ✓ Valid (Map)
992
- * SyncIterableSchema.parse(
993
- * (function* () {
994
- * yield 1;
995
- * })(),
996
- * ); // ✓ Valid (generator)
997
- * SyncIterableSchema.parse(42); // ✗ Throws validation error
998
- * SyncIterableSchema.parse({}); // ✗ Throws validation error (plain objects are not iterable)
999
- * ```
1000
- *
1001
- * @example Assertion Creation
1002
- *
1003
- * ```ts
1004
- * import { createAssertion, use } from 'bupkis';
1005
- * import { SyncIterableSchema } from 'bupkis/schema';
1006
- *
1007
- * const iterableAssertion = createAssertion(
1008
- * [SyncIterableSchema, 'to be iterable'],
1009
- * SyncIterableSchema,
1010
- * );
1011
- *
1012
- * const { expect } = use([iterableAssertion]);
1013
- * expect([1, 2, 3], 'to be iterable');
1014
- * ```
1015
- *
1016
- * @group Schema
1017
- */
1018
- export declare const SyncIterableSchema: z.ZodCustom<Iterable<unknown>, Iterable<unknown>>;
1019
- /**
1020
- * Schema matching any synchronous iterator (has `next()` method).
1021
- *
1022
- * This schema validates values that implement the iterator protocol, meaning
1023
- * they have a `next()` method that returns `{ value, done }` objects. This
1024
- * includes iterator objects returned from calling `Symbol.iterator` on
1025
- * iterables, generator objects, and custom iterator implementations.
1026
- *
1027
- * @remarks
1028
- * Note that most iterators are also iterable (they have `Symbol.iterator`
1029
- * returning `this`), but this schema specifically checks for the `next()`
1030
- * method which is the core iterator requirement.
1031
- * @example Direct Usage
1032
- *
1033
- * ```typescript
1034
- * const arr = [1, 2, 3];
1035
- * SyncIteratorSchema.parse(arr[Symbol.iterator]()); // ✓ Valid
1036
- * SyncIteratorSchema.parse(
1037
- * (function* () {
1038
- * yield 1;
1039
- * })(),
1040
- * ); // ✓ Valid (generators are iterators)
1041
- * SyncIteratorSchema.parse({
1042
- * next: () => ({ done: true, value: undefined }),
1043
- * }); // ✓ Valid
1044
- * SyncIteratorSchema.parse([1, 2, 3]); // ✗ Throws (array is iterable, not iterator)
1045
- * SyncIteratorSchema.parse({}); // ✗ Throws validation error
1046
- * ```
1047
- *
1048
- * @example Assertion Creation
1049
- *
1050
- * ```ts
1051
- * import { createAssertion, use } from 'bupkis';
1052
- * import { SyncIteratorSchema } from 'bupkis/schema';
1053
- *
1054
- * const iteratorAssertion = createAssertion(
1055
- * [SyncIteratorSchema, 'to be an iterator'],
1056
- * SyncIteratorSchema,
1057
- * );
1058
- *
1059
- * const { expect } = use([iteratorAssertion]);
1060
- * expect([1, 2, 3][Symbol.iterator](), 'to be an iterator');
1061
- * ```
1062
- *
1063
- * @group Schema
1064
- */
1065
- export declare const SyncIteratorSchema: z.ZodCustom<Iterator<unknown, any, any>, Iterator<unknown, any, any>>;
1066
- /**
1067
- * Schema matching either a sync iterable or sync iterator.
1068
- *
1069
- * This union schema accepts values that implement either the iterable protocol
1070
- * (has `Symbol.iterator`) or the iterator protocol (has `next()` method). This
1071
- * is useful for assertions that can work with either form, allowing users to
1072
- * pass arrays, generators, or raw iterators interchangeably.
1073
- *
1074
- * @example Direct Usage
1075
- *
1076
- * ```typescript
1077
- * SyncIterableOrIteratorSchema.parse([1, 2, 3]); // ✓ Valid (iterable)
1078
- * SyncIterableOrIteratorSchema.parse([1, 2, 3][Symbol.iterator]()); // ✓ Valid (iterator)
1079
- * SyncIterableOrIteratorSchema.parse(
1080
- * (function* () {
1081
- * yield 1;
1082
- * })(),
1083
- * ); // ✓ Valid (both)
1084
- * SyncIterableOrIteratorSchema.parse(42); // ✗ Throws validation error
1085
- * ```
1086
- *
1087
- * @group Schema
1088
- */
1089
- export declare const SyncIterableOrIteratorSchema: z.ZodUnion<readonly [z.ZodCustom<Iterable<unknown>, Iterable<unknown>>, z.ZodCustom<Iterator<unknown, any, any>, Iterator<unknown, any, any>>]>;
1090
- /**
1091
- * Schema matching any asynchronous iterable (has `Symbol.asyncIterator`
1092
- * method).
1093
- *
1094
- * This schema validates values that implement the asynchronous iteration
1095
- * protocol, meaning they have a `Symbol.asyncIterator` method that returns an
1096
- * async iterator. This includes async generators, Node.js Readable streams
1097
- * (v10+), and Web ReadableStreams (in modern browsers and Node.js v22+).
1098
- *
1099
- * @example Direct Usage
1100
- *
1101
- * ```typescript
1102
- * AsyncIterableSchema.parse(
1103
- * (async function* () {
1104
- * yield 1;
1105
- * })(),
1106
- * ); // ✓ Valid (async generator)
1107
- * AsyncIterableSchema.parse(Readable.from([1, 2, 3])); // ✓ Valid (Node stream)
1108
- * AsyncIterableSchema.parse(new ReadableStream()); // ✓ Valid (Web stream, Node 22+)
1109
- * AsyncIterableSchema.parse([1, 2, 3]); // ✗ Throws (sync iterable, not async)
1110
- * AsyncIterableSchema.parse(Promise.resolve(1)); // ✗ Throws (Promise is not iterable)
1111
- * ```
1112
- *
1113
- * @example Assertion Creation
1114
- *
1115
- * ```ts
1116
- * import { createAssertion, use } from 'bupkis';
1117
- * import { AsyncIterableSchema } from 'bupkis/schema';
1118
- *
1119
- * const asyncIterableAssertion = createAssertion(
1120
- * [AsyncIterableSchema, 'to be an async iterable'],
1121
- * AsyncIterableSchema,
1122
- * );
1123
- *
1124
- * const { expect } = use([asyncIterableAssertion]);
1125
- * expect(
1126
- * (async function* () {
1127
- * yield 1;
1128
- * })(),
1129
- * 'to be an async iterable',
1130
- * );
1131
- * ```
1132
- *
1133
- * @group Schema
1134
- */
1135
- export declare const AsyncIterableSchema: z.ZodCustom<AsyncIterable<unknown>, AsyncIterable<unknown>>;
1136
- /**
1137
- * Schema matching any asynchronous iterator (has async `next()` method).
1138
- *
1139
- * This schema validates values that implement the async iterator protocol,
1140
- * meaning they have a `next()` method that returns a Promise of `{ value, done
1141
- * }`. This includes async iterator objects and custom async iterator
1142
- * implementations.
1143
- *
1144
- * @remarks
1145
- * This schema checks for the presence of a `next()` method but cannot verify at
1146
- * parse time that it returns a Promise. The async behavior is validated at
1147
- * iteration time.
1148
- * @example Direct Usage
1149
- *
1150
- * ```typescript
1151
- * const asyncGen = (async function* () {
1152
- * yield 1;
1153
- * })();
1154
- * AsyncIteratorSchema.parse(asyncGen); // ✓ Valid (async generator is also iterator)
1155
- * AsyncIteratorSchema.parse({
1156
- * next: async () => ({ done: true, value: undefined }),
1157
- * }); // ✓ Valid
1158
- * AsyncIteratorSchema.parse([1, 2, 3][Symbol.iterator]()); // ✓ Valid (has next())
1159
- * AsyncIteratorSchema.parse({}); // ✗ Throws validation error
1160
- * ```
1161
- *
1162
- * @group Schema
1163
- */
1164
- export declare const AsyncIteratorSchema: z.ZodCustom<AsyncIterator<unknown, any, any>, AsyncIterator<unknown, any, any>>;
1165
- /**
1166
- * Schema matching either an async iterable or async iterator. Also accepts sync
1167
- * iterables (can be consumed async).
1168
- *
1169
- * This permissive union schema accepts values that can be iterated
1170
- * asynchronously, including:
1171
- *
1172
- * - Async iterables (has `Symbol.asyncIterator`)
1173
- * - Async iterators (has async `next()`)
1174
- * - Sync iterables (has `Symbol.iterator`) - these can be consumed via async
1175
- * iteration
1176
- *
1177
- * This flexibility allows async assertions to work uniformly with various
1178
- * iterable types.
1179
- *
1180
- * @example Direct Usage
1181
- *
1182
- * ```typescript
1183
- * AsyncIterableOrIteratorSchema.parse(
1184
- * (async function* () {
1185
- * yield 1;
1186
- * })(),
1187
- * ); // ✓ Valid
1188
- * AsyncIterableOrIteratorSchema.parse([1, 2, 3]); // ✓ Valid (sync iterable works)
1189
- * AsyncIterableOrIteratorSchema.parse(Readable.from([1, 2, 3])); // ✓ Valid
1190
- * AsyncIterableOrIteratorSchema.parse(42); // ✗ Throws validation error
1191
- * ```
1192
- *
1193
- * @group Schema
1194
- */
1195
- export declare const AsyncIterableOrIteratorSchema: z.ZodUnion<readonly [z.ZodCustom<AsyncIterable<unknown>, AsyncIterable<unknown>>, z.ZodCustom<AsyncIterator<unknown, any, any>, AsyncIterator<unknown, any, any>>, z.ZodCustom<Iterable<unknown>, Iterable<unknown>>]>;
1196
- //# sourceMappingURL=schema.d.ts.map