bupkis 0.1.2 → 0.3.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 (198) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +16 -16
  3. package/dist/commonjs/assertion/assertion-async.d.ts +2 -1
  4. package/dist/commonjs/assertion/assertion-async.d.ts.map +1 -1
  5. package/dist/commonjs/assertion/assertion-async.js +84 -2
  6. package/dist/commonjs/assertion/assertion-async.js.map +1 -1
  7. package/dist/commonjs/assertion/assertion-sync.d.ts +1 -1
  8. package/dist/commonjs/assertion/assertion-sync.d.ts.map +1 -1
  9. package/dist/commonjs/assertion/assertion-sync.js +5 -1
  10. package/dist/commonjs/assertion/assertion-sync.js.map +1 -1
  11. package/dist/commonjs/assertion/assertion-types.d.ts +39 -84
  12. package/dist/commonjs/assertion/assertion-types.d.ts.map +1 -1
  13. package/dist/commonjs/assertion/assertion.d.ts +1 -1
  14. package/dist/commonjs/assertion/assertion.d.ts.map +1 -1
  15. package/dist/commonjs/assertion/assertion.js +1 -14
  16. package/dist/commonjs/assertion/assertion.js.map +1 -1
  17. package/dist/commonjs/assertion/create.d.ts +5 -33
  18. package/dist/commonjs/assertion/create.d.ts.map +1 -1
  19. package/dist/commonjs/assertion/create.js +17 -6
  20. package/dist/commonjs/assertion/create.js.map +1 -1
  21. package/dist/commonjs/assertion/impl/async.d.ts +122 -21
  22. package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
  23. package/dist/commonjs/assertion/impl/async.js +114 -90
  24. package/dist/commonjs/assertion/impl/async.js.map +1 -1
  25. package/dist/commonjs/assertion/impl/callback.d.ts +104 -0
  26. package/dist/commonjs/assertion/impl/callback.d.ts.map +1 -0
  27. package/dist/commonjs/assertion/impl/callback.js +694 -0
  28. package/dist/commonjs/assertion/impl/callback.js.map +1 -0
  29. package/dist/commonjs/assertion/impl/index.d.ts +1 -1
  30. package/dist/commonjs/assertion/impl/index.d.ts.map +1 -1
  31. package/dist/commonjs/assertion/impl/index.js.map +1 -1
  32. package/dist/commonjs/assertion/impl/sync-esoteric.js +1 -1
  33. package/dist/commonjs/assertion/impl/sync-esoteric.js.map +1 -1
  34. package/dist/commonjs/assertion/impl/sync-parametric.d.ts +37 -34
  35. package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
  36. package/dist/commonjs/assertion/impl/sync-parametric.js +32 -47
  37. package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
  38. package/dist/commonjs/assertion/impl/sync.d.ts +105 -58
  39. package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
  40. package/dist/commonjs/assertion/impl/sync.js +4 -1
  41. package/dist/commonjs/assertion/impl/sync.js.map +1 -1
  42. package/dist/commonjs/bootstrap.d.ts +199 -85
  43. package/dist/commonjs/bootstrap.d.ts.map +1 -1
  44. package/dist/commonjs/bootstrap.js +19 -10
  45. package/dist/commonjs/bootstrap.js.map +1 -1
  46. package/dist/commonjs/constant.js +7 -1
  47. package/dist/commonjs/constant.js.map +1 -1
  48. package/dist/commonjs/error.d.ts +32 -5
  49. package/dist/commonjs/error.d.ts.map +1 -1
  50. package/dist/commonjs/error.js +60 -5
  51. package/dist/commonjs/error.js.map +1 -1
  52. package/dist/commonjs/expect.d.ts +130 -3
  53. package/dist/commonjs/expect.d.ts.map +1 -1
  54. package/dist/commonjs/expect.js +116 -1
  55. package/dist/commonjs/expect.js.map +1 -1
  56. package/dist/commonjs/guards.d.ts +45 -20
  57. package/dist/commonjs/guards.d.ts.map +1 -1
  58. package/dist/commonjs/guards.js +56 -40
  59. package/dist/commonjs/guards.js.map +1 -1
  60. package/dist/commonjs/index.d.ts +241 -86
  61. package/dist/commonjs/index.d.ts.map +1 -1
  62. package/dist/commonjs/index.js +44 -42
  63. package/dist/commonjs/index.js.map +1 -1
  64. package/dist/commonjs/metadata.d.ts +1 -27
  65. package/dist/commonjs/metadata.d.ts.map +1 -1
  66. package/dist/commonjs/metadata.js +16 -15
  67. package/dist/commonjs/metadata.js.map +1 -1
  68. package/dist/commonjs/schema.d.ts +76 -33
  69. package/dist/commonjs/schema.d.ts.map +1 -1
  70. package/dist/commonjs/schema.js +77 -34
  71. package/dist/commonjs/schema.js.map +1 -1
  72. package/dist/commonjs/types.d.ts +480 -39
  73. package/dist/commonjs/types.d.ts.map +1 -1
  74. package/dist/commonjs/types.js +12 -2
  75. package/dist/commonjs/types.js.map +1 -1
  76. package/dist/commonjs/util.d.ts +72 -49
  77. package/dist/commonjs/util.d.ts.map +1 -1
  78. package/dist/commonjs/util.js +175 -155
  79. package/dist/commonjs/util.js.map +1 -1
  80. package/dist/commonjs/value-to-schema.d.ts +122 -0
  81. package/dist/commonjs/value-to-schema.d.ts.map +1 -0
  82. package/dist/commonjs/value-to-schema.js +309 -0
  83. package/dist/commonjs/value-to-schema.js.map +1 -0
  84. package/dist/esm/assertion/assertion-async.d.ts +2 -1
  85. package/dist/esm/assertion/assertion-async.d.ts.map +1 -1
  86. package/dist/esm/assertion/assertion-async.js +85 -3
  87. package/dist/esm/assertion/assertion-async.js.map +1 -1
  88. package/dist/esm/assertion/assertion-sync.d.ts +1 -1
  89. package/dist/esm/assertion/assertion-sync.d.ts.map +1 -1
  90. package/dist/esm/assertion/assertion-sync.js +6 -2
  91. package/dist/esm/assertion/assertion-sync.js.map +1 -1
  92. package/dist/esm/assertion/assertion-types.d.ts +39 -84
  93. package/dist/esm/assertion/assertion-types.d.ts.map +1 -1
  94. package/dist/esm/assertion/assertion.d.ts +1 -1
  95. package/dist/esm/assertion/assertion.d.ts.map +1 -1
  96. package/dist/esm/assertion/assertion.js +1 -14
  97. package/dist/esm/assertion/assertion.js.map +1 -1
  98. package/dist/esm/assertion/create.d.ts +5 -33
  99. package/dist/esm/assertion/create.d.ts.map +1 -1
  100. package/dist/esm/assertion/create.js +14 -4
  101. package/dist/esm/assertion/create.js.map +1 -1
  102. package/dist/esm/assertion/impl/async.d.ts +122 -21
  103. package/dist/esm/assertion/impl/async.d.ts.map +1 -1
  104. package/dist/esm/assertion/impl/async.js +113 -89
  105. package/dist/esm/assertion/impl/async.js.map +1 -1
  106. package/dist/esm/assertion/impl/callback.d.ts +104 -0
  107. package/dist/esm/assertion/impl/callback.d.ts.map +1 -0
  108. package/dist/esm/assertion/impl/callback.js +691 -0
  109. package/dist/esm/assertion/impl/callback.js.map +1 -0
  110. package/dist/esm/assertion/impl/index.d.ts +1 -1
  111. package/dist/esm/assertion/impl/index.d.ts.map +1 -1
  112. package/dist/esm/assertion/impl/index.js +1 -1
  113. package/dist/esm/assertion/impl/index.js.map +1 -1
  114. package/dist/esm/assertion/impl/sync-esoteric.js +2 -2
  115. package/dist/esm/assertion/impl/sync-esoteric.js.map +1 -1
  116. package/dist/esm/assertion/impl/sync-parametric.d.ts +37 -34
  117. package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
  118. package/dist/esm/assertion/impl/sync-parametric.js +32 -47
  119. package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
  120. package/dist/esm/assertion/impl/sync.d.ts +105 -58
  121. package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
  122. package/dist/esm/assertion/impl/sync.js +3 -1
  123. package/dist/esm/assertion/impl/sync.js.map +1 -1
  124. package/dist/esm/bootstrap.d.ts +199 -85
  125. package/dist/esm/bootstrap.d.ts.map +1 -1
  126. package/dist/esm/bootstrap.js +19 -10
  127. package/dist/esm/bootstrap.js.map +1 -1
  128. package/dist/esm/constant.js +6 -0
  129. package/dist/esm/constant.js.map +1 -1
  130. package/dist/esm/error.d.ts +32 -5
  131. package/dist/esm/error.d.ts.map +1 -1
  132. package/dist/esm/error.js +59 -5
  133. package/dist/esm/error.js.map +1 -1
  134. package/dist/esm/expect.d.ts +130 -3
  135. package/dist/esm/expect.d.ts.map +1 -1
  136. package/dist/esm/expect.js +117 -2
  137. package/dist/esm/expect.js.map +1 -1
  138. package/dist/esm/guards.d.ts +45 -20
  139. package/dist/esm/guards.d.ts.map +1 -1
  140. package/dist/esm/guards.js +48 -31
  141. package/dist/esm/guards.js.map +1 -1
  142. package/dist/esm/index.d.ts +241 -86
  143. package/dist/esm/index.d.ts.map +1 -1
  144. package/dist/esm/index.js +46 -7
  145. package/dist/esm/index.js.map +1 -1
  146. package/dist/esm/metadata.d.ts +1 -27
  147. package/dist/esm/metadata.d.ts.map +1 -1
  148. package/dist/esm/metadata.js +2 -1
  149. package/dist/esm/metadata.js.map +1 -1
  150. package/dist/esm/schema.d.ts +76 -33
  151. package/dist/esm/schema.d.ts.map +1 -1
  152. package/dist/esm/schema.js +77 -34
  153. package/dist/esm/schema.js.map +1 -1
  154. package/dist/esm/types.d.ts +480 -39
  155. package/dist/esm/types.d.ts.map +1 -1
  156. package/dist/esm/types.js +12 -2
  157. package/dist/esm/types.js.map +1 -1
  158. package/dist/esm/util.d.ts +72 -49
  159. package/dist/esm/util.d.ts.map +1 -1
  160. package/dist/esm/util.js +159 -153
  161. package/dist/esm/util.js.map +1 -1
  162. package/dist/esm/value-to-schema.d.ts +122 -0
  163. package/dist/esm/value-to-schema.d.ts.map +1 -0
  164. package/dist/esm/value-to-schema.js +305 -0
  165. package/dist/esm/value-to-schema.js.map +1 -0
  166. package/package.json +94 -17
  167. package/src/assertion/assertion-async.ts +113 -3
  168. package/src/assertion/assertion-sync.ts +5 -2
  169. package/src/assertion/assertion-types.ts +52 -45
  170. package/src/assertion/assertion.ts +2 -17
  171. package/src/assertion/create.ts +16 -65
  172. package/src/assertion/impl/async.ts +132 -92
  173. package/src/assertion/impl/callback.ts +882 -0
  174. package/src/assertion/impl/index.ts +1 -1
  175. package/src/assertion/impl/sync-esoteric.ts +2 -2
  176. package/src/assertion/impl/sync-parametric.ts +41 -49
  177. package/src/assertion/impl/sync.ts +3 -0
  178. package/src/bootstrap.ts +21 -11
  179. package/src/constant.ts +8 -0
  180. package/src/error.ts +75 -4
  181. package/src/expect.ts +275 -20
  182. package/src/guards.ts +74 -69
  183. package/src/index.ts +72 -11
  184. package/src/metadata.ts +3 -4
  185. package/src/schema.ts +80 -36
  186. package/src/types.ts +625 -72
  187. package/src/util.ts +174 -222
  188. package/src/value-to-schema.ts +464 -0
  189. package/dist/commonjs/api.d.ts +0 -93
  190. package/dist/commonjs/api.d.ts.map +0 -1
  191. package/dist/commonjs/api.js +0 -8
  192. package/dist/commonjs/api.js.map +0 -1
  193. package/dist/esm/api.d.ts +0 -93
  194. package/dist/esm/api.d.ts.map +0 -1
  195. package/dist/esm/api.js +0 -7
  196. package/dist/esm/api.js.map +0 -1
  197. package/src/api.ts +0 -149
  198. package/src/schema.md +0 -15
