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
@@ -1,109 +0,0 @@
1
- /**
2
- * Core assertion class and parsing engine.
3
- *
4
- * This module implements the main `Assertion` class which handles parsing,
5
- * validation, and execution of assertions. It provides the foundational
6
- * infrastructure for converting assertion parts into executable validation
7
- * logic with comprehensive error handling and type safety.
8
- *
9
- * @packageDocumentation
10
- */
11
- import { type ArrayValues } from 'type-fest';
12
- import { z } from 'zod';
13
- import { AssertionError } from "../error.js";
14
- import { type StandardSchemaV1 } from "../standard-schema.js";
15
- import { type Assertion, type AssertionImpl, type AssertionParts, type AssertionSlots, type ParsedResult } from "./assertion-types.js";
16
- /**
17
- * Base abstract class for ALL assertions.
18
- */
19
- export declare abstract class BupkisAssertion<Parts extends AssertionParts, Impl extends AssertionImpl<Parts>, Slots extends AssertionSlots<Parts>> implements Assertion<Parts, Impl, Slots> {
20
- readonly parts: Parts;
21
- readonly slots: Slots;
22
- readonly impl: Impl;
23
- readonly id: string;
24
- constructor(parts: Parts, slots: Slots, impl: Impl);
25
- /**
26
- * Extracts phrase literals from this assertion for use in dispatch indexing.
27
- *
28
- * Returns phrases from the first phrase literal slot found (typically slot 1
29
- * for subject-first assertions, or slot 0 for phrase-first assertions).
30
- * Handles both single phrase literals and phrase literal choices.
31
- *
32
- * **Limitation:** Only checks slots at positions 0 and 1. Assertions with
33
- * phrase literals at position 2 or higher will not be indexed, falling back
34
- * to O(n) full scan during dispatch. This covers the vast majority of
35
- * assertion patterns (subject-phrase-... or phrase-subject-...).
36
- *
37
- * @returns Array of phrase strings for indexing, or empty array if none found
38
- */
39
- getIndexPhrases(): readonly string[];
40
- /**
41
- * @returns String representation
42
- */
43
- toString(): string;
44
- /**
45
- * Translates Standard Schema issues into an {@link AssertionError} with a
46
- * human-friendly message.
47
- *
48
- * @param issues The Standard Schema issues from validation failure
49
- * @param stackStartFn The function to start the stack trace from
50
- * @param values Values which caused the error
51
- * @returns New `AssertionError`
52
- */
53
- protected fromStandardSchemaIssues<Values>(issues: ReadonlyArray<StandardSchemaV1.Issue>, stackStartFn: (...args: any[]) => any, values: Values): AssertionError;
54
- /**
55
- * Translates a `ZodError` into an {@link AssertionError} with a human-friendly
56
- * message.
57
- *
58
- * @remarks
59
- * This does not handle parameterized assertions with more than one parameter
60
- * too cleanly; it's unclear how a test runner would display the expected
61
- * values. This will probably need a fix in the future.
62
- * @param stackStartFn The function to start the stack trace from
63
- * @param zodError The original `ZodError`
64
- * @param values Values which caused the error
65
- * @returns New `AssertionError`
66
- */
67
- protected fromZodError<Values>(zodError: z.ZodError, stackStartFn: (...args: any[]) => any, values: Values): AssertionError;
68
- /**
69
- * Checks if this is a "simple schema assertion" - one where subject
70
- * validation can be optimized by validating against the impl schema
71
- * directly.
72
- *
73
- * Simple assertions have:
74
- *
75
- * - A first slot that accepts any/unknown type (subject slot)
76
- * - All remaining slots are string literals (the assertion phrase)
77
- *
78
- * @returns True if this is a simple schema assertion
79
- */
80
- protected isSimpleSchemaAssertion(): boolean;
81
- protected maybeParseValuesArgMismatch<Args extends readonly unknown[]>(args: Args): ParsedResult<Parts> | undefined;
82
- /**
83
- * TODO: Fix the return types here. This is all sorts of confusing.
84
- *
85
- * @param slot Slot to check
86
- * @param slotIndex Index of slot
87
- * @param rawArg Raw argument
88
- * @returns
89
- */
90
- protected parseSlotForLiteral<Slot extends ArrayValues<Slots>>(slot: Slot, slotIndex: number, rawArg: unknown): boolean | ParsedResult<Parts>;
91
- /**
92
- * Generates a unique¹ ID for this assertion by combining content, structure,
93
- * and type information.
94
- *
95
- * - `s` is slot count
96
- * - `p` is part count
97
- *
98
- * Slugifies the string representation of the assertion. Does not collapse
99
- * adjacent hyphens, as hyphens are significant in phrase literals.
100
- *
101
- * @remarks
102
- * ¹: "Unique" here means "unique enough" for practical purposes. This is not
103
- * cryptographically unique, nor does it need to be. The goal is to avoid
104
- * collisions in common scenarios while keeping the ID human-readable.
105
- * @returns A human-readable unique identifier
106
- */
107
- private generateAssertionId;
108
- }
109
- //# sourceMappingURL=assertion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertion.d.ts","sourceRoot":"","sources":["../../src/assertion/assertion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EA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,MAAM,GACb,cAAc;IAsCjB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,uBAAuB,IAAI,OAAO;IAc5C,SAAS,CAAC,2BAA2B,CAAC,IAAI,SAAS,SAAS,OAAO,EAAE,EACnE,IAAI,EAAE,IAAI,GACT,YAAY,CAAC,KAAK,CAAC,GAAG,SAAS;IAQlC;;;;;;;OAOG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,SAAS,WAAW,CAAC,KAAK,CAAC,EAC3D,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC;IA6BhC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,mBAAmB;CAW5B"}
@@ -1,375 +0,0 @@
1
- /**
2
- * Core assertion class and parsing engine.
3
- *
4
- * This module implements the main `Assertion` class which handles parsing,
5
- * validation, and execution of assertions. It provides the foundational
6
- * infrastructure for converting assertion parts into executable validation
7
- * logic with comprehensive error handling and type safety.
8
- *
9
- * @packageDocumentation
10
- */
11
- import createDebug from 'debug';
12
- import slug from 'slug';
13
- import { inspect } from 'util';
14
- import { z } from 'zod';
15
- import { kStringLiteral } from "../constant.js";
16
- import { extractDiffValues, generateDiff, shouldGenerateDiff, } from "../diff.js";
17
- import { AssertionError, InvalidMetadataError } from "../error.js";
18
- import { isZodType } from "../guards.js";
19
- import { BupkisRegistry } from "../metadata.js";
20
- const debug = createDebug('bupkis:assertion');
21
- const { entries, hasOwn, keys } = Object;
22
- const { isArray } = Array;
23
- const { min } = Math;
24
- /**
25
- * Modified charmap for {@link slug} to use underscores to replace hyphens (`-`;
26
- * and for hyphens to replace everything else that needs replacing) and `<` with
27
- * `_` (to distinguish type args)
28
- *
29
- * @see {@link BupkisAssertion.generateUniqueId} for usage
30
- */
31
- const SLUG_CHARMAP = { ...slug.charmap, '-': '_', '<': '_', '>': '' };
32
- /**
33
- * Base abstract class for ALL assertions.
34
- */
35
- export class BupkisAssertion {
36
- parts;
37
- slots;
38
- impl;
39
- id;
40
- constructor(parts, slots, impl) {
41
- this.parts = parts;
42
- this.slots = slots;
43
- this.impl = impl;
44
- this.id = this.generateAssertionId();
45
- debug('ℹ Created assertion %s', this);
46
- }
47
- /**
48
- * Extracts phrase literals from this assertion for use in dispatch indexing.
49
- *
50
- * Returns phrases from the first phrase literal slot found (typically slot 1
51
- * for subject-first assertions, or slot 0 for phrase-first assertions).
52
- * Handles both single phrase literals and phrase literal choices.
53
- *
54
- * **Limitation:** Only checks slots at positions 0 and 1. Assertions with
55
- * phrase literals at position 2 or higher will not be indexed, falling back
56
- * to O(n) full scan during dispatch. This covers the vast majority of
57
- * assertion patterns (subject-phrase-... or phrase-subject-...).
58
- *
59
- * @returns Array of phrase strings for indexing, or empty array if none found
60
- */
61
- getIndexPhrases() {
62
- // Look for phrase literal at slot 0 or 1 (most common positions)
63
- for (let i = 0; i < min(2, this.slots.length); i++) {
64
- const slot = this.slots[i];
65
- if (!slot) {
66
- continue;
67
- }
68
- const meta = BupkisRegistry.get(slot) ?? {};
69
- if (kStringLiteral in meta) {
70
- if ('value' in meta && typeof meta.value === 'string') {
71
- return [meta.value];
72
- }
73
- if ('values' in meta && isArray(meta.values)) {
74
- return meta.values;
75
- }
76
- }
77
- }
78
- return [];
79
- }
80
- /**
81
- * @returns String representation
82
- */
83
- toString() {
84
- /**
85
- * Expands a Zod type into a human-readable string representation.
86
- *
87
- * @function
88
- * @param zodType The Zod type (or internal ZodType) to expand
89
- * @param wrapCurlies Whether to wrap the result in curly braces
90
- * @returns String representation of the Zod type
91
- */
92
- /* c8 ignore start */
93
- const expand = (zodType, wrapCurlies = false) => {
94
- /**
95
- * Finds a `ZodTypeDef` within a Zod type or internal Zod type
96
- *
97
- * @function
98
- */
99
- const getDef = (zodType) => ('def' in zodType
100
- ? zodType.def
101
- : zodType._zod.def);
102
- let repr = '';
103
- const meta = BupkisRegistry.get(zodType);
104
- if (meta?.name) {
105
- // our name
106
- repr = meta.name;
107
- }
108
- else {
109
- // overrides for certain Zod types which have internal structure
110
- if (isZodType(zodType, 'custom')) {
111
- // handles z.instanceof
112
- repr = zodType._zod.bag.Class?.name ?? 'custom';
113
- }
114
- else if (isZodType(zodType, 'date')) {
115
- repr = 'Date';
116
- }
117
- else if (isZodType(zodType, 'array')) {
118
- repr = `${expand(getDef(zodType).element)}[]`;
119
- }
120
- else if (isZodType(zodType, 'default')) {
121
- repr = `{${expand(zodType.unwrap())}}`;
122
- }
123
- else if (isZodType(zodType, 'enum')) {
124
- repr = `${keys(getDef(zodType).entries).join(' / ')}`;
125
- }
126
- else if (isZodType(zodType, 'function')) {
127
- const def = getDef(zodType);
128
- const { input, output } = def;
129
- const params = input
130
- ? isZodType(input, 'tuple')
131
- ? `[${getDef(input)
132
- .items.map((p) => expand(p))
133
- .join(', ')}]`
134
- : expand(input)
135
- : '()';
136
- const returns = output ? expand(output) : 'void';
137
- repr = `(${params}) => ${returns}`;
138
- }
139
- else if (isZodType(zodType, 'intersection')) {
140
- const def = getDef(zodType);
141
- repr = `${expand(def.left)} & ${expand(def.right)}`;
142
- }
143
- else if (isZodType(zodType, 'literal')) {
144
- repr = getDef(zodType)
145
- .values.map((value) => `'${value}'`)
146
- .join(' / ');
147
- }
148
- else if (isZodType(zodType, 'map')) {
149
- repr = `Map<${expand(getDef(zodType).keyType)}, ${expand(getDef(zodType).valueType)}>`;
150
- }
151
- else if (isZodType(zodType, 'nonoptional')) {
152
- repr = `${expand(getDef(zodType).innerType)}!`;
153
- }
154
- else if (isZodType(zodType, 'nullable')) {
155
- repr = `${expand(getDef(zodType).innerType)}? | null`;
156
- }
157
- else if (isZodType(zodType, 'optional')) {
158
- repr = `${expand(getDef(zodType).innerType)}?`;
159
- }
160
- else if (isZodType(zodType, 'promise')) {
161
- repr = `Promise<${expand(zodType.unwrap())}>`;
162
- }
163
- else if (isZodType(zodType, 'never')) {
164
- repr = 'NEVER';
165
- }
166
- else if (isZodType(zodType, 'record')) {
167
- repr = `Record<${expand(getDef(zodType).keyType)}, ${expand(getDef(zodType).valueType)}>`;
168
- }
169
- else if (isZodType(zodType, 'set')) {
170
- repr = `Set<${expand(getDef(zodType).valueType)}>`;
171
- }
172
- else if (isZodType(zodType, 'symbol')) {
173
- repr = 'Symbol';
174
- }
175
- else if (isZodType(zodType, 'tuple')) {
176
- repr = `[${getDef(zodType)
177
- .items.map((value) => expand(value))
178
- .join(', ')}]`;
179
- }
180
- else if (isZodType(zodType, 'union')) {
181
- repr = getDef(zodType)
182
- .options.map((value) => expand(value))
183
- .join(' | ');
184
- }
185
- else if (isZodType(zodType, 'object')) {
186
- const objEntries = entries(zodType.shape);
187
- if (objEntries.length) {
188
- const pairs = objEntries.map(([key, zodTypeValue]) => `${key}: ${expand(zodTypeValue)}`);
189
- repr = `{ ${pairs.join('; ')} }`;
190
- }
191
- else {
192
- repr = 'object';
193
- }
194
- }
195
- else {
196
- repr = getDef(zodType).type;
197
- }
198
- }
199
- return wrapCurlies ? `{${repr}}` : repr;
200
- };
201
- /* c8 ignore stop */
202
- return `"${this.slots
203
- .map((slot) => hasOwn(BupkisRegistry.get(slot) ?? {}, kStringLiteral)
204
- ? expand(slot)
205
- : expand(slot, true))
206
- .join(' ')}"`;
207
- }
208
- /**
209
- * Translates Standard Schema issues into an {@link AssertionError} with a
210
- * human-friendly message.
211
- *
212
- * @param issues The Standard Schema issues from validation failure
213
- * @param stackStartFn The function to start the stack trace from
214
- * @param values Values which caused the error
215
- * @returns New `AssertionError`
216
- */
217
- fromStandardSchemaIssues(issues, stackStartFn, values) {
218
- const subject = isArray(values) ? values[0] : values;
219
- const issueMessages = issues
220
- .map((issue) => {
221
- const pathStr = issue.path
222
- ? `at ${issue.path
223
- .map((segment) => typeof segment === 'object' && 'key' in segment
224
- ? segment.key
225
- : segment)
226
- .join('.')}: `
227
- : '';
228
- return ` ${pathStr}${issue.message}`;
229
- })
230
- .join('\n');
231
- return new AssertionError({
232
- actual: subject,
233
- id: this.id,
234
- message: `Assertion ${this} failed:\n${issueMessages}`,
235
- stackStartFn,
236
- });
237
- }
238
- /**
239
- * Translates a `ZodError` into an {@link AssertionError} with a human-friendly
240
- * message.
241
- *
242
- * @remarks
243
- * This does not handle parameterized assertions with more than one parameter
244
- * too cleanly; it's unclear how a test runner would display the expected
245
- * values. This will probably need a fix in the future.
246
- * @param stackStartFn The function to start the stack trace from
247
- * @param zodError The original `ZodError`
248
- * @param values Values which caused the error
249
- * @returns New `AssertionError`
250
- */
251
- fromZodError(zodError, stackStartFn, values) {
252
- const subject = isArray(values) ? values[0] : values;
253
- const { actual, expected } = extractDiffValues(zodError, subject);
254
- // Only use custom message if we could extract diff values
255
- if (shouldGenerateDiff(actual, expected)) {
256
- // Use jest-diff to generate rich, colored diff output
257
- const diffOutput = generateDiff(expected, actual, {
258
- aAnnotation: 'expected',
259
- bAnnotation: 'actual',
260
- expand: false,
261
- includeChangeCounts: true,
262
- });
263
- const message = diffOutput
264
- ? `Assertion ${this} failed:\n${diffOutput}`
265
- : `Assertion ${this} failed: values are not equal`;
266
- return new AssertionError({
267
- actual,
268
- expected,
269
- id: this.id,
270
- message,
271
- stackStartFn,
272
- });
273
- }
274
- else {
275
- // Fall back to Zod's prettified error message
276
- const pretty = z.prettifyError(zodError).slice(2);
277
- return new AssertionError({
278
- actual: subject,
279
- id: this.id,
280
- message: `Assertion ${this} failed:\n${pretty}`,
281
- stackStartFn,
282
- });
283
- }
284
- }
285
- /**
286
- * Checks if this is a "simple schema assertion" - one where subject
287
- * validation can be optimized by validating against the impl schema
288
- * directly.
289
- *
290
- * Simple assertions have:
291
- *
292
- * - A first slot that accepts any/unknown type (subject slot)
293
- * - All remaining slots are string literals (the assertion phrase)
294
- *
295
- * @returns True if this is a simple schema assertion
296
- */
297
- isSimpleSchemaAssertion() {
298
- const hasSubjectSlot = this.slots.length > 0 &&
299
- (this.slots[0]?.def.type === 'unknown' ||
300
- this.slots[0]?.def.type === 'any');
301
- const allOtherSlotsAreLiterals = this.slots.slice(1).every((slot) => {
302
- const meta = BupkisRegistry.get(slot) ?? {};
303
- return kStringLiteral in meta;
304
- });
305
- return hasSubjectSlot && allOtherSlotsAreLiterals;
306
- }
307
- maybeParseValuesArgMismatch(args) {
308
- if (this.slots.length !== args.length) {
309
- return {
310
- success: false,
311
- };
312
- }
313
- }
314
- /**
315
- * TODO: Fix the return types here. This is all sorts of confusing.
316
- *
317
- * @param slot Slot to check
318
- * @param slotIndex Index of slot
319
- * @param rawArg Raw argument
320
- * @returns
321
- */
322
- parseSlotForLiteral(slot, slotIndex, rawArg) {
323
- const meta = BupkisRegistry.get(slot) ?? {};
324
- // our branded literal slots are also tagged in meta for runtime
325
- if (kStringLiteral in meta) {
326
- if ('value' in meta) {
327
- if (rawArg !== meta.value) {
328
- return {
329
- success: false,
330
- };
331
- }
332
- }
333
- else if ('values' in meta) {
334
- const allowed = meta.values;
335
- if (!allowed.includes(`${rawArg}`)) {
336
- return {
337
- success: false,
338
- };
339
- }
340
- }
341
- else {
342
- /* c8 ignore next */
343
- throw new InvalidMetadataError(`Invalid metadata for slot ${slotIndex} with value ${inspect(rawArg)}`, { metadata: meta });
344
- }
345
- return true;
346
- }
347
- return false;
348
- }
349
- /**
350
- * Generates a unique¹ ID for this assertion by combining content, structure,
351
- * and type information.
352
- *
353
- * - `s` is slot count
354
- * - `p` is part count
355
- *
356
- * Slugifies the string representation of the assertion. Does not collapse
357
- * adjacent hyphens, as hyphens are significant in phrase literals.
358
- *
359
- * @remarks
360
- * ¹: "Unique" here means "unique enough" for practical purposes. This is not
361
- * cryptographically unique, nor does it need to be. The goal is to avoid
362
- * collisions in common scenarios while keeping the ID human-readable.
363
- * @returns A human-readable unique identifier
364
- */
365
- generateAssertionId() {
366
- const baseSlug = slug(`${this}`, {
367
- charmap: SLUG_CHARMAP,
368
- });
369
- // Add structural signature for additional uniqueness
370
- // Use simple slot count and parts count as differentiators
371
- const signature = `${this.slots.length}s${this.parts.length}p`;
372
- return `${baseSlug}-${signature}`;
373
- }
374
- }
375
- //# sourceMappingURL=assertion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertion.js","sourceRoot":"","sources":["../../src/assertion/assertion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,uBAAuB;AAChD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,mBAAmB;AACpB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB;AACnE,OAAO,EAAE,SAAS,EAAE,qBAAqB;AACzC,OAAO,EAAE,cAAc,EAAE,uBAAuB;AAWhD,MAAM,KAAK,GAAG,WAAW,CAAC,kBAAkB,CAAC,CAAC;AAC9C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;AACzC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAC1B,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACrB;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAgB,eAAe;IAQxB;IACA;IACA;IALF,EAAE,CAAS;IAEpB,YACW,KAAY,EACZ,KAAY,EACZ,IAAU;QAFV,UAAK,GAAL,KAAK,CAAO;QACZ,UAAK,GAAL,KAAK,CAAO;QACZ,SAAI,GAAJ,IAAI,CAAM;QAEnB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACrC,KAAK,CAAC,wBAAwB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CAC5B,6BAA6B,SAAS,eAAe,OAAO,CAAC,MAAM,CAAC,EAAE,EACtE,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACK,mBAAmB;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,EAAE;YAC/B,OAAO,EAAE,YAAY;SACtB,CAAC,CAAC;QAEH,qDAAqD;QACrD,2DAA2D;QAC3D,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QAE/D,OAAO,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;IACpC,CAAC;CACF"}
@@ -1,148 +0,0 @@
1
- "use strict";
2
- /**
3
- * Assertion creation factory functions with type-safe sync/async separation.
4
- *
5
- * This module provides the core factory functions for creating both synchronous
6
- * and asynchronous assertions in the Bupkis assertion framework. It implements
7
- * a dual-creation pattern where `createAssertion()` creates synchronous-only
8
- * assertions and `createAsyncAssertion()` creates potentially asynchronous
9
- * assertions, using branded Zod schema types to enforce compile-time safety and
10
- * prevent accidental mixing of sync and async implementations.
11
- *
12
- * The module supports two primary assertion implementation types:
13
- *
14
- * - **Schema-based assertions**: Using {@link z.ZodType Zod schemas} for
15
- * validation
16
- * - **Function-based assertions**: Using implementation functions that return
17
- * boolean, void, or Zod schemas for dynamic validation
18
- *
19
- * @remarks
20
- * The factory functions use branded types to distinguish between synchronous
21
- * and asynchronous schema implementations at compile time. This prevents
22
- * accidentally passing async schemas to sync assertion creators and vice versa,
23
- * ensuring type safety throughout the assertion system.
24
- * @example Creating a synchronous string assertion:
25
- *
26
- * ```ts
27
- * import { createAssertion } from './create.js';
28
- * import { z } from 'zod';
29
- *
30
- * const stringAssertion = createAssertion(['to be a string'], z.string());
31
- * ```
32
- *
33
- * @example Creating an asynchronous Promise resolution assertion:
34
- *
35
- * ```ts
36
- * import { createAsyncAssertion } from './create.js';
37
- *
38
- * const promiseAssertion = createAsyncAssertion(
39
- * ['to resolve'],
40
- * async (promise) => {
41
- * try {
42
- * await promise;
43
- * return true;
44
- * } catch {
45
- * return false;
46
- * }
47
- * },
48
- * );
49
- * ```
50
- *
51
- * @example Creating parameterized assertions:
52
- *
53
- * ```ts
54
- * import { createAssertion } from './create.js';
55
- * import { z } from 'zod';
56
- *
57
- * const greaterThanAssertion = createAssertion(
58
- * [z.number(), 'to be greater than', z.number()],
59
- * (subject, expected) => subject > expected,
60
- * );
61
- * ```
62
- *
63
- * @packageDocumentation
64
- * @see {@link AssertionParts} for assertion part structure
65
- * @see {@link AssertionSlots} for processed slot definitions
66
- * @see {@link AssertionImplSync} for synchronous implementation types
67
- * @see {@link AssertionImplAsync} for asynchronous implementation types
68
- */
69
- Object.defineProperty(exports, "__esModule", { value: true });
70
- exports.createAsyncAssertion = exports.createAssertion = void 0;
71
- const zod_1 = require("zod");
72
- const error_js_1 = require("../error.cjs");
73
- const guards_js_1 = require("../guards.cjs");
74
- const internal_schema_js_1 = require("../internal-schema.cjs");
75
- const assertion_async_js_1 = require("./assertion-async.cjs");
76
- const assertion_standard_schema_async_js_1 = require("./assertion-standard-schema-async.cjs");
77
- const assertion_standard_schema_sync_js_1 = require("./assertion-standard-schema-sync.cjs");
78
- const assertion_sync_js_1 = require("./assertion-sync.cjs");
79
- const slotify_js_1 = require("./slotify.cjs");
80
- /**
81
- * {@inheritDoc CreateAssertionFn}
82
- *
83
- * @function
84
- * @throws {TypeError} Invalid assertion implementation type
85
- * @group Assertion Creation
86
- */
87
- const createAssertion = (parts, impl) => {
88
- // Validate inputs using Zod schema
89
- try {
90
- internal_schema_js_1.CreateAssertionInputSchema.parse([parts, impl]);
91
- }
92
- catch (err) {
93
- if (err instanceof zod_1.z.ZodError) {
94
- throw new error_js_1.AssertionImplementationError(`Invalid input parameters: ${zod_1.z.prettifyError(err)}`, { cause: err });
95
- }
96
- /* c8 ignore next */
97
- throw err;
98
- }
99
- const slots = (0, slotify_js_1.slotify)(parts);
100
- if ((0, guards_js_1.isZodType)(impl)) {
101
- return new assertion_sync_js_1.BupkisAssertionSchemaSync(parts, slots, impl);
102
- }
103
- else if ((0, guards_js_1.isStandardSchema)(impl)) {
104
- return new assertion_standard_schema_sync_js_1.BupkisAssertionStandardSchemaSync(parts, slots, impl);
105
- }
106
- else if ((0, guards_js_1.isFunction)(impl)) {
107
- return new assertion_sync_js_1.BupkisAssertionFunctionSync(parts, slots, impl);
108
- }
109
- // should be impossible if CreateAssertionInputSchema is correct
110
- /* c8 ignore next */
111
- throw new error_js_1.AssertionImplementationError('Assertion implementation must be a function, Zod schema, or Standard Schema');
112
- };
113
- exports.createAssertion = createAssertion;
114
- /**
115
- * {@inheritDoc CreateAsyncAssertionFn}
116
- *
117
- * @function
118
- * @throws {TypeError} Invalid assertion implementation type
119
- * @group Assertion Creation
120
- */
121
- const createAsyncAssertion = (parts, impl) => {
122
- // Validate inputs using Zod schema
123
- try {
124
- internal_schema_js_1.CreateAssertionInputSchemaAsync.parse([parts, impl]);
125
- }
126
- catch (err) {
127
- if (err instanceof zod_1.z.ZodError) {
128
- throw new error_js_1.AssertionImplementationError(`Invalid input parameters: ${zod_1.z.prettifyError(err)}`, { cause: err });
129
- }
130
- /* c8 ignore next */
131
- throw err;
132
- }
133
- const slots = (0, slotify_js_1.slotify)(parts);
134
- if ((0, guards_js_1.isZodType)(impl)) {
135
- return new assertion_async_js_1.BupkisAssertionSchemaAsync(parts, slots, impl);
136
- }
137
- else if ((0, guards_js_1.isStandardSchema)(impl)) {
138
- return new assertion_standard_schema_async_js_1.BupkisAssertionStandardSchemaAsync(parts, slots, impl);
139
- }
140
- else if ((0, guards_js_1.isFunction)(impl)) {
141
- return new assertion_async_js_1.BupkisAssertionFunctionAsync(parts, slots, impl);
142
- }
143
- // should be impossible if CreateAssertionInputSchemaAsync is correct
144
- /* c8 ignore next */
145
- throw new error_js_1.AssertionImplementationError('Assertion implementation must be a function, Zod schema, or Standard Schema');
146
- };
147
- exports.createAsyncAssertion = createAsyncAssertion;
148
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/assertion/create.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;;;AAEH,6BAAwB;AAQxB,2CAA2D;AAC3D,6CAAuE;AACvE,+DAG+B;AAC/B,8DAG8B;AAC9B,8FAA0F;AAC1F,4FAAwF;AACxF,4DAG6B;AAK7B,8CAAuC;AAEvC;;;;;;GAMG;AACI,MAAM,eAAe,GAAsB,CAIhD,KAAY,EACZ,IAAU,EACV,EAAE;IACF,mCAAmC;IACnC,IAAI,CAAC;QACH,+CAA0B,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,OAAC,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,uCAA4B,CACpC,6BAA6B,OAAC,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,EACnD,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;QACJ,CAAC;QACD,oBAAoB;QACpB,MAAM,GAAG,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,oBAAO,EAAQ,KAAK,CAAC,CAAC;IAEpC,IAAI,IAAA,qBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,6CAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAW,CAAC,CAAC;IAClE,CAAC;SAAM,IAAI,IAAA,4BAAgB,EAAC,IAAI,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,qEAAiC,CAAC,KAAK,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