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
package/src/schema.ts CHANGED
@@ -1,14 +1,34 @@
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
 
@@ -16,26 +36,25 @@ import { z } from 'zod/v4';
16
36
 
17
37
  import {
18
38
  isA,
19
- isConstructable,
39
+ isConstructible,
20
40
  isFunction,
21
41
  isNonNullObject,
22
42
  isPromiseLike,
23
43
  } from './guards.js';
24
44
  import { BupkisRegistry } from './metadata.js';
25
- import { type Constructor } from './types.js';
45
+ import { type Constructor, type MutableOrReadonly } from './types.js';
26
46
 
27
47
  /**
28
48
  * A Zod schema that validates JavaScript classes or constructor functions.
29
49
  *
30
50
  * This schema validates values that can be used as constructors, including ES6
31
51
  * classes, traditional constructor functions, and built-in constructors. It
32
- * uses the {@link isConstructable} guard function to determine if a value can be
52
+ * uses the {@link isConstructible} guard function to determine if a value can be
33
53
  * invoked with the `new` operator to create object instances.
34
54
  *
35
- * @remarks
55
+ * @privateRemarks
36
56
  * The schema is registered in the {@link BupkisRegistry} with the name
37
57
  * `ClassSchema` for later reference and type checking purposes.
38
- * @category Schema
39
58
  * @example
40
59
  *
41
60
  * ```typescript
@@ -49,10 +68,12 @@ import { type Constructor } from './types.js';
49
68
  * ClassSchema.parse(() => {}); // ✗ Throws validation error
50
69
  * ClassSchema.parse({}); // ✗ Throws validation error
51
70
  * ```
71
+ *
72
+ * @group Schema
52
73
  */
53
74
 
54
75
  export const ClassSchema = z
55
- .custom<Constructor>(isConstructable)
76
+ .custom<Constructor>(isConstructible)
56
77
  .register(BupkisRegistry, { name: 'ClassSchema' })
57
78
  .describe('Class / Constructor');
58
79
 
@@ -65,10 +86,9 @@ export const ClassSchema = z
65
86
  * including regular functions, arrow functions, async functions, generator
66
87
  * functions, and methods.
67
88
  *
68
- * @remarks
89
+ * @privateRemarks
69
90
  * The schema is registered in the {@link BupkisRegistry} with the name
70
91
  * `FunctionSchema` for later reference and type checking purposes.
71
- * @category Schema
72
92
  * @example
73
93
  *
74
94
  * ```typescript
@@ -80,9 +100,11 @@ export const ClassSchema = z
80
100
  * FunctionSchema.parse('not a function'); // ✗ Throws validation error
81
101
  * FunctionSchema.parse({}); // ✗ Throws validation error
82
102
  * ```
103
+ *
104
+ * @group Schema
83
105
  */
84
106
  export const FunctionSchema = z
85
- .custom<(...args: any[]) => any>(isFunction)
107
+ .custom<(...args: MutableOrReadonly<unknown[]>) => unknown>(isFunction)
86
108
  .register(BupkisRegistry, {
87
109
  name: 'FunctionSchema',
88
110
  })
@@ -98,10 +120,9 @@ export const FunctionSchema = z
98
120
  * types that JavaScript automatically converts to property keys when used in
99
121
  * object access or assignment operations.
100
122
  *
101
- * @remarks
123
+ * @privateRemarks
102
124
  * The schema is registered in the `BupkisRegistry` with the name
103
125
  * `PropertyKeySchema` for later reference and type checking purposes.
104
- * @category Schema
105
126
  * @example
106
127
  *
107
128
  * ```typescript
@@ -111,6 +132,8 @@ export const FunctionSchema = z
111
132
  * PropertyKeySchema.parse({}); // ✗ Throws validation error
112
133
  * PropertyKeySchema.parse(null); // ✗ Throws validation error
113
134
  * ```
135
+ *
136
+ * @group Schema
114
137
  */
115
138
  export const PropertyKeySchema = z
116
139
  .union([z.string(), z.number(), z.symbol()])
@@ -126,12 +149,11 @@ export const PropertyKeySchema = z
126
149
  * resolved value, meaning the result of parsing remains a Promise or thenable
127
150
  * object.
128
151
  *
129
- * @remarks
152
+ * @privateRemarks
130
153
  * The schema is registered in the `BupkisRegistry` with the name
131
154
  * `WrappedPromiseLikeSchema` for later reference and type checking purposes.
132
155
  * This is useful when you need to validate that something is thenable without
133
156
  * automatically resolving it.
134
- * @category Schema
135
157
  * @example
136
158
  *
137
159
  * ```typescript
@@ -140,6 +162,8 @@ export const PropertyKeySchema = z
140
162
  * WrappedPromiseLikeSchema.parse(42); // ✗ Throws validation error
141
163
  * WrappedPromiseLikeSchema.parse({}); // ✗ Throws validation error
142
164
  * ```