@@ -1,31 +1,50 @@
1
1
  /**
2
- * Zod schema definitions for common types and validation patterns.
2
+ * Arguably-useful Zod schemas for common types and validation patterns.
3
3
  *
4
4
  * This module provides reusable Zod schemas for validating constructors,
5
5
  * functions, property keys, promises, and other common JavaScript types used
6
- * throughout the assertion system. These tend to work around Zod's
7
- * limitations.
6
+ * throughout the assertion system. These tend to work around the impedance
7
+ * mismatch between **BUPKIS** and Zod.
8
8
  *
9
9
  * These are used internally, but consumers may also find them useful.
10
10
  *
11
- * @document schema.md
11
+ * For example, we have {@link FunctionSchema} which accepts any
12
+ * function—regardless of its signature. We need this because Zod v4's
13
+ * `z.function()` no longer returns a `ZodType` (ref:
14
+ * {@link https://zod.dev/v4/changelog | Zod v4 Migration Guide}) and so behaves
15
+ * differently. `FunctionSchema` allows us to work with functions as _values_
16
+ * instead of something to be implemented.
17
+ *
18
+ * Similarly—but not a new development—`z.promise()` does not parse a
19
+ * {@link Promise} object; it parses the _fulfilled value_. This is not what we
20
+ * want for "is a Promise" assertions, but it _can_ be useful for making sense
21
+ * of the fulfilled value. To solve this, we have
22
+ * {@link WrappedPromiseLikeSchema} (which explicitly supports
23
+ * {@link PromiseLike}/"thenable" objects).
24
+ *
25
+ * @category API
26
+ * @example
27
+ *
28
+ * ```ts
29
+ * import * as schema from 'bupkis/schema';
30
+ * ```
31
+ *
12
32
  * @packageDocumentation
13
33
  */
