bupkis 0.3.0 → 0.4.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 (99) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +26 -2
  3. package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
  4. package/dist/commonjs/assertion/impl/async.js +6 -2
  5. package/dist/commonjs/assertion/impl/async.js.map +1 -1
  6. package/dist/commonjs/assertion/impl/callback.js +2 -2
  7. package/dist/commonjs/assertion/impl/callback.js.map +1 -1
  8. package/dist/commonjs/assertion/impl/sync-basic.d.ts.map +1 -1
  9. package/dist/commonjs/assertion/impl/sync-basic.js +1 -1
  10. package/dist/commonjs/assertion/impl/sync-basic.js.map +1 -1
  11. package/dist/commonjs/assertion/impl/sync-collection.d.ts +1 -1
  12. package/dist/commonjs/assertion/impl/sync-collection.js +3 -3
  13. package/dist/commonjs/assertion/impl/sync-collection.js.map +1 -1
  14. package/dist/commonjs/assertion/impl/sync-parametric.d.ts +5 -14
  15. package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
  16. package/dist/commonjs/assertion/impl/sync-parametric.js +5 -5
  17. package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
  18. package/dist/commonjs/assertion/impl/sync.d.ts +6 -15
  19. package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
  20. package/dist/commonjs/bootstrap.d.ts +6 -15
  21. package/dist/commonjs/bootstrap.d.ts.map +1 -1
  22. package/dist/commonjs/constant.d.ts +1 -1
  23. package/dist/commonjs/constant.d.ts.map +1 -1
  24. package/dist/commonjs/constant.js +2 -1
  25. package/dist/commonjs/constant.js.map +1 -1
  26. package/dist/commonjs/guards.d.ts +74 -1
  27. package/dist/commonjs/guards.d.ts.map +1 -1
  28. package/dist/commonjs/guards.js +78 -1
  29. package/dist/commonjs/guards.js.map +1 -1
  30. package/dist/commonjs/index.d.ts +7 -16
  31. package/dist/commonjs/index.d.ts.map +1 -1
  32. package/dist/commonjs/index.js.map +1 -1
  33. package/dist/commonjs/schema.d.ts +66 -10
  34. package/dist/commonjs/schema.d.ts.map +1 -1
  35. package/dist/commonjs/schema.js +87 -12
  36. package/dist/commonjs/schema.js.map +1 -1
  37. package/dist/commonjs/types.d.ts +132 -1
  38. package/dist/commonjs/types.d.ts.map +1 -1
  39. package/dist/commonjs/use.d.ts.map +1 -1
  40. package/dist/commonjs/use.js +15 -1
  41. package/dist/commonjs/use.js.map +1 -1
  42. package/dist/commonjs/value-to-schema.d.ts.map +1 -1
  43. package/dist/commonjs/value-to-schema.js +20 -0
  44. package/dist/commonjs/value-to-schema.js.map +1 -1
  45. package/dist/esm/assertion/impl/async.d.ts.map +1 -1
  46. package/dist/esm/assertion/impl/async.js +7 -3
  47. package/dist/esm/assertion/impl/async.js.map +1 -1
  48. package/dist/esm/assertion/impl/callback.js +3 -3
  49. package/dist/esm/assertion/impl/callback.js.map +1 -1
  50. package/dist/esm/assertion/impl/sync-basic.d.ts.map +1 -1
  51. package/dist/esm/assertion/impl/sync-basic.js +2 -2
  52. package/dist/esm/assertion/impl/sync-basic.js.map +1 -1
  53. package/dist/esm/assertion/impl/sync-collection.d.ts +1 -1
  54. package/dist/esm/assertion/impl/sync-collection.js +3 -3
  55. package/dist/esm/assertion/impl/sync-collection.js.map +1 -1
  56. package/dist/esm/assertion/impl/sync-parametric.d.ts +5 -14
  57. package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
  58. package/dist/esm/assertion/impl/sync-parametric.js +6 -6
  59. package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
  60. package/dist/esm/assertion/impl/sync.d.ts +6 -15
  61. package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
  62. package/dist/esm/bootstrap.d.ts +6 -15
  63. package/dist/esm/bootstrap.d.ts.map +1 -1
  64. package/dist/esm/constant.d.ts +1 -1
  65. package/dist/esm/constant.d.ts.map +1 -1
  66. package/dist/esm/constant.js +1 -0
  67. package/dist/esm/constant.js.map +1 -1
  68. package/dist/esm/guards.d.ts +74 -1
  69. package/dist/esm/guards.d.ts.map +1 -1
  70. package/dist/esm/guards.js +76 -0
  71. package/dist/esm/guards.js.map +1 -1
  72. package/dist/esm/index.d.ts +7 -16
  73. package/dist/esm/index.d.ts.map +1 -1
  74. package/dist/esm/index.js.map +1 -1
  75. package/dist/esm/schema.d.ts +66 -10
  76. package/dist/esm/schema.d.ts.map +1 -1
  77. package/dist/esm/schema.js +87 -12
  78. package/dist/esm/schema.js.map +1 -1
  79. package/dist/esm/types.d.ts +132 -1
  80. package/dist/esm/types.d.ts.map +1 -1
  81. package/dist/esm/use.d.ts.map +1 -1
  82. package/dist/esm/use.js +15 -1
  83. package/dist/esm/use.js.map +1 -1
  84. package/dist/esm/value-to-schema.d.ts.map +1 -1
  85. package/dist/esm/value-to-schema.js +21 -1
  86. package/dist/esm/value-to-schema.js.map +1 -1
  87. package/package.json +1 -1
  88. package/src/assertion/impl/async.ts +7 -3
  89. package/src/assertion/impl/callback.ts +3 -3
  90. package/src/assertion/impl/sync-basic.ts +5 -2
  91. package/src/assertion/impl/sync-collection.ts +3 -3
  92. package/src/assertion/impl/sync-parametric.ts +7 -6
  93. package/src/constant.ts +2 -0
  94. package/src/guards.ts +81 -1
  95. package/src/index.ts +2 -0
  96. package/src/schema.ts +99 -12
  97. package/src/types.ts +165 -2
  98. package/src/use.ts +22 -0
  99. package/src/value-to-schema.ts +25 -0