165
+ *
166
+ * @group Schema
143
167
  */
144
168
  export const WrappedPromiseLikeSchema = z
145
169
  .custom<PromiseLike<unknown>>((value) => isPromiseLike(value))
@@ -159,7 +183,6 @@ export const WrappedPromiseLikeSchema = z
159
183
  * @remarks
160
184
  * The schema is registered in the `BupkisRegistry` with the name
161
185
  * `StrongMapSchema` for later reference and type checking purposes.
162
- * @category Schema
163
186
  * @example
164
187
  *
165
188
  * ```typescript
@@ -172,6 +195,8 @@ export const WrappedPromiseLikeSchema = z
172
195
  * const weakMap = new WeakMap();
173
196
  * StrongMapSchema.parse(weakMap); // ✗ Throws validation error
174
197
  * ```
198
+ *
199
+ * @group Schema
175
200
  */
176
201
  export const StrongMapSchema = z
177
202
  .instanceof(Map)
@@ -190,7 +215,6 @@ export const StrongMapSchema = z
190
215
  * @remarks
191
216
  * The schema is registered in the `BupkisRegistry` with the name
192
217
  * `StrongSetSchema` for later reference and type checking purposes.
193
- * @category Schema
194
218
  * @example
195
219
  *
196
220
  * ```typescript
@@ -200,6 +224,8 @@ export const StrongMapSchema = z
200
224
  * const weakSet = new WeakSet();
201
225
  * StrongSetSchema.parse(weakSet); // ✗ Throws validation error
202
226
  * ```
227
+ *
228
+ * @group Schema
203
229
  */
204
230
  export const StrongSetSchema = z
205
231
  .instanceof(Set)
@@ -216,10 +242,12 @@ export const StrongSetSchema = z
216
242
  * `Object.prototype`, making them useful as pure data containers or
217
243
  * dictionaries.
218
244
  *
219
- * @remarks
245
+ * @privateRemarks
220
246
  * The schema is registered in the `BupkisRegistry` with the name
221
247
  * `ObjectWithNullPrototype` for later reference and type checking purposes.
222
- * @category Schema
248
+ *
249
+ * Changing this to be a `ZodRecord` would be nice, but that would end up
250
+ * blasting away the original object's prototype.
223
251
  * @example
224
252
  *
225
253
  * ```typescript
@@ -233,14 +261,24 @@ export const StrongSetSchema = z
233
261
  * const emptyObj = {};
234
262
  * NullProtoObjectSchema.parse(emptyObj); // ✗ Throws validation error
235
263
  * ```
264
+ *
265
+ * @group Schema
266
+ * @see Aliases: {@link NullProtoObjectSchema}, {@link DictionarySchema}
236
267
  */
237
- export const NullProtoObjectSchema = z
268
+ export const DictionarySchema = z
238
269
  .custom<Record<PropertyKey, unknown>>(
239
270
  (value) => isNonNullObject(value) && Object.getPrototypeOf(value) === null,
240
271
  )
241
272
  .describe('Object with null prototype')
242
273
  .register(BupkisRegistry, { name: 'ObjectWithNullPrototype' });
243
274
 
275
+ /**
276
+ * {@inheritDoc DictionarySchema}
277
+ *
278
+ * @group Schema
279
+ */
280
+ export const NullProtoObjectSchema = DictionarySchema;
281
+
244
282
  /**
245
283
  * A Zod schema that validates functions declared with the `async` keyword.
246
284
  *
@@ -249,13 +287,12 @@ export const NullProtoObjectSchema = z
249
287
  * function's internal `[[ToString]]` representation to distinguish async
250
288
  * functions from regular functions that might return Promises.
251
289
  *
252
- * @remarks
290
+ * @privateRemarks
253
291
  * The schema is registered in the `BupkisRegistry` with the name
254
292
  * `AsyncFunctionSchema` for later reference and type checking purposes. This
255
293
  * schema cannot reliably detect functions that return Promises but are not
256
294
  * declared with `async`, as this determination requires static analysis that is
257
295
  * not available at runtime.
258
- * @category Schema
259
296
  * @example
260
297
  *
261
298
  * ```typescript
@@ -275,6 +312,8 @@ export const NullProtoObjectSchema = z
275
312
  * const regularFn = () => 42;
276
313
  * AsyncFunctionSchema.parse(regularFn); // ✗ Throws validation error
277
314
  * ```
315
+ *
316
+ * @group Schema
278
317
  */