14
34
  import { z } from 'zod/v4';
15
- import { isA, isConstructable, isFunction, isNonNullObject, isPromiseLike, } from './guards.js';
35
+ import { isA, isConstructible, isFunction, isNonNullObject, isPromiseLike, } from './guards.js';
16
36
  import { BupkisRegistry } from './metadata.js';
17
37
  /**
18
38
  * A Zod schema that validates JavaScript classes or constructor functions.
19
39
  *
20
40
  * This schema validates values that can be used as constructors, including ES6
21
41
  * classes, traditional constructor functions, and built-in constructors. It
22
- * uses the {@link isConstructable} guard function to determine if a value can be
42
+ * uses the {@link isConstructible} guard function to determine if a value can be
23
43
  * invoked with the `new` operator to create object instances.
24
44
  *
25
- * @remarks
45
+ * @privateRemarks
26
46
  * The schema is registered in the {@link BupkisRegistry} with the name
27
47
  * `ClassSchema` for later reference and type checking purposes.
28
- * @category Schema
29
48
  * @example
30
49
  *
31
50
  * ```typescript
@@ -39,9 +58,11 @@ import { BupkisRegistry } from './metadata.js';
39
58
  * ClassSchema.parse(() => {}); // ✗ Throws validation error
40
59
  * ClassSchema.parse({}); // ✗ Throws validation error
41
60
  * ```
61
+ *
62
+ * @group Schema
42
63
  */