@@ -17,7 +17,7 @@
17
17
  */
18
18
  import { type Primitive } from 'type-fest';
19
19
  import { z } from 'zod/v4';
20
- import type { Constructor, ZodTypeMap } from './types.js';
20
+ import type { Constructor, ExpectItExecutor, ZodTypeMap } from './types.js';
21
21
  /**
22
22
  * Returns `true` if the given value looks like a Zod v4 schema, determined by
23
23
  * the presence of an internal {@link z.core.$ZodTypeDef} field.
@@ -113,6 +113,79 @@ export declare const isNonNullObject: (value: unknown) => value is object;
113
113
  * @returns `true` if the value is null or not an object, `false` otherwise
114
114
  */
115
115
  export declare const isNullOrNonObject: (value: unknown) => value is null | Primitive;
116
+ /**
117
+ * Generic type guard for instanceof checks.
118
+ *
119
+ * This function provides a type-safe way to check if a value is an instance of
120
+ * a given constructor, with proper type narrowing for TypeScript. It combines
121
+ * the null/object check with instanceof to ensure the value is a valid object
122
+ * before performing the instance check.
123
+ *
124
+ * @example
125
+ *
126
+ * ```typescript
127
+ * const obj = new Date();
128
+ * if (isA(obj, Date)) {
129
+ * // obj is now typed as Date
130
+ * console.log(obj.getTime());
131
+ * }
132
+ * ```
133
+ *
134
+ * @template T - The constructor type to check against
135
+ * @param value - Value to test
136
+ * @param ctor - Constructor function to check instanceof
137
+ * @returns `true` if the value is an instance of the constructor, `false`
138
+ * otherwise
139
+ */
116
140
  export declare const isA: <T extends Constructor>(value: unknown, ctor: T) => value is InstanceType<T>;
141
+ /**
142
+ * Type guard for Error instances.
143
+ *
144
+ * This function checks if a value is an instance of the Error class or any of
145
+ * its subclasses. It's useful for error handling and type narrowing when
146
+ * working with unknown values that might be errors.
147
+ *
148
+ * @example
149
+ *
150
+ * ```typescript
151
+ * try {
152
+ * throw new TypeError('Something went wrong');
153
+ * } catch (err) {
154
+ * if (isError(err)) {
155
+ * // err is now typed as Error
156
+ * console.log(err.message);
157
+ * }
158
+ * }
159
+ * ```
160
+ *
161
+ * @param value - Value to test
162
+ * @returns `true` if the value is an Error instance, `false` otherwise
163
+ */
117
164
  export declare const isError: (value: unknown) => value is Error;
