bupkis 0.7.2 → 0.9.0

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 (215) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +19 -2
  3. package/dist/commonjs/assertion/assertion-async.d.ts.map +1 -1
  4. package/dist/commonjs/assertion/assertion-async.js +37 -7
  5. package/dist/commonjs/assertion/assertion-async.js.map +1 -1
  6. package/dist/commonjs/assertion/assertion-sync.d.ts.map +1 -1
  7. package/dist/commonjs/assertion/assertion-sync.js +32 -8
  8. package/dist/commonjs/assertion/assertion-sync.js.map +1 -1
  9. package/dist/commonjs/assertion/assertion-types.d.ts +37 -31
  10. package/dist/commonjs/assertion/assertion-types.d.ts.map +1 -1
  11. package/dist/commonjs/assertion/assertion-types.js +0 -32
  12. package/dist/commonjs/assertion/assertion-types.js.map +1 -1
  13. package/dist/commonjs/assertion/assertion.d.ts +3 -21
  14. package/dist/commonjs/assertion/assertion.d.ts.map +1 -1
  15. package/dist/commonjs/assertion/assertion.js +42 -27
  16. package/dist/commonjs/assertion/assertion.js.map +1 -1
  17. package/dist/commonjs/assertion/create.d.ts +2 -0
  18. package/dist/commonjs/assertion/create.d.ts.map +1 -1
  19. package/dist/commonjs/assertion/create.js +38 -42
  20. package/dist/commonjs/assertion/create.js.map +1 -1
  21. package/dist/commonjs/assertion/impl/assertion-util.d.ts +16 -4
  22. package/dist/commonjs/assertion/impl/assertion-util.d.ts.map +1 -1
  23. package/dist/commonjs/assertion/impl/assertion-util.js +20 -15
  24. package/dist/commonjs/assertion/impl/assertion-util.js.map +1 -1
  25. package/dist/commonjs/assertion/impl/async-parametric.d.ts +63 -11
  26. package/dist/commonjs/assertion/impl/async-parametric.d.ts.map +1 -1
  27. package/dist/commonjs/assertion/impl/async-parametric.js +89 -52
  28. package/dist/commonjs/assertion/impl/async-parametric.js.map +1 -1
  29. package/dist/commonjs/assertion/impl/async.d.ts +116 -12
  30. package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
  31. package/dist/commonjs/assertion/impl/async.js +1 -1
  32. package/dist/commonjs/assertion/impl/sync-basic.d.ts.map +1 -1
  33. package/dist/commonjs/assertion/impl/sync-basic.js +6 -4
  34. package/dist/commonjs/assertion/impl/sync-basic.js.map +1 -1
  35. package/dist/commonjs/assertion/impl/sync-collection.d.ts.map +1 -1
  36. package/dist/commonjs/assertion/impl/sync-collection.js +24 -14
  37. package/dist/commonjs/assertion/impl/sync-collection.js.map +1 -1
  38. package/dist/commonjs/assertion/impl/sync-esoteric.d.ts +1 -5
  39. package/dist/commonjs/assertion/impl/sync-esoteric.d.ts.map +1 -1
  40. package/dist/commonjs/assertion/impl/sync-esoteric.js +11 -13
  41. package/dist/commonjs/assertion/impl/sync-esoteric.js.map +1 -1
  42. package/dist/commonjs/assertion/impl/sync-parametric.d.ts +27 -7
  43. package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
  44. package/dist/commonjs/assertion/impl/sync-parametric.js +75 -51
  45. package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
  46. package/dist/commonjs/assertion/impl/sync.d.ts +54 -22
  47. package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
  48. package/dist/commonjs/assertion/impl/sync.js +1 -1
  49. package/dist/commonjs/assertion/impl/sync.js.map +1 -1
  50. package/dist/commonjs/assertion/index.d.ts +1 -1
  51. package/dist/commonjs/assertion/index.d.ts.map +1 -1
  52. package/dist/commonjs/assertion/index.js +0 -1
  53. package/dist/commonjs/assertion/index.js.map +1 -1
  54. package/dist/commonjs/assertion/slotify.d.ts +1 -13
  55. package/dist/commonjs/assertion/slotify.d.ts.map +1 -1
  56. package/dist/commonjs/assertion/slotify.js +49 -16
  57. package/dist/commonjs/assertion/slotify.js.map +1 -1
  58. package/dist/commonjs/bootstrap.d.ts +85 -17
  59. package/dist/commonjs/bootstrap.d.ts.map +1 -1
  60. package/dist/commonjs/bootstrap.js +1 -0
  61. package/dist/commonjs/bootstrap.js.map +1 -1
  62. package/dist/commonjs/diff.d.ts +51 -0
  63. package/dist/commonjs/diff.d.ts.map +1 -0
  64. package/dist/commonjs/diff.js +279 -0
  65. package/dist/commonjs/diff.js.map +1 -0
  66. package/dist/commonjs/error.d.ts +37 -18
  67. package/dist/commonjs/error.d.ts.map +1 -1
  68. package/dist/commonjs/error.js +44 -30
  69. package/dist/commonjs/error.js.map +1 -1
  70. package/dist/commonjs/expect.d.ts.map +1 -1
  71. package/dist/commonjs/expect.js +131 -78
  72. package/dist/commonjs/expect.js.map +1 -1
  73. package/dist/commonjs/guards.d.ts +24 -10
  74. package/dist/commonjs/guards.d.ts.map +1 -1
  75. package/dist/commonjs/guards.js +56 -39
  76. package/dist/commonjs/guards.js.map +1 -1
  77. package/dist/commonjs/index.d.ts +85 -17
  78. package/dist/commonjs/index.d.ts.map +1 -1
  79. package/dist/commonjs/internal-schema.d.ts +25 -0
  80. package/dist/commonjs/internal-schema.d.ts.map +1 -0
  81. package/dist/commonjs/internal-schema.js +209 -0
  82. package/dist/commonjs/internal-schema.js.map +1 -0
  83. package/dist/commonjs/schema.d.ts.map +1 -1
  84. package/dist/commonjs/schema.js +3 -2
  85. package/dist/commonjs/schema.js.map +1 -1
  86. package/dist/commonjs/use.js +22 -8
  87. package/dist/commonjs/use.js.map +1 -1
  88. package/dist/commonjs/util.d.ts +1 -0
  89. package/dist/commonjs/util.d.ts.map +1 -1
  90. package/dist/commonjs/util.js +14 -10
  91. package/dist/commonjs/util.js.map +1 -1
  92. package/dist/commonjs/value-to-schema.d.ts +1 -0
  93. package/dist/commonjs/value-to-schema.d.ts.map +1 -1
  94. package/dist/commonjs/value-to-schema.js +19 -12
  95. package/dist/commonjs/value-to-schema.js.map +1 -1
  96. package/dist/esm/assertion/assertion-async.d.ts.map +1 -1
  97. package/dist/esm/assertion/assertion-async.js +37 -7
  98. package/dist/esm/assertion/assertion-async.js.map +1 -1
  99. package/dist/esm/assertion/assertion-sync.d.ts.map +1 -1
  100. package/dist/esm/assertion/assertion-sync.js +32 -8
  101. package/dist/esm/assertion/assertion-sync.js.map +1 -1
  102. package/dist/esm/assertion/assertion-types.d.ts +37 -31
  103. package/dist/esm/assertion/assertion-types.d.ts.map +1 -1
  104. package/dist/esm/assertion/assertion-types.js +1 -31
  105. package/dist/esm/assertion/assertion-types.js.map +1 -1
  106. package/dist/esm/assertion/assertion.d.ts +3 -21
  107. package/dist/esm/assertion/assertion.d.ts.map +1 -1
  108. package/dist/esm/assertion/assertion.js +42 -27
  109. package/dist/esm/assertion/assertion.js.map +1 -1
  110. package/dist/esm/assertion/create.d.ts +2 -0
  111. package/dist/esm/assertion/create.d.ts.map +1 -1
  112. package/dist/esm/assertion/create.js +37 -41
  113. package/dist/esm/assertion/create.js.map +1 -1
  114. package/dist/esm/assertion/impl/assertion-util.d.ts +16 -4
  115. package/dist/esm/assertion/impl/assertion-util.d.ts.map +1 -1
  116. package/dist/esm/assertion/impl/assertion-util.js +20 -15
  117. package/dist/esm/assertion/impl/assertion-util.js.map +1 -1
  118. package/dist/esm/assertion/impl/async-parametric.d.ts +63 -11
  119. package/dist/esm/assertion/impl/async-parametric.d.ts.map +1 -1
  120. package/dist/esm/assertion/impl/async-parametric.js +89 -52
  121. package/dist/esm/assertion/impl/async-parametric.js.map +1 -1
  122. package/dist/esm/assertion/impl/async.d.ts +116 -12
  123. package/dist/esm/assertion/impl/async.d.ts.map +1 -1
  124. package/dist/esm/assertion/impl/async.js +2 -2
  125. package/dist/esm/assertion/impl/async.js.map +1 -1
  126. package/dist/esm/assertion/impl/sync-basic.d.ts.map +1 -1
  127. package/dist/esm/assertion/impl/sync-basic.js +6 -4
  128. package/dist/esm/assertion/impl/sync-basic.js.map +1 -1
  129. package/dist/esm/assertion/impl/sync-collection.d.ts.map +1 -1
  130. package/dist/esm/assertion/impl/sync-collection.js +24 -14
  131. package/dist/esm/assertion/impl/sync-collection.js.map +1 -1
  132. package/dist/esm/assertion/impl/sync-esoteric.d.ts +1 -5
  133. package/dist/esm/assertion/impl/sync-esoteric.d.ts.map +1 -1
  134. package/dist/esm/assertion/impl/sync-esoteric.js +11 -13
  135. package/dist/esm/assertion/impl/sync-esoteric.js.map +1 -1
  136. package/dist/esm/assertion/impl/sync-parametric.d.ts +27 -7
  137. package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
  138. package/dist/esm/assertion/impl/sync-parametric.js +75 -51
  139. package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
  140. package/dist/esm/assertion/impl/sync.d.ts +54 -22
  141. package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
  142. package/dist/esm/assertion/impl/sync.js +2 -2
  143. package/dist/esm/assertion/impl/sync.js.map +1 -1
  144. package/dist/esm/assertion/index.d.ts +1 -1
  145. package/dist/esm/assertion/index.d.ts.map +1 -1
  146. package/dist/esm/assertion/index.js +0 -1
  147. package/dist/esm/assertion/index.js.map +1 -1
  148. package/dist/esm/assertion/slotify.d.ts +1 -13
  149. package/dist/esm/assertion/slotify.d.ts.map +1 -1
  150. package/dist/esm/assertion/slotify.js +50 -17
  151. package/dist/esm/assertion/slotify.js.map +1 -1
  152. package/dist/esm/bootstrap.d.ts +85 -17
  153. package/dist/esm/bootstrap.d.ts.map +1 -1
  154. package/dist/esm/bootstrap.js +1 -0
  155. package/dist/esm/bootstrap.js.map +1 -1
  156. package/dist/esm/diff.d.ts +51 -0
  157. package/dist/esm/diff.d.ts.map +1 -0
  158. package/dist/esm/diff.js +273 -0
  159. package/dist/esm/diff.js.map +1 -0
  160. package/dist/esm/error.d.ts +37 -18
  161. package/dist/esm/error.d.ts.map +1 -1
  162. package/dist/esm/error.js +41 -27
  163. package/dist/esm/error.js.map +1 -1
  164. package/dist/esm/expect.d.ts.map +1 -1
  165. package/dist/esm/expect.js +133 -80
  166. package/dist/esm/expect.js.map +1 -1
  167. package/dist/esm/guards.d.ts +24 -10
  168. package/dist/esm/guards.d.ts.map +1 -1
  169. package/dist/esm/guards.js +52 -36
  170. package/dist/esm/guards.js.map +1 -1
  171. package/dist/esm/index.d.ts +85 -17
  172. package/dist/esm/index.d.ts.map +1 -1
  173. package/dist/esm/internal-schema.d.ts +25 -0
  174. package/dist/esm/internal-schema.d.ts.map +1 -0
  175. package/dist/esm/internal-schema.js +203 -0
  176. package/dist/esm/internal-schema.js.map +1 -0
  177. package/dist/esm/schema.d.ts.map +1 -1
  178. package/dist/esm/schema.js +3 -2
  179. package/dist/esm/schema.js.map +1 -1
  180. package/dist/esm/use.js +19 -6
  181. package/dist/esm/use.js.map +1 -1
  182. package/dist/esm/util.d.ts +1 -0
  183. package/dist/esm/util.d.ts.map +1 -1
  184. package/dist/esm/util.js +14 -10
  185. package/dist/esm/util.js.map +1 -1
  186. package/dist/esm/value-to-schema.d.ts +1 -0
  187. package/dist/esm/value-to-schema.d.ts.map +1 -1
  188. package/dist/esm/value-to-schema.js +20 -13
  189. package/dist/esm/value-to-schema.js.map +1 -1
  190. package/package.json +29 -11
  191. package/src/assertion/assertion-async.ts +42 -14
  192. package/src/assertion/assertion-sync.ts +40 -17
  193. package/src/assertion/assertion-types.ts +55 -45
  194. package/src/assertion/assertion.ts +49 -32
  195. package/src/assertion/create.ts +46 -65
  196. package/src/assertion/impl/assertion-util.ts +31 -18
  197. package/src/assertion/impl/async-parametric.ts +93 -52
  198. package/src/assertion/impl/async.ts +2 -2
  199. package/src/assertion/impl/sync-basic.ts +7 -4
  200. package/src/assertion/impl/sync-collection.ts +34 -14
  201. package/src/assertion/impl/sync-esoteric.ts +17 -13
  202. package/src/assertion/impl/sync-parametric.ts +79 -52
  203. package/src/assertion/impl/sync.ts +2 -2
  204. package/src/assertion/index.ts +1 -1
  205. package/src/assertion/slotify.ts +67 -21
  206. package/src/bootstrap.ts +1 -0
  207. package/src/diff.ts +343 -0
  208. package/src/error.ts +66 -31
  209. package/src/expect.ts +195 -129
  210. package/src/guards.ts +74 -48
  211. package/src/internal-schema.ts +246 -0
  212. package/src/schema.ts +4 -2
  213. package/src/use.ts +21 -7
  214. package/src/util.ts +15 -12
  215. package/src/value-to-schema.ts +21 -13