43
64
  export const ClassSchema = z
44
- .custom(isConstructable)
65
+ .custom(isConstructible)
45
66
  .register(BupkisRegistry, { name: 'ClassSchema' })
46
67
  .describe('Class / Constructor');
47
68
  /**
@@ -53,10 +74,9 @@ export const ClassSchema = z
53
74
  * including regular functions, arrow functions, async functions, generator
54
75
  * functions, and methods.
55
76
  *
56
- * @remarks
77
+ * @privateRemarks
57
78
  * The schema is registered in the {@link BupkisRegistry} with the name
58
79
  * `FunctionSchema` for later reference and type checking purposes.
59
- * @category Schema
60
80
  * @example
61
81
  *
62
82
  * ```typescript
@@ -68,6 +88,8 @@ export const ClassSchema = z
68
88
  * FunctionSchema.parse('not a function'); // ✗ Throws validation error
69
89
  * FunctionSchema.parse({}); // ✗ Throws validation error
70
90
  * ```
91
+ *
92
+ * @group Schema
71
93
  */
72
94
  export const FunctionSchema = z
73
95
  .custom(isFunction)
@@ -83,10 +105,9 @@ export const FunctionSchema = z
83
105
  * types that JavaScript automatically converts to property keys when used in
84
106
  * object access or assignment operations.