165
+ /**
166
+ * Type guard for {@link ExpectItExecutor} functions.
167
+ *
168
+ * This function checks if a value is an {@link ExpectItExecutor} function
169
+ * created by {@link bupkis!expect.it | expect.it()}. {@link ExpectItExecutor}
170
+ * functions are special functions that contain assertion logic and are marked
171
+ * with an internal symbol for identification. They are used in nested
172
+ * assertions within "to satisfy" patterns and other complex assertion
173
+ * scenarios.
174
+ *
175
+ * @example
176
+ *
177
+ * ```typescript
178
+ * const executor = expect.it('to be a string');
179
+ * if (isExpectItExecutor(executor)) {
180
+ * // executor is now typed as ExpectItExecutor
181
+ * // Can be used in satisfaction patterns
182
+ * }
183
+ * ```
184
+ *
185
+ * @template Subject - The subject type that the executor function operates on
186
+ * @param value - Value to test
187
+ * @returns `true` if the value is an ExpectItExecutor function, `false`
188
+ * otherwise
189
+ */
190
+ export declare const isExpectItExecutor: <Subject extends z.ZodType = z.ZodUnknown>(value: unknown) => value is ExpectItExecutor<Subject>;
118
191
  //# sourceMappingURL=guards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAO3B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,UAAU,EAClD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,GACN,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAC1B;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC;AAkB9D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAAW,CAAC,MAAM,CAEpE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,CAAC,CAAC,UAC5B,CAAC;AAE9B;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CACb,CAAC;AAE/D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,OA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AAI,OAAO,OAAO,KAAG,KAAK,IAAI,KAA0B,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,UAAU,EACzE,OAAO,OAAO,KACb,KAAK,IAAI,gBAAgB,CAAC,OAAO,CAEnC,CAAC"}
@@ -16,6 +16,7 @@
16
16
  * @packageDocumentation
17
17
  */
18
18
  import { z } from 'zod/v4';