279
318
  export const AsyncFunctionSchema = FunctionSchema.refine(
280
319
  (value) => Object.prototype.toString.call(value) === '[object AsyncFunction]',
@@ -290,10 +329,9 @@ export const AsyncFunctionSchema = FunctionSchema.refine(
290
329
  * if it converts to `true` when evaluated in a boolean context - essentially
291
330
  * any value that is not one of the eight falsy values.
292
331
  *
293
- * @remarks
332
+ * @privateRemarks
294
333
  * The schema is registered in the `BupkisRegistry` with the name `Truthy` and
295
334
  * indicates that it accepts anything as valid input for evaluation.
296
- * @category Schema
297
335
  * @example
298
336
  *
299
337
  * ```typescript
@@ -307,6 +345,8 @@ export const AsyncFunctionSchema = FunctionSchema.refine(
307
345
  * TruthySchema.parse(''); // ✗ Throws validation error
308
346
  * TruthySchema.parse(null); // ✗ Throws validation error
309
347
  * ```
348
+ *
349
+ * @group Schema
310
350
  */
311
351
  export const TruthySchema = z
312
352
  .any()
@@ -325,10 +365,9 @@ export const TruthySchema = z
325
365
  * in JavaScript are: `false`, `0`, `-0`, `0n`, `""` (empty string), `null`,
326
366
  * `undefined`, and `NaN`.
327
367
  *
328
- * @remarks
368
+ * @privateRemarks
329
369
  * The schema is registered in the `BupkisRegistry` with the name `Falsy` and
330
370
  * indicates that it accepts anything as valid input for evaluation.
331
- * @category Schema
332
371
  * @example
333
372
  *
334
373
  * ```typescript
@@ -345,6 +384,8 @@ export const TruthySchema = z
345
384
  * FalsySchema.parse('hello'); // ✗ Throws validation error
346
385
  * FalsySchema.parse({}); // ✗ Throws validation error
347
386
  * ```
387
+ *
388
+ * @group Schema
348
389
  */
349
390
  export const FalsySchema = z
350
391
  .any()
@@ -362,10 +403,9 @@ export const FalsySchema = z
362
403
  * distinguishing them from objects and functions which are non-primitive
363
404
  * reference types.
364
405
  *
365
- * @remarks
406
+ * @privateRemarks
366
407
  * The schema is registered in the `BupkisRegistry` with the name `Primitive`
367
408
  * and indicates that it accepts primitive values as valid input.
368
- * @category Schema
369
409
  * @example
370
410
  *
371
411
  * ```typescript
@@ -380,6 +420,8 @@ export const FalsySchema = z
380
420
  * PrimitiveSchema.parse([]); // ✗ Throws validation error (array)
381
421
  * PrimitiveSchema.parse(() => {}); // ✗ Throws validation error (function)
382
422
  * ```
423
+ *
424
+ * @group Schema
383
425
  */
384
426
  export const PrimitiveSchema = z
385
427
  .union([
@@ -404,12 +446,11 @@ export const PrimitiveSchema = z
404
446
  * it useful for validating collections where the specific array mutability or
405
447
  * tuple structure is not critical.
406
448
  *
407
- * @remarks
449
+ * @privateRemarks
408
450
  * The schema is registered in the {@link BupkisRegistry} with the name
409
451
  * `ArrayLike` for later reference and type checking purposes. This schema is
410
452
  * particularly useful when you need to accept various forms of array-like data
411
453
  * without being restrictive about mutability or exact tuple structure.
412
- * @category Schema
413
454
  * @example
414
455
  *
415
456
  * ```typescript
@@ -421,11 +462,13 @@ export const PrimitiveSchema = z
421
462
  * ArrayLikeSchema.parse({}); // ✗ Throws validation error
422
463
  * ArrayLikeSchema.parse(null); // ✗ Throws validation error
423
464
  * ```
465
+ *
466
+ * @group Schema
424
467
  */
425
468
  export const ArrayLikeSchema = z
426
469
  .union([
427
- z.array(z.any()),
428
- z.tuple([z.any()], z.any()),
470
+ z.array(z.unknown()),
471
+ z.tuple([z.unknown()], z.unknown()),
429
472
  z.looseObject({ length: z.number().nonnegative().int() }),
430
473
  ])
431
474
  .describe('Array-like value')
@@ -442,10 +485,9 @@ export const ArrayLikeSchema = z
442
485
  * It ensures the validated value is a proper regular expression object with all
443
486
  * associated methods and properties.
444
487
  *
445
- * @remarks
488
+ * @privateRemarks
446
489
  * The schema is registered in the `BupkisRegistry` with the name `RegExp` for
447
490
  * later reference and type checking purposes.
448
- * @category Schema
449
491
  * @example
450
492
  *
451
493
  * ```typescript
@@ -457,6 +499,8 @@ export const ArrayLikeSchema = z
457
499
  * RegExpSchema.parse(/abc/.source); // ✗ Throws validation error (string pattern)
458
500
  * RegExpSchema.parse({}); // ✗ Throws validation error (object)
459
501
  * ```
502
+ *
503
+ * @group Schema
460
504
  */
461
505
  export const RegExpSchema = z
462
506
  .instanceof(RegExp)