85
107
  *
86
- * @remarks
108
+ * @privateRemarks
87
109
  * The schema is registered in the `BupkisRegistry` with the name
88
110
  * `PropertyKeySchema` for later reference and type checking purposes.
89
- * @category Schema
90
111
  * @example
91
112
  *
92
113
  * ```typescript
@@ -96,6 +117,8 @@ export const FunctionSchema = z
96
117
  * PropertyKeySchema.parse({}); // ✗ Throws validation error
97
118
  * PropertyKeySchema.parse(null); // ✗ Throws validation error
98
119
  * ```
120
+ *
121
+ * @group Schema
99
122
  */
100
123
  export const PropertyKeySchema = z
101
124
  .union([z.string(), z.number(), z.symbol()])
@@ -110,12 +133,11 @@ export const PropertyKeySchema = z
110
133
  * resolved value, meaning the result of parsing remains a Promise or thenable
111
134
  * object.
112
135
  *
113
- * @remarks
136
+ * @privateRemarks
114
137
  * The schema is registered in the `BupkisRegistry` with the name
115
138
  * `WrappedPromiseLikeSchema` for later reference and type checking purposes.
116
139
  * This is useful when you need to validate that something is thenable without
117
140
  * automatically resolving it.
118
- * @category Schema
119
141
  * @example
120
142
  *
121
143
  * ```typescript
@@ -124,6 +146,8 @@ export const PropertyKeySchema = z
124
146
  * WrappedPromiseLikeSchema.parse(42); // ✗ Throws validation error
125
147
  * WrappedPromiseLikeSchema.parse({}); // ✗ Throws validation error
126
148
  * ```
149
+ *
150
+ * @group Schema
127
151
  */
128
152
  export const WrappedPromiseLikeSchema = z
129
153
  .custom((value) => isPromiseLike(value))
@@ -140,7 +164,6 @@ export const WrappedPromiseLikeSchema = z
140
164
  * @remarks
141
165
  * The schema is registered in the `BupkisRegistry` with the name
142
166
  * `StrongMapSchema` for later reference and type checking purposes.
143
- * @category Schema
144
167
  * @example
145
168
  *
146
169
  * ```typescript
@@ -153,6 +176,8 @@ export const WrappedPromiseLikeSchema = z
153
176
  * const weakMap = new WeakMap();
154
177
  * StrongMapSchema.parse(weakMap); // ✗ Throws validation error
155
178
  * ```
179
+ *
180
+ * @group Schema
156
181
  */
157
182
  export const StrongMapSchema = z
158
183
  .instanceof(Map)
@@ -170,7 +195,6 @@ export const StrongMapSchema = z
170
195
  * @remarks
171
196
  * The schema is registered in the `BupkisRegistry` with the name
172
197
  * `StrongSetSchema` for later reference and type checking purposes.
173
- * @category Schema
174
198
  * @example
175
199
  *
176
200
  * ```typescript
@@ -180,6 +204,8 @@ export const StrongMapSchema = z
180
204
  * const weakSet = new WeakSet();
181
205
  * StrongSetSchema.parse(weakSet); // ✗ Throws validation error
182
206
  * ```
207
+ *
208
+ * @group Schema
183
209
  */
184
210
  export const StrongSetSchema = z
185
211
  .instanceof(Set)