@@ -19,9 +19,12 @@ const slug_1 = __importDefault(require("slug"));
19
19
  const util_1 = require("util");
20
20
  const v4_1 = require("zod/v4");
21
21
  const constant_js_1 = require("../constant.js");
22
+ const diff_js_1 = require("../diff.js");
22
23
  const error_js_1 = require("../error.js");
23
24
  const metadata_js_1 = require("../metadata.js");
24
25
  const debug = (0, debug_1.default)('bupkis:assertion');
26
+ const { hasOwn, keys } = Object;
27
+ const { isArray } = Array;
25
28
  /**
26
29
  * Modified charmap for {@link slug} to use underscores to replace hyphens (`-`;
27
30
  * and for hyphens to replace everything else that needs replacing) and `<` with
@@ -56,6 +59,14 @@ class BupkisAssertion {
56
59
  * @returns String representation
57
60
  */
58
61
  toString() {
62
+ /**
63
+ * Expands a Zod type into a human-readable string representation.
64
+ *
65
+ * @function
66
+ * @param zodType The Zod type to expand
67
+ * @param wrapCurlies Whether to wrap the result in curly braces
68
+ * @returns String representation of the Zod type
69
+ */
59
70
  const expand = (zodType, wrapCurlies = false) => {
60
71
  const def = 'def' in zodType ? zodType.def : zodType._zod.def;
61
72
  let repr = '';
@@ -84,7 +95,7 @@ class BupkisAssertion {
84
95
  repr = `{${expand(def.innerType)}}`;
85
96
  break;
86
97
  case 'enum':
87
- repr = `${Object.keys(def.entries).join(' / ')}`;
98
+ repr = `${keys(def.entries).join(' / ')}`;
88
99
  break;
89
100
  case 'intersection':
90
101
  repr = `${expand(def.left)} & ${expand(def.right)}`;
@@ -128,24 +139,11 @@ class BupkisAssertion {
128
139
  return wrapCurlies ? `{${repr}}` : repr;
129
140
  };
130
141
  return `"${this.slots
131
- .map((slot) => Object.hasOwn(metadata_js_1.BupkisRegistry.get(slot) ?? {}, constant_js_1.kStringLiteral)
142
+ .map((slot) => hasOwn(metadata_js_1.BupkisRegistry.get(slot) ?? {}, constant_js_1.kStringLiteral)
132
143
  ? expand(slot)
133
144
  : expand(slot, true))
134
145
  .join(' ')}"`;
135
146
  }
136
- /**
137
- * Translates a {@link z.ZodError} into an {@link AssertionError} with a
138
- * human-friendly message.
139
- *
140
- * @remarks
141
- * This does not handle parameterized assertions with more than one parameter
142
- * too cleanly; it's unclear how a test runner would display the expected
143
- * values. This will probably need a fix in the future.
144
- * @param stackStartFn The function to start the stack trace from
145
- * @param zodError The original `ZodError`
146
- * @param values Values which caused the error
147
- * @returns New `AssertionError`
148
- */
149
147
  /**
150
148
  * Translates a {@link z.ZodError} into an {@link AssertionError} with a
151
149
  * human-friendly message.
@@ -160,19 +158,36 @@ class BupkisAssertion {
160
158
  * @returns New `AssertionError`
161
159
  */
162
160
  fromZodError(zodError, stackStartFn, values) {
163
- const flat = v4_1.z.flattenError(zodError);
164
- let pretty = flat.formErrors.join('; ');
165
- for (const [keypath, errors] of Object.entries(flat.fieldErrors)) {
166
- pretty += `; ${keypath}: ${errors.join('; ')}`;
161
+ const subject = isArray(values) ? values[0] : values;
162
+ const { actual, expected } = (0, diff_js_1.extractDiffValues)(zodError, subject);
163
+ // Only use custom message if we could extract diff values
164
+ if ((0, diff_js_1.shouldGenerateDiff)(actual, expected)) {
165
+ // Use jest-diff to generate rich, colored diff output
166
+ const diffOutput = (0, diff_js_1.generateDiff)(expected, actual, {
167
+ aAnnotation: 'expected',
168
+ bAnnotation: 'actual',
169
+ expand: false,
170
+ includeChangeCounts: true,
171
+ });
172
+ const message = diffOutput
173
+ ? `Assertion ${this} failed:\n${diffOutput}`
174
+ : `Assertion ${this} failed: values are not equal`;
175
+ return new error_js_1.AssertionError({
176
+ actual,
177
+ expected,
178
+ message,
179
+ stackStartFn,
180
+ });
181
+ }
182
+ else {
183
+ // Fall back to Zod's prettified error message
184
+ const pretty = v4_1.z.prettifyError(zodError).slice(2);
185
+ return new error_js_1.AssertionError({
186
+ actual: subject,
187
+ message: `Assertion ${this} failed:\n${pretty}`,
188
+ stackStartFn,
189
+ });
167
190
  }
168
- const [actual, ...expected] = values;
169
- return new error_js_1.AssertionError({
170
- actual,
171
- expected: expected.length === 1 ? expected[0] : expected,
172
- message: `Assertion ${this} failed: ${pretty}`,
173
- operator: `${this}`,
174
- stackStartFn,
175
- });
176
191
  }
177
192
  maybeParseValuesArgMismatch(args) {
178
193
  if (this.slots.length !== args.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"assertion.js","sourceRoot":"","sources":["../../../src/assertion/assertion.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAEH,kDAAgC;AAChC,gDAAwB;AAExB,+BAA+B;AAC/B,+BAA2B;AAE3B,gDAAgD;AAChD,0CAAmE;AACnE,gDAAgD;AAWhD,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,kBAAkB,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,EAAE,GAAG,cAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAEtE;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAI,OAAO,EAGjD,CAAC;AAEJ;;GAEG;AACH,MAAsB,eAAe;IASxB;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,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,QAAQ;QACb,OAAO,iCAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,MAAM,MAAM,GAAG,CACb,OAAoC,EACpC,WAAW,GAAG,KAAK,EACX,EAAE;YACV,MAAM,GAAG,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAA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O,CAAC,QAAQ,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;oBACnC,OAAO;wBACL,OAAO,EAAE,KAAK;qBACf,CAAC;gBACJ,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,oBAAoB;gBACpB,MAAM,IAAI,+BAAoB,CAC5B,6BAA6B,SAAS,eAAe,IAAA,cAAO,EAAC,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,IAAA,cAAI,EAAC,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;AA1PD,0CA0PC"}
@@ -69,6 +69,7 @@ import { type CreateAssertionFn, type CreateAsyncAssertionFn } from './assertion
69
69
  /**
70
70
  * {@inheritDoc CreateAssertionFn}
71
71
  *
72
+ * @function
72
73
  * @throws {TypeError} Invalid assertion implementation type
73
74
  * @group Assertion Creation
74
75
  */
@@ -76,6 +77,7 @@ export declare const createAssertion: CreateAssertionFn;
76
77
  /**
77
78
  * {@inheritDoc CreateAsyncAssertionFn}
78
79
  *
80
+ * @function
79
81
  * @throws {TypeError} Invalid assertion implementation type
80
82
  * @group Assertion Creation
81
83
  */
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/assertion/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAqBH,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAI9B;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,iBA6D7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,sBAsDlC,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/assertion/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AA0BH,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAI9B;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,iBA0C7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,sBAgDlC,CAAC"}
@@ -71,90 +71,86 @@ exports.createAsyncAssertion = exports.createAssertion = void 0;
71
71
  const v4_1 = require("zod/v4");
72
72
  const error_js_1 = require("../error.js");
73
73
  const guards_js_1 = require("../guards.js");
74
+ const internal_schema_js_1 = require("../internal-schema.js");
74
75
  const assertion_async_js_1 = require("./assertion-async.js");
75
76
  const assertion_sync_js_1 = require("./assertion-sync.js");
76
- const assertion_types_js_1 = require("./assertion-types.js");
77
77
  const assertion_js_1 = require("./assertion.js");
78
78
  const slotify_js_1 = require("./slotify.js");
79
79
  /**
80
80
  * {@inheritDoc CreateAssertionFn}
81
81
  *
82
+ * @function
82
83
  * @throws {TypeError} Invalid assertion implementation type
83
84
  * @group Assertion Creation
84
85
  */
85
86
  const createAssertion = (parts, impl, metadata) => {
86
- if (!Array.isArray(parts)) {
87
- throw new error_js_1.AssertionImplementationError('First parameter must be an array');
88
- }
89
- if (parts.length === 0) {
90
- throw new error_js_1.AssertionImplementationError('At least one value is required for an assertion');
91
- }
92
- if (!parts.every((part) => (0, guards_js_1.isString)(part) || Array.isArray(part) || (0, guards_js_1.isZodType)(part))) {
93
- throw new error_js_1.AssertionImplementationError('All assertion parts must be strings or Zod schemas');
94
- }
95
- if (!impl) {
96
- throw new error_js_1.AssertionImplementationError('An assertion implementation is required');
97
- }
87
+ // Validate inputs using Zod schema
98
88
  try {
99
- const slots = (0, slotify_js_1.slotify)(parts);
100
- if ((0, guards_js_1.isZodType)(impl)) {
101
- const assertion = new assertion_sync_js_1.BupkisAssertionSchemaSync(parts, slots, impl);
102
- if (metadata) {
103
- assertion_js_1.AssertionMetadataRegistry.set(assertion, metadata);
104
- }
105
- return assertion;
106
- }
107
- else if ((0, guards_js_1.isFunction)(impl)) {
108
- const assertion = new assertion_sync_js_1.BupkisAssertionFunctionSync(parts, slots, impl);
109
- if (metadata) {
110
- assertion_js_1.AssertionMetadataRegistry.set(assertion, metadata);
111
- }
112
- return assertion;
113
- }
89
+ internal_schema_js_1.CreateAssertionInputSchema.parse([parts, impl, metadata]);
114
90
  }
115
91
  catch (err) {
116
92
  if (err instanceof v4_1.z.ZodError) {
117
- throw new error_js_1.AssertionImplementationError(`Failed to slotify assertion parts: ${v4_1.z.prettifyError(err)}`, { cause: err });
93
+ throw new error_js_1.AssertionImplementationError(`Invalid input parameters: ${v4_1.z.prettifyError(err)}`, { cause: err });
118
94
  }
119
- throw new error_js_1.AssertionImplementationError(`Failed to slotify assertion parts: ${err}`, { cause: err });
95
+ /* c8 ignore next */
96
+ throw err;
97
+ }
98
+ const slots = (0, slotify_js_1.slotify)(parts);
99
+ if ((0, guards_js_1.isZodType)(impl)) {
100
+ const assertion = new assertion_sync_js_1.BupkisAssertionSchemaSync(parts, slots, impl);
101
+ if (metadata) {
102
+ assertion_js_1.AssertionMetadataRegistry.set(assertion, metadata);
103
+ }
104
+ return assertion;
120
105
  }
106
+ else if ((0, guards_js_1.isFunction)(impl)) {
107
+ const assertion = new assertion_sync_js_1.BupkisAssertionFunctionSync(parts, slots, impl);
108
+ if (metadata) {
109
+ assertion_js_1.AssertionMetadataRegistry.set(assertion, metadata);
110
+ }
111
+ return assertion;
112
+ }
113
+ // should be impossible if CreateAssertionInputSchema is correct
114
+ /* c8 ignore next */
121
115
  throw new error_js_1.AssertionImplementationError('Assertion implementation must be a function, Zod schema or Zod schema factory');
122
116
  };
123
117
  exports.createAssertion = createAssertion;
124
118
  /**
125
119
  * {@inheritDoc CreateAsyncAssertionFn}
126
120
  *
121
+ * @function
127
122
  * @throws {TypeError} Invalid assertion implementation type
128
123
  * @group Assertion Creation
129
124
  */
130
125
  const createAsyncAssertion = (parts, impl, metadata) => {
131
- if (!Array.isArray(parts)) {
132
- throw new error_js_1.AssertionImplementationError('First parameter must be an array');
133
- }
134
- if (parts.length === 0) {
135
- throw new error_js_1.AssertionImplementationError('At least one value is required for an assertion');
136
- }
137
- if (!parts.every((part) => (0, guards_js_1.isString)(part) || Array.isArray(part) || (0, guards_js_1.isZodType)(part))) {
138
- throw new error_js_1.AssertionImplementationError('All assertion parts must be strings or Zod schemas');
126
+ // Validate inputs using Zod schema
127
+ try {
128
+ internal_schema_js_1.CreateAssertionInputSchemaAsync.parse([parts, impl, metadata]);
139
129
  }
140
- if (!impl) {
141
- throw new error_js_1.AssertionImplementationError('An assertion implementation is required');
130
+ catch (err) {
131
+ if (err instanceof v4_1.z.ZodError) {
132
+ throw new error_js_1.AssertionImplementationError(`Invalid input parameters: ${v4_1.z.prettifyError(err)}`, { cause: err });
133
+ }
134
+ /* c8 ignore next */
135
+ throw err;
142
136
  }
143
137
  const slots = (0, slotify_js_1.slotify)(parts);
144
138
  if ((0, guards_js_1.isZodType)(impl)) {
145
139
  const assertion = new assertion_async_js_1.BupkisAssertionSchemaAsync(parts, slots, impl);
146
140
  if (metadata) {
147
- assertion_js_1.AssertionMetadataRegistry.set(assertion, assertion_types_js_1.AssertionMetadataSchema.parse(metadata));
141
+ assertion_js_1.AssertionMetadataRegistry.set(assertion, internal_schema_js_1.AssertionMetadataSchema.parse(metadata));
148
142
  }
149
143
  return assertion;
150
144
  }
151
145
  else if ((0, guards_js_1.isFunction)(impl)) {
152
146
  const assertion = new assertion_async_js_1.BupkisAssertionFunctionAsync(parts, slots, impl);
153
147
  if (metadata) {
154
- assertion_js_1.AssertionMetadataRegistry.set(assertion, assertion_types_js_1.AssertionMetadataSchema.parse(metadata));
148
+ assertion_js_1.AssertionMetadataRegistry.set(assertion, internal_schema_js_1.AssertionMetadataSchema.parse(metadata));
155
149
  }
156
150
  return assertion;
157
151
  }
152
+ // should be impossible if CreateAssertionInputSchemaAsync is correct
153
+ /* c8 ignore next */
158
154
  throw new error_js_1.AssertionImplementationError('Assertion implementation must be a function, Zod schema or Zod schema factory');
159
155
  };
160
156
  exports.createAsyncAssertion = createAsyncAssertion;
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/assertion/create.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;;;AAEH,+BAA2B;AAS3B,0CAA2D;AAC3D,4CAA+D;AAC/D,6DAG8B;AAC9B,2DAG6B;AAC7B,6DAI8B;AAC9B,iDAA2D;AAC3D,6CAAuC;AAEvC;;;;;GAKG;AACI,MAAM,eAAe,GAAsB,CAIhD,KAAY,EACZ,IAAU,EACV,QAA4B,EAC5B,EAAE;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,uCAA4B,CAAC,kCAAkC,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,uCAA4B,CACpC,iDAAiD,CAClD,CAAC;IACJ,CAAC;IACD,IACE,CAAC,KAAK,CAAC,KAAK,CACV,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,oBAAQ,EAAC,IA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AAK,GAAG,IAAA,oBAAO,EAAQ,KAAK,CAAC,CAAC;IAEpC,IAAI,IAAA,qBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,SAAS,GAAG,IAAI,+CAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACrE,IAAI,QAAQ,EAAE,CAAC;YACb,wCAAyB,CAAC,GAAG,CAC3B,SAAS,EACT,4CAAuB,CAAC,KAAK,CAAC,QAAQ,CAAC,CACxC,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,IAAA,sBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,IAAI,iDAA4B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACvE,IAAI,QAAQ,EAAE,CAAC;YACb,wCAAyB,CAAC,GAAG,CAC3B,SAAS,EACT,4CAAuB,CAAC,KAAK,CAAC,QAAQ,CAAC,CACxC,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,qEAAqE;IACrE,oBAAoB;IACpB,MAAM,IAAI,uCAA4B,CACpC,+EAA+E,CAChF,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,oBAAoB,wBAgD/B"}
@@ -4,21 +4,33 @@
4
4
  * @internal
5
5
  * @packageDocumentation
6
6
  */
7
+ /**
8
+ * Executes & traps a `Promise` rejected from an async function, capturing the
9
+ * error.
10
+ *
11
+ * @function
12
+ * @param fn The function to execute that may throw an error or return a
13
+ * `Promise`
14
+ * @returns Rejection or whatever was fulfilled
15
+ */
16
+ export declare const trapAsyncFnError: (fn: () => unknown) => Promise<TrapResult>;
7
17
  /**
8
18
  * Awaits & traps a Promise, capturing any rejection error.
9
19
  *
20
+ * @function
10
21
  * @param promise The `Promise` to trap
11
- * @returns Rejection
22
+ * @returns Result object
12
23
  */
13
- export declare const trapPromiseError: (promise: PromiseLike<unknown>) => Promise<unknown>;
24
+ export declare const trapPromiseError: (promise: PromiseLike<unknown>) => Promise<TrapResult>;
14
25
  /**
15
26
  * Executes & traps a synchronous function that may throw, capturing any thrown
16
27
  * error and discarding the result.
17
28
  *
18
29
  * @remarks
19
30
  * Avoids throwing `undefined` for some reason.
31
+ * @function
20
32
  * @param fn Function to execute
21
- * @returns Error
33
+ * @returns Result object
22
34
  */
23
- export declare const trapError: (fn: () => unknown) => unknown;
35
+ export declare const trapError: (fn: () => unknown) => TrapResult;
24
36
  //# sourceMappingURL=assertion-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertion-util.d.ts","sourceRoot":"","sources":["../../../../src/assertion/impl/assertion-util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAU,SAAS,WAAW,CAAC,OAAO,CAAC,qBAMnE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,OAAO,KAAG,OAS7C,CAAC"}
1
+ {"version":3,"file":"assertion-util.d.ts","sourceRoot":"","sources":["../../../../src/assertion/impl/assertion-util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAC3B,IAAI,MAAM,OAAO,KAChB,OAAO,CAAC,UAAU,CASpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,WAAW,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC,UAAU,CAOpB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,OAAO,KAAG,UAO7C,CAAC"}
@@ -11,31 +11,37 @@ exports.trapError = exports.trapPromiseError = exports.trapAsyncFnError = void 0
11
11
  * Executes & traps a `Promise` rejected from an async function, capturing the
12
12
  * error.
13
13
  *
14
+ * @function
14
15
  * @param fn The function to execute that may throw an error or return a
15
16
  * `Promise`
16
- * @returns Rejection
17
+ * @returns Rejection or whatever was fulfilled
17
18
  */
18
19
  const trapAsyncFnError = async (fn) => {
19
20
  try {
20
- await fn();
21
+ const result = await fn();
22
+ return { result };
21
23
  }
22
- catch (err) {
23
- return err;
24
+ catch (error) {
25
+ return {
26
+ error: error ?? new TypeError(`Function rejected with undefined: ${fn}`),
27
+ };
24
28
  }
25
29
  };
26
30
  exports.trapAsyncFnError = trapAsyncFnError;
27
31
  /**
28
32
  * Awaits & traps a Promise, capturing any rejection error.
29
33
  *
34
+ * @function
30
35
  * @param promise The `Promise` to trap
31
- * @returns Rejection
36
+ * @returns Result object
32
37
  */
33
38
  const trapPromiseError = async (promise) => {
34
39
  try {
35
- await promise;
40
+ const result = await promise;
41
+ return { result };
36
42
  }
37
- catch (err) {
38
- return err;
43
+ catch (error) {
44
+ return { error: error ?? new TypeError('Promise rejected with undefined') };
39
45
  }
40
46
  };
41
47
  exports.trapPromiseError = trapPromiseError;
@@ -45,18 +51,17 @@ exports.trapPromiseError = trapPromiseError;
45
51
  *
46
52
  * @remarks
47
53
  * Avoids throwing `undefined` for some reason.
54
+ * @function
48
55
  * @param fn Function to execute
49
- * @returns Error
56
+ * @returns Result object
50
57
  */
51
58
  const trapError = (fn) => {
52
59
  try {
53
- fn();
60
+ const result = fn();
61
+ return { result };
54
62
  }
55
- catch (err) {
56
- if (err === undefined) {
57
- return new Error('Function threw undefined');
58
- }
59
- return err;
63
+ catch (error) {
64
+ return { error: error ?? new TypeError(`Function threw undefined: ${fn}`) };
60
65
  }
61
66
  };
62
67
  exports.trapError = trapError;
@@ -1 +1 @@
1
- {"version":3,"file":"assertion-util.js","sourceRoot":"","sources":["../../../../src/assertion/impl/assertion-util.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;;;GAOG;AACI,MAAM,gBAAgB,GAAG,KAAK,EAAE,EAAiB,EAAE,EAAE;IAC1D,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,CAAC;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B;AAEF;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,KAAK,EAAE,OAA6B,EAAE,EAAE;IACtE,IAAI,CAAC;QACH,MAAM,OAAO,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B;AAEF;;;;;;;;GAQG;AACI,MAAM,SAAS,GAAG,CAAC,EAAiB,EAAW,EAAE;IACtD,IAAI,CAAC;QACH,EAAE,EAAE,CAAC;IACP,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC;AATW,QAAA,SAAS,aASpB"}
1
+ {"version":3,"file":"assertion-util.js","sourceRoot":"","sources":["../../../../src/assertion/impl/assertion-util.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAMH;;;;;;;;GAQG;AACI,MAAM,gBAAgB,GAAG,KAAK,EACnC,EAAiB,EACI,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,KAAK,EAAE,KAAK,IAAI,IAAI,SAAS,CAAC,qCAAqC,EAAE,EAAE,CAAC;SACzE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,gBAAgB,oBAW3B;AAEF;;;;;;GAMG;AACI,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAA6B,EACR,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;QAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,IAAI,SAAS,CAAC,iCAAiC,CAAC,EAAE,CAAC;IAC9E,CAAC;AACH,CAAC,CAAC;AATW,QAAA,gBAAgB,oBAS3B;AAEF;;;;;;;;;GASG;AACI,MAAM,SAAS,GAAG,CAAC,EAAiB,EAAc,EAAE;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,EAAE,EAAE,CAAC;QACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,IAAI,SAAS,CAAC,6BAA6B,EAAE,EAAE,CAAC,EAAE,CAAC;IAC9E,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB"}
@@ -101,7 +101,17 @@ export declare const promiseRejectAssertion: import("../assertion-types.js").Ass
101
101
  *
102
102
  * @group Parametric Assertions (Async)
103
103
  */
104
- export declare const functionRejectWithTypeAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, readonly ["to reject with a", "to reject with an"], z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>], (subject: (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, ctor: import("../../types.js").Constructor) => Promise<boolean>, readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with a", "to reject with an"]>, z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>]>;
104
+ export declare const functionRejectWithTypeAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, readonly ["to reject with a", "to reject with an"], z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>], (subject: (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, ctor: import("../../types.js").Constructor) => Promise<{
105
+ actual: string;
106
+ expect: string;
107
+ message: string;
108
+ expected?: never;
109
+ } | {
110
+ actual: string;
111
+ expected: string;
112
+ message: string;
113
+ expect?: never;
114
+ } | undefined>, readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with a", "to reject with an"]>, z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>]>;
105
115
  /**
106
116
  * Assertion for testing if a Promise rejects with a specific error type.
107
117
  *
@@ -122,7 +132,17 @@ export declare const functionRejectWithTypeAssertion: import("../assertion-types
122
132
  *
123
133
  * @group Parametric Assertions (Async)
124
134
  */
125
- export declare const promiseRejectWithTypeAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, readonly ["to reject with a", "to reject with an"], z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>], (subject: PromiseLike<unknown>, ctor: import("../../types.js").Constructor) => Promise<boolean>, readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with a", "to reject with an"]>, z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>]>;
135
+ export declare const promiseRejectWithTypeAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, readonly ["to reject with a", "to reject with an"], z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>], (subject: PromiseLike<unknown>, ctor: import("../../types.js").Constructor) => Promise<{
136
+ actual: string;
137
+ expect: string;
138
+ message: string;
139
+ expected?: never;
140
+ } | {
141
+ actual: string;
142
+ expected: string;
143
+ message: string;
144
+ expect?: never;
145
+ } | undefined>, readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with a", "to reject with an"]>, z.ZodCustom<import("../../types.js").Constructor, import("../../types.js").Constructor>]>;
126
146
  /**
127
147
  * Assertion for testing if a function rejects with an error satisfying specific
128
148
  * criteria.
@@ -149,11 +169,19 @@ export declare const promiseRejectWithTypeAssertion: import("../assertion-types.
149
169
  *
150
170
  * @group Parametric Assertions (Async)
151
171
  */
152
- export declare const functionRejectWithErrorSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, readonly ["to reject with error satisfying"], z.ZodAny], (subject: (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, param: any) => Promise<z.ZodError<unknown> | {
172
+ export declare const functionRejectWithErrorSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, readonly ["to reject with error satisfying"], z.ZodAny], (subject: (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, param: any) => Promise<{
153
173
  actual: string;
154
174
  expect: string;
155
175
  message: string;
156
- } | undefined>, readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with error satisfying"]>, z.ZodAny]>;
176
+ schema?: never;
177
+ subject?: never;
178
+ } | {
179
+ schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
180
+ subject: {} | null;
181
+ actual?: never;
182
+ expect?: never;
183
+ message?: never;
184
+ }>, readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with error satisfying"]>, z.ZodAny]>;
157
185
  /**
158
186
  * Assertion for testing if a Promise rejects with an error satisfying specific
159
187
  * criteria.
@@ -180,11 +208,19 @@ export declare const functionRejectWithErrorSatisfyingAssertion: import("../asse
180
208
  *
181
209
  * @group Parametric Assertions (Async)
182
210
  */
183
- export declare const promiseRejectWithErrorSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, readonly ["to reject with error satisfying"], z.ZodAny], (subject: PromiseLike<unknown>, param: any) => Promise<z.ZodError<unknown> | {
211
+ export declare const promiseRejectWithErrorSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, readonly ["to reject with error satisfying"], z.ZodAny], (subject: PromiseLike<unknown>, param: any) => Promise<{
184
212
  actual: string;
185
213
  expect: string;
186
214
  message: string;
187
- } | undefined>, readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with error satisfying"]>, z.ZodAny]>;
215
+ schema?: never;
216
+ subject?: never;
217
+ } | {
218
+ schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
219
+ subject: {} | null;
220
+ actual?: never;
221
+ expect?: never;
222
+ message?: never;
223
+ }>, readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to reject with error satisfying"]>, z.ZodAny]>;
188
224
  /**
189
225
  * Assertion for testing if a Promise fulfills with a value satisfying specific
190
226
  * criteria.
@@ -211,11 +247,19 @@ export declare const promiseRejectWithErrorSatisfyingAssertion: import("../asser
211
247
  *
212
248
  * @group Parametric Assertions (Async)
213
249
  */
214
- export declare const promiseFulfillWithValueSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, readonly ["to fulfill with value satisfying", "to resolve with value satisfying"], z.ZodAny], (promise: PromiseLike<unknown>, param: any) => Promise<z.ZodError<any> | {
215
- actual: unknown;
250
+ export declare const promiseResolveWithValueSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, readonly ["to fulfill with value satisfying", "to resolve with value satisfying"], z.ZodAny], (promise: PromiseLike<unknown>, param: any) => Promise<{
251
+ actual: string;
216
252
  expect: string;
217
253
  message: string;
218
- } | undefined>, readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to fulfill with value satisfying", "to resolve with value satisfying"]>, z.ZodAny]>;
254
+ schema?: never;
255
+ subject?: never;
256
+ } | {
257
+ schema: z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>;
258
+ subject: unknown;
259
+ actual?: never;
260
+ expect?: never;
261
+ message?: never;
262
+ }>, readonly [z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to fulfill with value satisfying", "to resolve with value satisfying"]>, z.ZodAny]>;
219
263
  /**
220
264
  * Assertion for testing if a function returns a Promise that fulfills with a
221
265
  * value satisfying specific criteria.
@@ -242,9 +286,17 @@ export declare const promiseFulfillWithValueSatisfyingAssertion: import("../asse
242
286
  *
243
287
  * @group Parametric Assertions (Async)
244
288
  */
245
- export declare const functionFulfillWithValueSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, readonly ["to fulfill with value satisfying", "to resolve with value satisfying"], z.ZodAny], (subject: (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, param: any) => Promise<z.ZodError<any> | {
289
+ export declare const functionFulfillWithValueSatisfyingAssertion: import("../assertion-types.js").AssertionFunctionAsync<readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, readonly ["to fulfill with value satisfying", "to resolve with value satisfying"], z.ZodAny], (subject: (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, param: any) => Promise<{
246
290
  actual: string;
247
291
  expect: string;
248
292
  message: string;
249
- } | undefined>, readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to fulfill with value satisfying", "to resolve with value satisfying"]>, z.ZodAny]>;
293
+ schema?: never;
294
+ subject?: never;
295
+ } | {
296
+ schema: z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>;
297
+ subject: unknown;
298
+ actual?: never;
299
+ expect?: never;
300
+ message?: never;
301
+ }>, readonly [z.ZodCustom<(...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("../../types.js").MutableOrReadonly<unknown[]>) => unknown>, import("../assertion-types.js").PhraseLiteralChoiceSlot<readonly ["to fulfill with value satisfying", "to resolve with value satisfying"]>, z.ZodAny]>;
250
302
  //# sourceMappingURL=async-parametric.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"async-parametric.d.ts","sourceRoot":"","sources":["../../../../src/assertion/impl/async-parametric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAgB3B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB;;;;iSAiBpC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;mLAanC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;iQAYnC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;;;;mJAYlC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,+BAA+B,u4BAa3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,8BAA8B,onBAa1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,0CAA0C;;;;kTA0CtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,yCAAyC;;;;oMAyCrD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,0CAA0C;;;;yOA0BtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,2CAA2C;;;;uVA0BvD,CAAC"}
1
+ {"version":3,"file":"async-parametric.d.ts","sourceRoot":"","sources":["../../../../src/assertion/impl/async-parametric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAgB3B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB;;;;iSAiBpC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;mLAiBnC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,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