19
+ import { kExpectIt } from './constant.js';
19
20
  export function isZodType(value, type) {
20
21
  const isValid = isObject(value) &&
21
22
  'def' in value &&
@@ -154,8 +155,83 @@ export const isPhraseLiteralChoice = (value) => Array.isArray(value) && value.ev
154
155
  * @internal
155
156
  */
156
157
  export const isPhraseLiteral = (value) => isString(value) && !value.startsWith('not ');
158
+ /**
159
+ * Generic type guard for instanceof checks.
160
+ *
161
+ * This function provides a type-safe way to check if a value is an instance of
162
+ * a given constructor, with proper type narrowing for TypeScript. It combines
163
+ * the null/object check with instanceof to ensure the value is a valid object
164
+ * before performing the instance check.
165
+ *
166
+ * @example
167
+ *
168
+ * ```typescript
169
+ * const obj = new Date();
170
+ * if (isA(obj, Date)) {
171
+ * // obj is now typed as Date
172
+ * console.log(obj.getTime());
173
+ * }
174
+ * ```
175
+ *
176
+ * @template T - The constructor type to check against
177
+ * @param value - Value to test
178
+ * @param ctor - Constructor function to check instanceof
179
+ * @returns `true` if the value is an instance of the constructor, `false`
180
+ * otherwise
181
+ */
157
182
  export const isA = (value, ctor) => {
158
183
  return isNonNullObject(value) && value instanceof ctor;
159
184
  };
185
+ /**
186
+ * Type guard for Error instances.
187
+ *
188
+ * This function checks if a value is an instance of the Error class or any of
189
+ * its subclasses. It's useful for error handling and type narrowing when
190
+ * working with unknown values that might be errors.
191
+ *
192
+ * @example
193
+ *
194
+ * ```typescript
195
+ * try {
196
+ * throw new TypeError('Something went wrong');
197
+ * } catch (err) {
198
+ * if (isError(err)) {
199
+ * // err is now typed as Error
200
+ * console.log(err.message);
201
+ * }
202
+ * }
203
+ * ```
204
+ *
205
+ * @param value - Value to test
206
+ * @returns `true` if the value is an Error instance, `false` otherwise
207
+ */
160
208
  export const isError = (value) => isA(value, Error);
209
+ /**
210
+ * Type guard for {@link ExpectItExecutor} functions.
211
+ *
212
+ * This function checks if a value is an {@link ExpectItExecutor} function
213
+ * created by {@link bupkis!expect.it | expect.it()}. {@link ExpectItExecutor}
214
+ * functions are special functions that contain assertion logic and are marked
215
+ * with an internal symbol for identification. They are used in nested
216
+ * assertions within "to satisfy" patterns and other complex assertion
217
+ * scenarios.
218
+ *
219
+ * @example
220
+ *
221
+ * ```typescript
222
+ * const executor = expect.it('to be a string');
223
+ * if (isExpectItExecutor(executor)) {
224
+ * // executor is now typed as ExpectItExecutor
225
+ * // Can be used in satisfaction patterns
226
+ * }
227
+ * ```
228
+ *
229
+ * @template Subject - The subject type that the executor function operates on
230
+ * @param value - Value to test
231
+ * @returns `true` if the value is an ExpectItExecutor function, `false`
232
+ * otherwise
233
+ */
234
+ export const isExpectItExecutor = (value) => {
235
+ return isFunction(value) && kExpectIt in value && value[kExpectIt] === true;
236
+ };
161
237
  //# sourceMappingURL=guards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAmC3B,MAAM,UAAU,SAAS,CACvB,KAAc,EACd,IAAQ;IAER,MAAM,OAAO,GACX,QAAQ,CAAC,KAAK,CAAC;QACf,KAAK,IAAI,KAAK;QACd,CAAC,CAAC,KAAK,CAAC,GAAG;QACX,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;QAC7B,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC;IAEtB,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,IAAI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B,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAc,EACsB,EAAE;IACtC,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAC9E,CAAC,CAAC"}
@@ -37,7 +37,7 @@ export { z };
37
37
  /**
38
38
  * @primaryExport
39
39
  */
40
- export type { Bupkis, CreateAssertionFn, CreateAsyncAssertionFn, Expect, ExpectAsync, FailFn, UseFn, ZodTypeMap, } from './types.js';
40
+ export type { Bupkis, CreateAssertionFn, CreateAsyncAssertionFn, Expect, ExpectAsync, ExpectIt, ExpectItExecutor, FailFn, UseFn, ZodTypeMap, } from './types.js';
41
41
  export { createAssertion, createAsyncAssertion, fail, use };
42
42
  declare const
43
43
  /**
@@ -69,7 +69,7 @@ fail: import("./types.js").FailFn,
69
69
  *
70
70
  * @function
71
71
  */
72
- use: import("./types.js").UseFn<readonly [import("./types.js").AssertionFunctionSync<readonly [z.ZodMap<z.ZodAny, z.ZodAny>, readonly ["to contain", "to include"], z.ZodAny], (subject: Map<any, any>, key: any) => boolean, readonly [z.ZodMap<z.ZodAny, z.ZodAny>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, "to have size", z.ZodNumber], (subject: Map<unknown, unknown>, expectedSize: number) => boolean, readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, import("./types.js").PhraseLiteralSlot<"to have size">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, "to be empty"], (subject: Map<unknown, unknown>) => boolean, readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, import("./types.js").PhraseLiteralSlot<"to be empty">]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodSet<z.ZodAny>, readonly ["to contain", "to include"], z.ZodAny], (subject: Set<any>, value: any) => boolean, readonly [z.ZodSet<z.ZodAny>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, "to have size", z.ZodNumber], (subject: Set<unknown>, expectedSize: number) => boolean, readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, import("./types.js").PhraseLiteralSlot<"to have size">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, "to be empty"], (subject: Set<unknown>) => boolean, readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, import("./types.js").PhraseLiteralSlot<"to be empty">]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<WeakMap<WeakKey, unknown>, WeakMap<WeakKey, unknown>>, readonly ["to contain", "to include"], z.ZodAny], (subject: WeakMap<WeakKey, unknown>, key: any) => boolean, readonly [z.ZodCustom<WeakMap<WeakKey, unknown>, WeakMap<WeakKey, unknown>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>, readonly ["to contain", "to include"], z.ZodAny], (subject: WeakSet<WeakKey>, value: any) => boolean, readonly [z.ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, readonly ["to contain", "to include"], z.ZodAny], (subject: any[], value: any) => boolean, readonly [z.ZodArray<z.ZodAny>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, "to have size", z.ZodNumber], (subject: any[], expectedSize: number) => boolean, readonly [z.ZodArray<z.ZodAny>, import("./types.js").PhraseLiteralSlot<"to have size">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, "to have length", z.ZodNumber], (subject: any[], expectedLength: number) => boolean, readonly [z.ZodArray<z.ZodAny>, import("./types.js").PhraseLiteralSlot<"to have length">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, "to be non-empty"], (subject: any[]) => {
72
+ use: import("./types.js").UseFn<readonly [import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, readonly ["to contain", "to include"], z.ZodAny], (subject: Map<unknown, unknown>, key: any) => boolean, readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, "to have size", z.ZodNumber], (subject: Map<unknown, unknown>, expectedSize: number) => boolean, readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, import("./types.js").PhraseLiteralSlot<"to have size">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, "to be empty"], (subject: Map<unknown, unknown>) => boolean, readonly [z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>, import("./types.js").PhraseLiteralSlot<"to be empty">]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, readonly ["to contain", "to include"], z.ZodAny], (subject: Set<unknown>, value: any) => boolean, readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, "to have size", z.ZodNumber], (subject: Set<unknown>, expectedSize: number) => boolean, readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, import("./types.js").PhraseLiteralSlot<"to have size">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, "to be empty"], (subject: Set<unknown>) => boolean, readonly [z.ZodCustom<Set<unknown>, Set<unknown>>, import("./types.js").PhraseLiteralSlot<"to be empty">]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<WeakMap<WeakKey, unknown>, WeakMap<WeakKey, unknown>>, readonly ["to contain", "to include"], z.ZodAny], (subject: WeakMap<WeakKey, unknown>, key: any) => boolean, readonly [z.ZodCustom<WeakMap<WeakKey, unknown>, WeakMap<WeakKey, unknown>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>, readonly ["to contain", "to include"], z.ZodAny], (subject: WeakSet<WeakKey>, value: any) => boolean, readonly [z.ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, readonly ["to contain", "to include"], z.ZodAny], (subject: any[], value: any) => boolean, readonly [z.ZodArray<z.ZodAny>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to contain", "to include"]>, z.ZodAny]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, "to have size", z.ZodNumber], (subject: any[], expectedSize: number) => boolean, readonly [z.ZodArray<z.ZodAny>, import("./types.js").PhraseLiteralSlot<"to have size">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, "to have length", z.ZodNumber], (subject: any[], expectedLength: number) => boolean, readonly [z.ZodArray<z.ZodAny>, import("./types.js").PhraseLiteralSlot<"to have length">, z.ZodNumber]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodArray<z.ZodAny>, "to be non-empty"], (subject: any[]) => {
73
73
  actual: number;
74
74
  expected: string;
75
75
  message: string;
@@ -178,25 +178,16 @@ use: import("./types.js").UseFn<readonly [import("./types.js").AssertionFunction
178
178
  actual: string;
179
179
  expected: string;
180
180
  message: string;
181
- } | undefined, readonly [z.ZodString, import("./types.js").PhraseLiteralChoiceSlot<readonly ["includes", "contains", "to include", "to contain"]>, z.ZodString]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodString, "to match", z.ZodCustom<RegExp, RegExp>], (subject: string, regex: RegExp) => boolean, readonly [z.ZodString, import("./types.js").PhraseLiteralSlot<"to match">, z.ZodCustom<RegExp, RegExp>]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodNonOptional<z.ZodObject<{}, z.core.$loose>>, readonly ["to satisfy", "to be like"], z.ZodObject<{}, z.core.$loose>], (_subject: {
181
+ } | undefined, readonly [z.ZodString, import("./types.js").PhraseLiteralChoiceSlot<readonly ["includes", "contains", "to include", "to contain"]>, z.ZodString]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodString, "to match", z.ZodCustom<RegExp, RegExp>], (subject: string, regex: RegExp) => boolean, readonly [z.ZodString, import("./types.js").PhraseLiteralSlot<"to match">, z.ZodCustom<RegExp, RegExp>]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodNonOptional<z.ZodObject<{}, z.core.$loose>>, readonly ["to satisfy", "to be like"], z.ZodType<import("./types.js").SatisfyPatternValue, unknown, z.core.$ZodTypeInternals<import("./types.js").SatisfyPatternValue, unknown>>], (_subject: {
182
182
  [x: string]: unknown;
183
- }, shape: {
184
- [x: string]: unknown;
185
- }) => z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, readonly [z.ZodNonOptional<z.ZodObject<{}, z.core.$loose>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to satisfy", "to be like"]>, z.ZodObject<{}, z.core.$loose>]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
186
- length: z.ZodNumber;
187
- }, z.core.$loose>]>, readonly ["to satisfy", "to be like"], z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
183
+ }, shape: import("./types.js").SatisfyPatternValue) => z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, readonly [z.ZodNonOptional<z.ZodObject<{}, z.core.$loose>>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to satisfy", "to be like"]>, z.ZodType<import("./types.js").SatisfyPatternValue, unknown, z.core.$ZodTypeInternals<import("./types.js").SatisfyPatternValue, unknown>>]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
188
184
  length: z.ZodNumber;
189
- }, z.core.$loose>]>], (_subject: unknown[] | [unknown, ...unknown[]] | {
190
- [x: string]: unknown;
191
- length: number;
192
- }, shape: unknown[] | [unknown, ...unknown[]] | {
185
+ }, z.core.$loose>]>, readonly ["to satisfy", "to be like"], z.ZodType<import("./types.js").SatisfyPatternValue, unknown, z.core.$ZodTypeInternals<import("./types.js").SatisfyPatternValue, unknown>>], (_subject: unknown[] | [unknown, ...unknown[]] | {
193
186
  [x: string]: unknown;
194
187
  length: number;
195
- }) => z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, readonly [z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
196
- length: z.ZodNumber;
197
- }, z.core.$loose>]>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to satisfy", "to be like"]>, z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
188
+ }, shape: import("./types.js").SatisfyPatternValue) => z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, readonly [z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
198
189
  length: z.ZodNumber;
199
- }, z.core.$loose>]>]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<(...args: import("./types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("./types.js").MutableOrReadonly<unknown[]>) => unknown>, "to have arity", z.ZodNumber], (subject: (...args: import("./types.js").MutableOrReadonly<unknown[]>) => unknown, expectedArity: number) => {
190
+ }, z.core.$loose>]>, import("./types.js").PhraseLiteralChoiceSlot<readonly ["to satisfy", "to be like"]>, z.ZodType<import("./types.js").SatisfyPatternValue, unknown, z.core.$ZodTypeInternals<import("./types.js").SatisfyPatternValue, unknown>>]>, import("./types.js").AssertionFunctionSync<readonly [z.ZodCustom<(...args: import("./types.js").MutableOrReadonly<unknown[]>) => unknown, (...args: import("./types.js").MutableOrReadonly<unknown[]>) => unknown>, "to have arity", z.ZodNumber], (subject: (...args: import("./types.js").MutableOrReadonly<unknown[]>) => unknown, expectedArity: number) => {
200
191
  actual: number;
201
192
  expected: number;
202
193
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;GASG;AACH,YAAY,KAAK,KA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ot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAc5C;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,CAAC;AAiBb,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAC5D,MAAM;AACJ;;;;;;;GAOG;AACH,eAAe;AACf;;;;;;;GAOG;AACH,oBAAoB;AACpB;;;;GAIG;AACH,IAAI;AACJ;;;;GAIG;AACH,GAAG,EACH,GAAG,KAAK,EACT,GAAG,iBAAiB,CAAC"}
@@ -32,9 +32,9 @@
32
32
  * @packageDocumentation
33
33
  */
34
34
  import { z } from 'zod/v4';
35
- import { type Constructor, type MutableOrReadonly } from './types.js';
35
+ import { type Constructor, type MutableOrReadonly, type SatisfyPatternValue } from './types.js';
36
36
  /**
37
- * A Zod schema that validates JavaScript classes or constructor functions.
37
+ * A Zod schema that validates JavaScript constructible functions.
38
38
  *
39
39
  * This schema validates values that can be used as constructors, including ES6
40
40
  * classes, traditional constructor functions, and built-in constructors. It
@@ -43,24 +43,24 @@ import { type Constructor, type MutableOrReadonly } from './types.js';
43
43
  *
44
44
  * @privateRemarks
45
45
  * The schema is registered in the {@link BupkisRegistry} with the name
46
- * `ClassSchema` for later reference and type checking purposes.
46
+ * `ConstructibleSchema` for later reference and type checking purposes.
47
47
  * @example
48
48
  *
49
49
  * ```typescript
50
50
  * class MyClass {}
51
51
  * function MyConstructor() {}
52
52
  *
53
- * ClassSchema.parse(MyClass); // ✓ Valid
54
- * ClassSchema.parse(MyConstructor); // ✓ Valid
55
- * ClassSchema.parse(Array); // ✓ Valid
56
- * ClassSchema.parse(Date); // ✓ Valid
57
- * ClassSchema.parse(() => {}); // ✗ Throws validation error
58
- * ClassSchema.parse({}); // ✗ Throws validation error
53
+ * ConstructibleSchema.parse(MyClass); // ✓ Valid
54
+ * ConstructibleSchema.parse(MyConstructor); // ✓ Valid
55
+ * ConstructibleSchema.parse(Array); // ✓ Valid
56
+ * ConstructibleSchema.parse(Date); // ✓ Valid
57
+ * ConstructibleSchema.parse(() => {}); // ✗ Throws validation error
58
+ * ConstructibleSchema.parse({}); // ✗ Throws validation error
59
59
  * ```
60
60
  *
61
61
  * @group Schema
62
62
  */
63
- export declare const ClassSchema: z.ZodCustom<Constructor, Constructor>;
63
+ export declare const ConstructibleSchema: z.ZodCustom<Constructor, Constructor>;
64
64
  /**
65
65
  * A Zod schema that validates any JavaScript function.
66
66
  *
@@ -413,4 +413,60 @@ export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodUnkno
413
413
  * @group Schema
414
414
  */
415
415
  export declare const RegExpSchema: z.ZodCustom<RegExp, RegExp>;
416
+ /**
417
+ * A recursive Zod schema that validates values allowed in "to satisfy"
418
+ * assertion patterns.
419
+ *
420
+ * This schema defines the allowed structure for patterns used with "to satisfy"
421
+ * and "to be like" assertions. It supports a recursive structure that can
422
+ * contain:
423
+ *
424
+ * - **Primitive values**: strings, numbers, booleans, null, undefined, bigint,
425
+ * symbols
426
+ * - **Regular expressions**: for pattern matching against string values
427
+ * - **ExpectItExecutor functions**: nested assertions created via `expect.it()`
428
+ * - **Objects**: with properties that recursively follow this same pattern
429
+ * - **Arrays**: with elements that recursively follow this same pattern
430
+ *
431
+ * The schema handles the special semantics required for "to satisfy"
432
+ * assertions:
433
+ *
434
+ * - RegExp values are used for pattern testing rather than exact matching
435
+ * - ExpectItExecutor functions are executed as nested assertions
436
+ * - Objects and arrays can contain any combination of the above recursively
437
+ *
438
+ * @privateRemarks
439
+ * Uses `z.lazy()` to handle recursive object and array structures without
440
+ * causing infinite recursion during schema definition. The schema is registered
441
+ * in the `BupkisRegistry` for reference and type checking.
442
+ * @example
443
+ *
444
+ * ```typescript
445
+ * // Primitive values
446
+ * SatisfyPatternSchema.parse('hello'); // ✓ Valid
447
+ * SatisfyPatternSchema.parse(42); // ✓ Valid
448
+ * SatisfyPatternSchema.parse(true); // ✓ Valid
449
+ *
450
+ * // Regular expressions for pattern matching
451
+ * SatisfyPatternSchema.parse(/test/); // ✓ Valid
452
+ *
453
+ * // ExpectItExecutor functions
454
+ * SatisfyPatternSchema.parse(expect.it('to be a string')); // ✓ Valid
455
+ *
456
+ * // Complex nested structures
457
+ * SatisfyPatternSchema.parse({
458
+ * name: expect.it('to be a string'),
459
+ * email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
460
+ * age: expect.it('to be greater than', 0),
461
+ * tags: [expect.it('to be a string')],
462
+ * }); // ✓ Valid
463
+ *
464
+ * // Invalid values
465
+ * SatisfyPatternSchema.parse(new Date()); // ✗ Invalid (not supported type)
466
+ * SatisfyPatternSchema.parse(() => {}); // ✗ Invalid (regular function, not ExpectItExecutor)
467
+ * ```
468
+ *
469
+ * @group Schema
470
+ */
471
+ export declare const SatisfyPatternSchema: z.ZodType<SatisfyPatternValue>;
416
472
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAU3B,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,WAAW,uCAGU,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,wBACP,iBAAiB,CAAC,O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;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,WAAW,yBAKsB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,oHAWsB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe;;mBASxB,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,6BAGsB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAwBH,CAAC"}
@@ -32,10 +32,10 @@
32
32
  * @packageDocumentation
33
33
  */
34
34
  import { z } from 'zod/v4';
35
- import { isA, isConstructible, isFunction, isNonNullObject, isPromiseLike, } from './guards.js';
35
+ import { isA, isConstructible, isExpectItExecutor, isFunction, isNonNullObject, isPromiseLike, } from './guards.js';
36
36
  import { BupkisRegistry } from './metadata.js';
37
37
  /**
38
- * A Zod schema that validates JavaScript classes or constructor functions.
38
+ * A Zod schema that validates JavaScript constructible functions.
39
39
  *
40
40
  * This schema validates values that can be used as constructors, including ES6
41
41
  * classes, traditional constructor functions, and built-in constructors. It
@@ -44,27 +44,27 @@ import { BupkisRegistry } from './metadata.js';
44
44
  *
45
45
  * @privateRemarks
46
46
  * The schema is registered in the {@link BupkisRegistry} with the name
47
- * `ClassSchema` for later reference and type checking purposes.
47
+ * `ConstructibleSchema` for later reference and type checking purposes.
48
48
  * @example
49
49
  *
50
50
  * ```typescript
51
51
  * class MyClass {}
52
52
  * function MyConstructor() {}
53
53
  *
54
- * ClassSchema.parse(MyClass); // ✓ Valid
55
- * ClassSchema.parse(MyConstructor); // ✓ Valid
56
- * ClassSchema.parse(Array); // ✓ Valid
57
- * ClassSchema.parse(Date); // ✓ Valid
58
- * ClassSchema.parse(() => {}); // ✗ Throws validation error
59
- * ClassSchema.parse({}); // ✗ Throws validation error
54
+ * ConstructibleSchema.parse(MyClass); // ✓ Valid
55
+ * ConstructibleSchema.parse(MyConstructor); // ✓ Valid
56
+ * ConstructibleSchema.parse(Array); // ✓ Valid
57
+ * ConstructibleSchema.parse(Date); // ✓ Valid
58
+ * ConstructibleSchema.parse(() => {}); // ✗ Throws validation error
59
+ * ConstructibleSchema.parse({}); // ✗ Throws validation error
60
60
  * ```
61
61
  *
62
62
  * @group Schema
63
63
  */
64
- export const ClassSchema = z
64
+ export const ConstructibleSchema = z
65
65
  .custom(isConstructible)
66
- .register(BupkisRegistry, { name: 'ClassSchema' })
67
- .describe('Class / Constructor');
66
+ .register(BupkisRegistry, { name: 'ConstructibleSchema' })
67
+ .describe('Constructible Function');
68
68
  /**
69
69
  * A Zod schema that validates any JavaScript function.
70
70
  *
@@ -474,4 +474,79 @@ export const RegExpSchema = z
474
474
  .instanceof(RegExp)
475
475
  .describe('A RegExp instance')
476
476
  .register(BupkisRegistry, { name: 'RegExp' });
477
+ /**
478
+ * A recursive Zod schema that validates values allowed in "to satisfy"
479
+ * assertion patterns.
480
+ *
481
+ * This schema defines the allowed structure for patterns used with "to satisfy"
482
+ * and "to be like" assertions. It supports a recursive structure that can
483
+ * contain:
484
+ *
485
+ * - **Primitive values**: strings, numbers, booleans, null, undefined, bigint,
486
+ * symbols
487
+ * - **Regular expressions**: for pattern matching against string values
488
+ * - **ExpectItExecutor functions**: nested assertions created via `expect.it()`
489
+ * - **Objects**: with properties that recursively follow this same pattern
490
+ * - **Arrays**: with elements that recursively follow this same pattern
491
+ *
492
+ * The schema handles the special semantics required for "to satisfy"
493
+ * assertions:
494
+ *
495
+ * - RegExp values are used for pattern testing rather than exact matching
496
+ * - ExpectItExecutor functions are executed as nested assertions
497
+ * - Objects and arrays can contain any combination of the above recursively
498
+ *
499
+ * @privateRemarks
500
+ * Uses `z.lazy()` to handle recursive object and array structures without
501
+ * causing infinite recursion during schema definition. The schema is registered
502
+ * in the `BupkisRegistry` for reference and type checking.
503
+ * @example
504
+ *
505
+ * ```typescript
506
+ * // Primitive values
507
+ * SatisfyPatternSchema.parse('hello'); // ✓ Valid
508
+ * SatisfyPatternSchema.parse(42); // ✓ Valid
509
+ * SatisfyPatternSchema.parse(true); // ✓ Valid
510
+ *
511
+ * // Regular expressions for pattern matching
512
+ * SatisfyPatternSchema.parse(/test/); // ✓ Valid
513
+ *
514
+ * // ExpectItExecutor functions
515
+ * SatisfyPatternSchema.parse(expect.it('to be a string')); // ✓ Valid
516
+ *
517
+ * // Complex nested structures
518
+ * SatisfyPatternSchema.parse({
519
+ * name: expect.it('to be a string'),
520
+ * email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
521
+ * age: expect.it('to be greater than', 0),
522
+ * tags: [expect.it('to be a string')],
523
+ * }); // ✓ Valid
524
+ *
525
+ * // Invalid values
526
+ * SatisfyPatternSchema.parse(new Date()); // ✗ Invalid (not supported type)
527
+ * SatisfyPatternSchema.parse(() => {}); // ✗ Invalid (regular function, not ExpectItExecutor)
528
+ * ```
529
+ *
530
+ * @group Schema
531
+ */
532
+ export const SatisfyPatternSchema = z
533
+ .lazy(() => z.union([
534
+ // Primitive types
535
+ z.string(),
536
+ z.number(),
537
+ z.boolean(),
538
+ z.null(),
539
+ z.undefined(),
540
+ z.bigint(),
541
+ z.symbol(),
542
+ // Special types for "to satisfy" semantics
543
+ z.instanceof(RegExp), // For pattern matching
544
+ z.custom(isExpectItExecutor, {
545
+ message: 'Expected an ExpectItExecutor function (created with expect.it())',
546
+ }), // For nested assertions
547
+ // Recursive structures
548
+ z.array(SatisfyPatternSchema), // Arrays of satisfy patterns
549
+ z.record(z.string(), SatisfyPatternSchema), // Objects with satisfy pattern values
550
+ ]))
551
+ .register(BupkisRegistry, { name: 'SatisfyPatternSchema' });
477
552
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":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