@@ -195,10 +221,12 @@ export const StrongSetSchema = z
195
221
  * `Object.prototype`, making them useful as pure data containers or
196
222
  * dictionaries.
197
223
  *
198
- * @remarks
224
+ * @privateRemarks
199
225
  * The schema is registered in the `BupkisRegistry` with the name
200
226
  * `ObjectWithNullPrototype` for later reference and type checking purposes.
201
- * @category Schema
227
+ *
228
+ * Changing this to be a `ZodRecord` would be nice, but that would end up
229
+ * blasting away the original object's prototype.
202
230
  * @example
203
231
  *
204
232
  * ```typescript
@@ -212,11 +240,20 @@ export const StrongSetSchema = z
212
240
  * const emptyObj = {};
213
241
  * NullProtoObjectSchema.parse(emptyObj); // ✗ Throws validation error
214
242
  * ```
243
+ *
244
+ * @group Schema
245
+ * @see Aliases: {@link NullProtoObjectSchema}, {@link DictionarySchema}
215
246
  */
216
- export const NullProtoObjectSchema = z
247
+ export const DictionarySchema = z
217
248
  .custom((value) => isNonNullObject(value) && Object.getPrototypeOf(value) === null)
218
249
  .describe('Object with null prototype')
219
250
  .register(BupkisRegistry, { name: 'ObjectWithNullPrototype' });
251
+ /**
252
+ * {@inheritDoc DictionarySchema}
253
+ *
254
+ * @group Schema
255
+ */
256
+ export const NullProtoObjectSchema = DictionarySchema;
220
257
  /**
221
258
  * A Zod schema that validates functions declared with the `async` keyword.
222
259
  *
@@ -225,13 +262,12 @@ export const NullProtoObjectSchema = z
225
262
  * function's internal `[[ToString]]` representation to distinguish async
226
263
  * functions from regular functions that might return Promises.
227
264
  *
228
- * @remarks
265
+ * @privateRemarks
229
266
  * The schema is registered in the `BupkisRegistry` with the name
230
267
  * `AsyncFunctionSchema` for later reference and type checking purposes. This
231
268
  * schema cannot reliably detect functions that return Promises but are not
232
269
  * declared with `async`, as this determination requires static analysis that is
233
270
  * not available at runtime.
234
- * @category Schema
235
271
  * @example
236
272
  *
237
273
  * ```typescript
@@ -251,6 +287,8 @@ export const NullProtoObjectSchema = z
251
287
  * const regularFn = () => 42;
252
288
  * AsyncFunctionSchema.parse(regularFn); // ✗ Throws validation error
253
289
  * ```
290
+ *
291
+ * @group Schema
254
292
  */
255
293
  export const AsyncFunctionSchema = FunctionSchema.refine((value) => Object.prototype.toString.call(value) === '[object AsyncFunction]')
256
294
  .describe('Function declared with the `async` keyword')
@@ -263,10 +301,9 @@ export const AsyncFunctionSchema = FunctionSchema.refine((value) => Object.proto
263
301
  * if it converts to `true` when evaluated in a boolean context - essentially
264
302
  * any value that is not one of the eight falsy values.
265
303
  *
266
- * @remarks
304
+ * @privateRemarks
267
305
  * The schema is registered in the `BupkisRegistry` with the name `Truthy` and
268
306
  * indicates that it accepts anything as valid input for evaluation.
269
- * @category Schema
270
307
  * @example
271
308
  *
272
309
  * ```typescript
@@ -280,6 +317,8 @@ export const AsyncFunctionSchema = FunctionSchema.refine((value) => Object.proto
280
317
  * TruthySchema.parse(''); // ✗ Throws validation error
281
318
  * TruthySchema.parse(null); // ✗ Throws validation error
282
319
  * ```
320
+ *
321
+ * @group Schema
283
322
  */
284
323
  export const TruthySchema = z
285
324
  .any()
@@ -297,10 +336,9 @@ export const TruthySchema = z
297
336
  * in JavaScript are: `false`, `0`, `-0`, `0n`, `""` (empty string), `null`,
298
337
  * `undefined`, and `NaN`.
299
338
  *
300
- * @remarks
339
+ * @privateRemarks
301
340
  * The schema is registered in the `BupkisRegistry` with the name `Falsy` and
302
341
  * indicates that it accepts anything as valid input for evaluation.
303
- * @category Schema
304
342
  * @example
305
343
  *
306
344
  * ```typescript
@@ -317,6 +355,8 @@ export const TruthySchema = z
317
355
  * FalsySchema.parse('hello'); // ✗ Throws validation error
318
356
  * FalsySchema.parse({}); // ✗ Throws validation error
319
357
  * ```
358
+ *
359
+ * @group Schema
320
360
  */
321
361
  export const FalsySchema = z
322
362
  .any()
@@ -333,10 +373,9 @@ export const FalsySchema = z
333
373
  * distinguishing them from objects and functions which are non-primitive
334
374
  * reference types.
335
375
  *
336
- * @remarks
376
+ * @privateRemarks
337
377
  * The schema is registered in the `BupkisRegistry` with the name `Primitive`
338
378
  * and indicates that it accepts primitive values as valid input.
339
- * @category Schema
340
379
  * @example
341
380
  *
342
381
  * ```typescript
@@ -351,6 +390,8 @@ export const FalsySchema = z
351
390
  * PrimitiveSchema.parse([]); // ✗ Throws validation error (array)
352
391
  * PrimitiveSchema.parse(() => {}); // ✗ Throws validation error (function)
353
392
  * ```
393
+ *
394
+ * @group Schema
354
395
  */
355
396
  export const PrimitiveSchema = z
356
397
  .union([
@@ -374,12 +415,11 @@ export const PrimitiveSchema = z
374
415
  * it useful for validating collections where the specific array mutability or
375
416
  * tuple structure is not critical.
376
417
  *
377
- * @remarks
418
+ * @privateRemarks
378
419
  * The schema is registered in the {@link BupkisRegistry} with the name
379
420
  * `ArrayLike` for later reference and type checking purposes. This schema is
380
421
  * particularly useful when you need to accept various forms of array-like data
381
422
  * without being restrictive about mutability or exact tuple structure.
382
- * @category Schema
383
423
  * @example
384
424
  *
385
425
  * ```typescript
@@ -391,11 +431,13 @@ export const PrimitiveSchema = z
391
431
  * ArrayLikeSchema.parse({}); // ✗ Throws validation error
392
432
  * ArrayLikeSchema.parse(null); // ✗ Throws validation error
393
433
  * ```
434
+ *
435
+ * @group Schema
394
436
  */
395
437
  export const ArrayLikeSchema = z
396
438
  .union([
397
- z.array(z.any()),
398
- z.tuple([z.any()], z.any()),
439
+ z.array(z.unknown()),
440
+ z.tuple([z.unknown()], z.unknown()),
399
441
  z.looseObject({ length: z.number().nonnegative().int() }),
400
442
  ])
401
443
  .describe('Array-like value')
@@ -411,10 +453,9 @@ export const ArrayLikeSchema = z
411
453
  * It ensures the validated value is a proper regular expression object with all
412
454
  * associated methods and properties.
413
455
  *
414
- * @remarks
456
+ * @privateRemarks
415
457
  * The schema is registered in the `BupkisRegistry` with the name `RegExp` for
416
458
  * later reference and type checking purposes.
417
- * @category Schema
418
459
  * @example
419
460
  *
420
461
  * ```typescript
@@ -426,6 +467,8 @@ export const ArrayLikeSchema = z
426
467
  * RegExpSchema.parse(/abc/.source); // ✗ Throws validation error (string pattern)
427
468
  * RegExpSchema.parse({}); // ✗ Throws validation error (object)
428
469
  * ```
470
+ *
471
+ * @group Schema
429
472
  */
430
473
  export const RegExpSchema = z
431
474
  .instanceof(RegExp)
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,GAAG,EACH,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAc,eAAe,CAAC;KACpC,QAAQ,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KACjD,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,CAA0B,UAAU,CAAC;KAC3C,QAAQ,CAAC,cAAc,EAAE;IACxB,IAAI,EAAE,gBAAgB;CACvB,CAAC;KACD,QAAQ,CAC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