bupkis 0.2.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.
- package/CHANGELOG.md +27 -0
- package/README.md +35 -11
- package/dist/commonjs/assertion/assertion-async.d.ts +2 -1
- package/dist/commonjs/assertion/assertion-async.d.ts.map +1 -1
- package/dist/commonjs/assertion/assertion-async.js +84 -2
- package/dist/commonjs/assertion/assertion-async.js.map +1 -1
- package/dist/commonjs/assertion/assertion-sync.d.ts +1 -1
- package/dist/commonjs/assertion/assertion-sync.d.ts.map +1 -1
- package/dist/commonjs/assertion/assertion-sync.js +5 -1
- package/dist/commonjs/assertion/assertion-sync.js.map +1 -1
- package/dist/commonjs/assertion/assertion-types.d.ts +6 -2
- package/dist/commonjs/assertion/assertion-types.d.ts.map +1 -1
- package/dist/commonjs/assertion/assertion.d.ts +1 -1
- package/dist/commonjs/assertion/assertion.d.ts.map +1 -1
- package/dist/commonjs/assertion/assertion.js +1 -14
- package/dist/commonjs/assertion/assertion.js.map +1 -1
- package/dist/commonjs/assertion/impl/async.d.ts +122 -21
- package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/async.js +118 -90
- package/dist/commonjs/assertion/impl/async.js.map +1 -1
- package/dist/commonjs/assertion/impl/callback.d.ts +104 -0
- package/dist/commonjs/assertion/impl/callback.d.ts.map +1 -0
- package/dist/commonjs/assertion/impl/callback.js +694 -0
- package/dist/commonjs/assertion/impl/callback.js.map +1 -0
- package/dist/commonjs/assertion/impl/index.d.ts +1 -1
- package/dist/commonjs/assertion/impl/index.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/index.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync-basic.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/sync-basic.js +1 -1
- package/dist/commonjs/assertion/impl/sync-basic.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync-collection.d.ts +1 -1
- package/dist/commonjs/assertion/impl/sync-collection.js +3 -3
- package/dist/commonjs/assertion/impl/sync-collection.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync-esoteric.js +1 -1
- package/dist/commonjs/assertion/impl/sync-esoteric.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync-parametric.d.ts +22 -28
- package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/sync-parametric.js +35 -50
- package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync.d.ts +68 -30
- package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/sync.js +4 -1
- package/dist/commonjs/assertion/impl/sync.js.map +1 -1
- package/dist/commonjs/bootstrap.d.ts +147 -52
- package/dist/commonjs/bootstrap.d.ts.map +1 -1
- package/dist/commonjs/bootstrap.js +2 -3
- package/dist/commonjs/bootstrap.js.map +1 -1
- package/dist/commonjs/constant.d.ts +1 -1
- package/dist/commonjs/constant.d.ts.map +1 -1
- package/dist/commonjs/constant.js +8 -1
- package/dist/commonjs/constant.js.map +1 -1
- package/dist/commonjs/error.d.ts +22 -2
- package/dist/commonjs/error.d.ts.map +1 -1
- package/dist/commonjs/error.js +44 -4
- package/dist/commonjs/error.js.map +1 -1
- package/dist/commonjs/expect.d.ts.map +1 -1
- package/dist/commonjs/expect.js +1 -1
- package/dist/commonjs/expect.js.map +1 -1
- package/dist/commonjs/guards.d.ts +96 -5
- package/dist/commonjs/guards.d.ts.map +1 -1
- package/dist/commonjs/guards.js +104 -25
- package/dist/commonjs/guards.js.map +1 -1
- package/dist/commonjs/index.d.ts +146 -51
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/schema.d.ts +84 -18
- package/dist/commonjs/schema.d.ts.map +1 -1
- package/dist/commonjs/schema.js +107 -22
- package/dist/commonjs/schema.js.map +1 -1
- package/dist/commonjs/types.d.ts +171 -9
- package/dist/commonjs/types.d.ts.map +1 -1
- package/dist/commonjs/use.d.ts.map +1 -1
- package/dist/commonjs/use.js +15 -1
- package/dist/commonjs/use.js.map +1 -1
- package/dist/commonjs/util.d.ts +66 -50
- package/dist/commonjs/util.d.ts.map +1 -1
- package/dist/commonjs/util.js +169 -156
- package/dist/commonjs/util.js.map +1 -1
- package/dist/commonjs/value-to-schema.d.ts +122 -0
- package/dist/commonjs/value-to-schema.d.ts.map +1 -0
- package/dist/commonjs/value-to-schema.js +329 -0
- package/dist/commonjs/value-to-schema.js.map +1 -0
- package/dist/esm/assertion/assertion-async.d.ts +2 -1
- package/dist/esm/assertion/assertion-async.d.ts.map +1 -1
- package/dist/esm/assertion/assertion-async.js +85 -3
- package/dist/esm/assertion/assertion-async.js.map +1 -1
- package/dist/esm/assertion/assertion-sync.d.ts +1 -1
- package/dist/esm/assertion/assertion-sync.d.ts.map +1 -1
- package/dist/esm/assertion/assertion-sync.js +6 -2
- package/dist/esm/assertion/assertion-sync.js.map +1 -1
- package/dist/esm/assertion/assertion-types.d.ts +6 -2
- package/dist/esm/assertion/assertion-types.d.ts.map +1 -1
- package/dist/esm/assertion/assertion.d.ts +1 -1
- package/dist/esm/assertion/assertion.d.ts.map +1 -1
- package/dist/esm/assertion/assertion.js +1 -14
- package/dist/esm/assertion/assertion.js.map +1 -1
- package/dist/esm/assertion/impl/async.d.ts +122 -21
- package/dist/esm/assertion/impl/async.d.ts.map +1 -1
- package/dist/esm/assertion/impl/async.js +118 -90
- package/dist/esm/assertion/impl/async.js.map +1 -1
- package/dist/esm/assertion/impl/callback.d.ts +104 -0
- package/dist/esm/assertion/impl/callback.d.ts.map +1 -0
- package/dist/esm/assertion/impl/callback.js +691 -0
- package/dist/esm/assertion/impl/callback.js.map +1 -0
- package/dist/esm/assertion/impl/index.d.ts +1 -1
- package/dist/esm/assertion/impl/index.d.ts.map +1 -1
- package/dist/esm/assertion/impl/index.js +1 -1
- package/dist/esm/assertion/impl/index.js.map +1 -1
- package/dist/esm/assertion/impl/sync-basic.d.ts.map +1 -1
- package/dist/esm/assertion/impl/sync-basic.js +2 -2
- package/dist/esm/assertion/impl/sync-basic.js.map +1 -1
- package/dist/esm/assertion/impl/sync-collection.d.ts +1 -1
- package/dist/esm/assertion/impl/sync-collection.js +3 -3
- package/dist/esm/assertion/impl/sync-collection.js.map +1 -1
- package/dist/esm/assertion/impl/sync-esoteric.js +2 -2
- package/dist/esm/assertion/impl/sync-esoteric.js.map +1 -1
- package/dist/esm/assertion/impl/sync-parametric.d.ts +22 -28
- package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
- package/dist/esm/assertion/impl/sync-parametric.js +36 -51
- package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
- package/dist/esm/assertion/impl/sync.d.ts +68 -30
- package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
- package/dist/esm/assertion/impl/sync.js +3 -1
- package/dist/esm/assertion/impl/sync.js.map +1 -1
- package/dist/esm/bootstrap.d.ts +147 -52
- package/dist/esm/bootstrap.d.ts.map +1 -1
- package/dist/esm/bootstrap.js +1 -2
- package/dist/esm/bootstrap.js.map +1 -1
- package/dist/esm/constant.d.ts +1 -1
- package/dist/esm/constant.d.ts.map +1 -1
- package/dist/esm/constant.js +7 -0
- package/dist/esm/constant.js.map +1 -1
- package/dist/esm/error.d.ts +22 -2
- package/dist/esm/error.d.ts.map +1 -1
- package/dist/esm/error.js +43 -4
- package/dist/esm/error.js.map +1 -1
- package/dist/esm/expect.d.ts.map +1 -1
- package/dist/esm/expect.js +2 -2
- package/dist/esm/expect.js.map +1 -1
- package/dist/esm/guards.d.ts +96 -5
- package/dist/esm/guards.d.ts.map +1 -1
- package/dist/esm/guards.js +98 -21
- package/dist/esm/guards.js.map +1 -1
- package/dist/esm/index.d.ts +146 -51
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schema.d.ts +84 -18
- package/dist/esm/schema.d.ts.map +1 -1
- package/dist/esm/schema.js +107 -22
- package/dist/esm/schema.js.map +1 -1
- package/dist/esm/types.d.ts +171 -9
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/use.d.ts.map +1 -1
- package/dist/esm/use.js +15 -1
- package/dist/esm/use.js.map +1 -1
- package/dist/esm/util.d.ts +66 -50
- package/dist/esm/util.d.ts.map +1 -1
- package/dist/esm/util.js +153 -154
- package/dist/esm/util.js.map +1 -1
- package/dist/esm/value-to-schema.d.ts +122 -0
- package/dist/esm/value-to-schema.d.ts.map +1 -0
- package/dist/esm/value-to-schema.js +325 -0
- package/dist/esm/value-to-schema.js.map +1 -0
- package/package.json +16 -13
- package/src/assertion/assertion-async.ts +113 -3
- package/src/assertion/assertion-sync.ts +5 -2
- package/src/assertion/assertion-types.ts +14 -4
- package/src/assertion/assertion.ts +2 -17
- package/src/assertion/impl/async.ts +137 -93
- package/src/assertion/impl/callback.ts +882 -0
- package/src/assertion/impl/index.ts +1 -1
- package/src/assertion/impl/sync-basic.ts +5 -2
- package/src/assertion/impl/sync-collection.ts +3 -3
- package/src/assertion/impl/sync-esoteric.ts +2 -2
- package/src/assertion/impl/sync-parametric.ts +47 -54
- package/src/assertion/impl/sync.ts +3 -0
- package/src/bootstrap.ts +1 -2
- package/src/constant.ts +10 -0
- package/src/error.ts +57 -3
- package/src/expect.ts +6 -2
- package/src/guards.ts +125 -18
- package/src/index.ts +3 -0
- package/src/schema.ts +121 -23
- package/src/types.ts +205 -10
- package/src/use.ts +22 -0
- package/src/util.ts +168 -223
- package/src/value-to-schema.ts +489 -0
package/dist/esm/util.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides core utility functions for checking if objects satisfy
|
|
5
|
-
* expected shapes, including `satisfies` for partial matching,
|
|
6
|
-
* `exhaustivelySatisfies` for exact matching, and `shallowSatisfiesShape` for
|
|
7
|
-
* converting shapes to Zod schemas. All functions handle circular references
|
|
8
|
-
* safely.
|
|
2
|
+
* Utility functions.
|
|
9
3
|
*
|
|
10
4
|
* @category API
|
|
11
5
|
* @example
|
|
@@ -17,58 +11,80 @@
|
|
|
17
11
|
* @packageDocumentation
|
|
18
12
|
*/
|
|
19
13
|
import { type StringKeyOf } from 'type-fest';
|
|
20
|
-
|
|
21
|
-
export declare function keyBy<const T extends readonly Record<PropertyKey, any>[], K extends StringKeyOf<T[number]>>(collection: T, key: K): Record<string, T[number]>;
|
|
14
|
+
export * from './value-to-schema.js';
|
|
22
15
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
16
|
+
* _Recursively_ searches within an object, array, or any nested structure to
|
|
17
|
+
* find whether a specific key exists.
|
|
25
18
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* primitives, objects, arrays, functions, and various built-in types, with
|
|
29
|
-
* support for circular reference detection.
|
|
19
|
+
* Handles circular references by tracking visited objects to prevent infinite
|
|
20
|
+
* recursion.
|
|
30
21
|
*
|
|
31
22
|
* @example
|
|
32
23
|
*
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* valueToSchema('hello'); // z.string()
|
|
36
|
-
* valueToSchema(42); // z.number()
|
|
37
|
-
* valueToSchema(true); // z.boolean()
|
|
24
|
+
* ```ts
|
|
25
|
+
* const obj = { a: 1, b: { c: 2, d: [{ e: 3 }] } };
|
|
38
26
|
*
|
|
39
|
-
* //
|
|
40
|
-
*
|
|
41
|
-
*
|
|
27
|
+
* hasKey(obj, 'c'); // true
|
|
28
|
+
* hasKey(obj, 'e'); // true
|
|
29
|
+
* hasKey(obj, 'x'); // false (key not found)
|
|
30
|
+
* ```
|
|
42
31
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
32
|
+
* @param obj The object, array, or value to search within
|
|
33
|
+
* @param key The key to search for
|
|
34
|
+
* @param visited Internal set for circular reference detection
|
|
35
|
+
* @returns True if the key is found anywhere in the structure, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
export declare function hasKey(obj: unknown, key: PropertyKey, visited?: WeakSet<object>): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* _Recursively_ searches within an object, array, or any nested structure to
|
|
40
|
+
* find whether a specific value exists.
|
|
41
|
+
*
|
|
42
|
+
* Uses strict equality (===) to compare values, with special handling for empty
|
|
43
|
+
* objects. Handles circular references by tracking visited objects to prevent
|
|
44
|
+
* infinite recursion.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* const obj = { a: 1, b: { c: 2, d: [{ e: 3 }] }, empty: {} };
|
|
46
50
|
*
|
|
47
|
-
* //
|
|
48
|
-
*
|
|
49
|
-
*
|
|
51
|
+
* hasValue(obj, 2); // true (found in obj.b.c)
|
|
52
|
+
* hasValue(obj, 3); // true (found in obj.b.d[0].e)
|
|
53
|
+
* hasValue(obj, {}); // true (found in obj.empty, matches empty objects)
|
|
54
|
+
* hasValue(obj, '1'); // false (strict equality, 1 !== '1')
|
|
55
|
+
* hasValue(obj, 999); // false (value not found)
|
|
50
56
|
* ```
|
|
51
57
|
*
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
58
|
+
* @param obj The object, array, or value to search within
|
|
59
|
+
* @param value The value to search for (using strict equality, with special
|
|
60
|
+
* empty object handling)
|
|
61
|
+
* @param visited Internal set for circular reference detection
|
|
62
|
+
* @returns True if the value is found anywhere in the structure, false
|
|
63
|
+
* otherwise
|
|
56
64
|
*/
|
|
57
|
-
export declare
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
export declare function hasValue(obj: unknown, value: unknown, visited?: WeakSet<object>): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* _Recursively_ searches for a key-value pair within an object or array.
|
|
68
|
+
*
|
|
69
|
+
* Uses strict equality (===) to compare values. Handles circular references by
|
|
70
|
+
* tracking visited objects to prevent infinite recursion.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* const obj = { a: 1, b: { c: 2, d: [{ e: 3 }] } };
|
|
76
|
+
*
|
|
77
|
+
* hasKeyValue(obj, 'c', 2); // true
|
|
78
|
+
* hasKeyValue(obj, 'e', 3); // true
|
|
79
|
+
* hasKeyValue(obj, 'a', '1'); // false (strict equality)
|
|
80
|
+
* hasKeyValue(obj, 'x', 1); // false (key not found)
|
|
81
|
+
* /**
|
|
82
|
+
* Maps an array of objects to an object keyed by the specified key.
|
|
83
|
+
*
|
|
84
|
+
* @param collection Array of objects
|
|
85
|
+
* @param key Name of key
|
|
86
|
+
* @returns Object mapping key values to objects
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function keyBy<const T extends readonly Record<PropertyKey, any>[], K extends StringKeyOf<T[number]>>(collection: T, key: K): Record<string, T[number]>;
|
|
74
90
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/esm/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,cAAc,sBAAsB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CACpB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,WAAW,EAChB,OAAO,kBAAwB,GAC9B,OAAO,CAuCT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,kBAAwB,GAC9B,OAAO,CAyDT;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CACnB,KAAK,CAAC,CAAC,SAAS,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,EACnD,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAChC,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAelD"}
|
package/dist/esm/util.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides core utility functions for checking if objects satisfy
|
|
5
|
-
* expected shapes, including `satisfies` for partial matching,
|
|
6
|
-
* `exhaustivelySatisfies` for exact matching, and `shallowSatisfiesShape` for
|
|
7
|
-
* converting shapes to Zod schemas. All functions handle circular references
|
|
8
|
-
* safely.
|
|
2
|
+
* Utility functions.
|
|
9
3
|
*
|
|
10
4
|
* @category API
|
|
11
5
|
* @example
|
|
@@ -16,174 +10,179 @@
|
|
|
16
10
|
*
|
|
17
11
|
* @packageDocumentation
|
|
18
12
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
export * from './value-to-schema.js';
|
|
14
|
+
/**
|
|
15
|
+
* _Recursively_ searches within an object, array, or any nested structure to
|
|
16
|
+
* find whether a specific key exists.
|
|
17
|
+
*
|
|
18
|
+
* Handles circular references by tracking visited objects to prevent infinite
|
|
19
|
+
* recursion.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* const obj = { a: 1, b: { c: 2, d: [{ e: 3 }] } };
|
|
25
|
+
*
|
|
26
|
+
* hasKey(obj, 'c'); // true
|
|
27
|
+
* hasKey(obj, 'e'); // true
|
|
28
|
+
* hasKey(obj, 'x'); // false (key not found)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param obj The object, array, or value to search within
|
|
32
|
+
* @param key The key to search for
|
|
33
|
+
* @param visited Internal set for circular reference detection
|
|
34
|
+
* @returns True if the key is found anywhere in the structure, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
export function hasKey(obj, key, visited = new WeakSet()) {
|
|
37
|
+
// Handle primitives that can't contain keys
|
|
38
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// Prevent infinite recursion with circular references
|
|
42
|
+
if (visited.has(obj)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
visited.add(obj);
|
|
46
|
+
try {
|
|
47
|
+
// Check if this object has the key
|
|
48
|
+
if (Object.hasOwn(obj, key)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
// Recursively search in object/array values
|
|
52
|
+
if (Array.isArray(obj)) {
|
|
53
|
+
// For arrays, search in each element
|
|
54
|
+
for (const item of obj) {
|
|
55
|
+
if (hasKey(item, key, visited)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// For objects, search in each property value
|
|
62
|
+
for (const propValue of Object.values(obj)) {
|
|
63
|
+
if (hasKey(propValue, key, visited)) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
30
67
|
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
visited.delete(obj);
|
|
31
72
|
}
|
|
32
|
-
return result;
|
|
33
73
|
}
|
|
34
74
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
75
|
+
* _Recursively_ searches within an object, array, or any nested structure to
|
|
76
|
+
* find whether a specific value exists.
|
|
37
77
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* support for circular reference detection.
|
|
78
|
+
* Uses strict equality (===) to compare values, with special handling for empty
|
|
79
|
+
* objects. Handles circular references by tracking visited objects to prevent
|
|
80
|
+
* infinite recursion.
|
|
42
81
|
*
|
|
43
82
|
* @example
|
|
44
83
|
*
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* valueToSchema('hello'); // z.string()
|
|
48
|
-
* valueToSchema(42); // z.number()
|
|
49
|
-
* valueToSchema(true); // z.boolean()
|
|
50
|
-
*
|
|
51
|
-
* // Objects
|
|
52
|
-
* valueToSchema({ name: 'John', age: 30 });
|
|
53
|
-
* // z.object({ name: z.string(), age: z.number() })
|
|
54
|
-
*
|
|
55
|
-
* // Arrays
|
|
56
|
-
* valueToSchema(['a', 'b', 'c']); // z.array(z.string())
|
|
57
|
-
* valueToSchema([1, 'mixed']); // z.array(z.union([z.number(), z.string()]))
|
|
84
|
+
* ```ts
|
|
85
|
+
* const obj = { a: 1, b: { c: 2, d: [{ e: 3 }] }, empty: {} };
|
|
58
86
|
*
|
|
59
|
-
* //
|
|
60
|
-
*
|
|
61
|
-
*
|
|
87
|
+
* hasValue(obj, 2); // true (found in obj.b.c)
|
|
88
|
+
* hasValue(obj, 3); // true (found in obj.b.d[0].e)
|
|
89
|
+
* hasValue(obj, {}); // true (found in obj.empty, matches empty objects)
|
|
90
|
+
* hasValue(obj, '1'); // false (strict equality, 1 !== '1')
|
|
91
|
+
* hasValue(obj, 999); // false (value not found)
|
|
62
92
|
* ```
|
|
63
93
|
*
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
*
|
|
67
|
-
* @
|
|
94
|
+
* @param obj The object, array, or value to search within
|
|
95
|
+
* @param value The value to search for (using strict equality, with special
|
|
96
|
+
* empty object handling)
|
|
97
|
+
* @param visited Internal set for circular reference detection
|
|
98
|
+
* @returns True if the value is found anywhere in the structure, false
|
|
99
|
+
* otherwise
|
|
68
100
|
*/
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return z.unknown();
|
|
101
|
+
export function hasValue(obj, value, visited = new WeakSet()) {
|
|
102
|
+
// Direct value comparison
|
|
103
|
+
if (obj === value) {
|
|
104
|
+
return true;
|
|
74
105
|
}
|
|
75
|
-
//
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
106
|
+
// Special case: Check for empty objects
|
|
107
|
+
if (typeof obj === 'object' &&
|
|
108
|
+
obj !== null &&
|
|
109
|
+
!Array.isArray(obj) &&
|
|
110
|
+
typeof value === 'object' &&
|
|
111
|
+
value !== null &&
|
|
112
|
+
!Array.isArray(value)) {
|
|
113
|
+
const objKeys = Object.keys(obj);
|
|
114
|
+
const valueKeys = Object.keys(value);
|
|
115
|
+
// Both are empty objects
|
|
116
|
+
if (objKeys.length === 0 && valueKeys.length === 0) {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
84
119
|
}
|
|
85
|
-
|
|
86
|
-
|
|
120
|
+
// Handle primitives that can't contain nested values
|
|
121
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
122
|
+
return false;
|
|
87
123
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return literalPrimitives ? z.literal(value) : z.bigint();
|
|
92
|
-
case 'boolean':
|
|
93
|
-
return literalPrimitives ? z.literal(value) : z.boolean();
|
|
94
|
-
case 'function':
|
|
95
|
-
return FunctionSchema;
|
|
96
|
-
case 'number':
|
|
97
|
-
return literalPrimitives ? z.literal(value) : z.number();
|
|
98
|
-
case 'string':
|
|
99
|
-
return literalPrimitives ? z.literal(value) : z.string();
|
|
100
|
-
case 'symbol':
|
|
101
|
-
return z.symbol();
|
|
124
|
+
// Prevent infinite recursion with circular references
|
|
125
|
+
if (visited.has(obj)) {
|
|
126
|
+
return false;
|
|
102
127
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
if (
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
// Handle built-in object types
|
|
113
|
-
if (value instanceof Date) {
|
|
114
|
-
return z.date();
|
|
115
|
-
}
|
|
116
|
-
if (value instanceof RegExp) {
|
|
117
|
-
if (literalRegExp) {
|
|
118
|
-
return RegExpSchema;
|
|
119
|
-
}
|
|
120
|
-
return z.coerce.string().regex(value);
|
|
121
|
-
}
|
|
122
|
-
if (value instanceof Map) {
|
|
123
|
-
return StrongMapSchema;
|
|
124
|
-
}
|
|
125
|
-
if (value instanceof Set) {
|
|
126
|
-
return StrongSetSchema;
|
|
127
|
-
}
|
|
128
|
-
if (value instanceof WeakMap) {
|
|
129
|
-
return z.instanceof(WeakMap);
|
|
130
|
-
}
|
|
131
|
-
if (value instanceof WeakSet) {
|
|
132
|
-
return z.instanceof(WeakSet);
|
|
133
|
-
}
|
|
134
|
-
if (value instanceof Error) {
|
|
135
|
-
return z.instanceof(Error);
|
|
136
|
-
}
|
|
137
|
-
if (isPromiseLike(value)) {
|
|
138
|
-
return WrappedPromiseLikeSchema;
|
|
139
|
-
}
|
|
140
|
-
// Handle arrays
|
|
141
|
-
if (Array.isArray(value)) {
|
|
142
|
-
if (value.length === 0) {
|
|
143
|
-
return z.array(z.unknown());
|
|
144
|
-
}
|
|
145
|
-
const elementSchemas = value.map((item) => valueToSchema(item, {
|
|
146
|
-
...options,
|
|
147
|
-
_currentDepth: _currentDepth + 1,
|
|
148
|
-
}, visited));
|
|
149
|
-
if (allowMixedArrays) {
|
|
150
|
-
// Create a union of all unique element types
|
|
151
|
-
const uniqueSchemas = Array.from(new Set(elementSchemas.map((schema) => schema.constructor.name))).map((_, index) => elementSchemas[index]);
|
|
152
|
-
if (uniqueSchemas.length === 1) {
|
|
153
|
-
return z.array(uniqueSchemas[0]);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
return z.array(z.union(uniqueSchemas));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
// Use the first element's schema for all elements
|
|
161
|
-
return z.array(elementSchemas[0]);
|
|
128
|
+
visited.add(obj);
|
|
129
|
+
try {
|
|
130
|
+
// Recursively search in object/array values
|
|
131
|
+
if (Array.isArray(obj)) {
|
|
132
|
+
// For arrays, search in each element
|
|
133
|
+
for (const item of obj) {
|
|
134
|
+
if (hasValue(item, value, visited)) {
|
|
135
|
+
return true;
|
|
162
136
|
}
|
|
163
137
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
...options,
|
|
171
|
-
_currentDepth: _currentDepth + 1,
|
|
172
|
-
}, visited);
|
|
173
|
-
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
// For objects, search in each property value
|
|
141
|
+
for (const propValue of Object.values(obj)) {
|
|
142
|
+
if (hasValue(propValue, value, visited)) {
|
|
143
|
+
return true;
|
|
174
144
|
}
|
|
175
|
-
return strict
|
|
176
|
-
? z.strictObject(schemaShape)
|
|
177
|
-
: z.looseObject(schemaShape);
|
|
178
145
|
}
|
|
179
|
-
// Handle other object types (ArrayBuffer, etc.)
|
|
180
|
-
return z.custom((val) => typeof val === 'object' && val !== null, { message: 'Expected an object' });
|
|
181
146
|
}
|
|
182
|
-
|
|
183
|
-
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
visited.delete(obj);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* _Recursively_ searches for a key-value pair within an object or array.
|
|
155
|
+
*
|
|
156
|
+
* Uses strict equality (===) to compare values. Handles circular references by
|
|
157
|
+
* tracking visited objects to prevent infinite recursion.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
*
|
|
161
|
+
* ```ts
|
|
162
|
+
* const obj = { a: 1, b: { c: 2, d: [{ e: 3 }] } };
|
|
163
|
+
*
|
|
164
|
+
* hasKeyValue(obj, 'c', 2); // true
|
|
165
|
+
* hasKeyValue(obj, 'e', 3); // true
|
|
166
|
+
* hasKeyValue(obj, 'a', '1'); // false (strict equality)
|
|
167
|
+
* hasKeyValue(obj, 'x', 1); // false (key not found)
|
|
168
|
+
* /**
|
|
169
|
+
* Maps an array of objects to an object keyed by the specified key.
|
|
170
|
+
*
|
|
171
|
+
* @param collection Array of objects
|
|
172
|
+
* @param key Name of key
|
|
173
|
+
* @returns Object mapping key values to objects
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export function keyBy(collection, key) {
|
|
177
|
+
const result = {};
|
|
178
|
+
for (const item of collection) {
|
|
179
|
+
const keyValue = item[key];
|
|
180
|
+
if (typeof keyValue === 'string' ||
|
|
181
|
+
typeof keyValue === 'number' ||
|
|
182
|
+
typeof keyValue === 'symbol') {
|
|
183
|
+
result[String(keyValue)] = item;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
189
188
|
//# sourceMappingURL=util.js.map
|
package/dist/esm/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively converts an arbitrary value to a Zod v4 schema that would
|
|
4
|
+
* validate values with the same structure.
|
|
5
|
+
*
|
|
6
|
+
* This function analyzes the runtime value and generates a corresponding Zod
|
|
7
|
+
* schema that captures the value's structure and type information. It handles
|
|
8
|
+
* primitives, objects, arrays, functions, and various built-in types, with
|
|
9
|
+
* support for circular reference detection.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Primitive types
|
|
15
|
+
* valueToSchema('hello'); // z.string()
|
|
16
|
+
* valueToSchema(42); // z.number()
|
|
17
|
+
* valueToSchema(true); // z.boolean()
|
|
18
|
+
*
|
|
19
|
+
* // Objects
|
|
20
|
+
* valueToSchema({ name: 'John', age: 30 });
|
|
21
|
+
* // z.object({ name: z.string(), age: z.number() })
|
|
22
|
+
*
|
|
23
|
+
* // Arrays
|
|
24
|
+
* valueToSchema(['a', 'b', 'c']); // z.array(z.string())
|
|
25
|
+
* valueToSchema([1, 'mixed']); // z.array(z.union([z.number(), z.string()]))
|
|
26
|
+
*
|
|
27
|
+
* // Nested structures
|
|
28
|
+
* valueToSchema({ users: [{ name: 'John' }] });
|
|
29
|
+
* // z.object({ users: z.array(z.object({ name: z.string() })) })
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param value - The value to convert to a schema
|
|
33
|
+
* @param options - Configuration options for schema generation
|
|
34
|
+
* @param visited - Internal WeakSet for circular reference detection
|
|
35
|
+
* @returns A Zod schema that validates values matching the input's structure.
|
|
36
|
+
* This value is unfortunately untyped due to the complexity involved. But the
|
|
37
|
+
* schema works!
|
|
38
|
+
*/
|
|
39
|
+
export declare const valueToSchema: (value: unknown, options?: ValueToSchemaOptions, visited?: WeakSet<object>) => z.ZodType<any>;
|
|
40
|
+
/**
|
|
41
|
+
* Options for {@link valueToSchema}
|
|
42
|
+
*/
|
|
43
|
+
export interface ValueToSchemaOptions {
|
|
44
|
+
/**
|
|
45
|
+
* If `true`, treat empty objects `{}` as literal empty objects that only
|
|
46
|
+
* match objects with zero own properties
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue false
|
|
49
|
+
*/
|
|
50
|
+
literalEmptyObjects?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, use literal schema for primitive values instead of type schema
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue false
|
|
55
|
+
*/
|
|
56
|
+
literalPrimitives?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If `true`, treat `RegExp` literals as `RegExp` literals; otherwise treat as
|
|
59
|
+
* strings and attempt match
|
|
60
|
+
*
|
|
61
|
+
* @defaultValue false
|
|
62
|
+
*/
|
|
63
|
+
literalRegExp?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* If `true`, treat arrays as tuples wherever possible.
|
|
66
|
+
*
|
|
67
|
+
* Implies `false` for {@link noMixedArrays}.
|
|
68
|
+
*
|
|
69
|
+
* @defaultValue false
|
|
70
|
+
*/
|
|
71
|
+
literalTuples?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Maximum nesting depth to prevent stack overflow
|
|
74
|
+
*
|
|
75
|
+
* @defaultValue 10
|
|
76
|
+
*/
|
|
77
|
+
maxDepth?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to allow mixed types in arrays
|
|
80
|
+
*
|
|
81
|
+
* If {@link literalTuples} is `true`, this option is ignored and treated as
|
|
82
|
+
* `false`.
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue false
|
|
85
|
+
*/
|
|
86
|
+
noMixedArrays?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* If `true`, will disallow unknown properties in parsed objects
|
|
89
|
+
*
|
|
90
|
+
* @defaultValue false
|
|
91
|
+
*/
|
|
92
|
+
strict?: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Predefined options for {@link valueToSchema} optimized for object satisfaction
|
|
96
|
+
* checks.
|
|
97
|
+
*
|
|
98
|
+
* Uses literal primitives and tuples for exact matching while allowing extra
|
|
99
|
+
* properties.
|
|
100
|
+
*/
|
|
101
|
+
export declare const valueToSchemaOptionsForSatisfies: Readonly<{
|
|
102
|
+
readonly literalEmptyObjects: true;
|
|
103
|
+
readonly literalPrimitives: true;
|
|
104
|
+
readonly literalRegExp: false;
|
|
105
|
+
readonly literalTuples: true;
|
|
106
|
+
readonly strict: false;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Predefined options for {@link valueToSchema} optimized for deep equality
|
|
110
|
+
* checks.
|
|
111
|
+
*
|
|
112
|
+
* Uses literal primitives, regexp, and tuples with strict validation for exact
|
|
113
|
+
* matching.
|
|
114
|
+
*/
|
|
115
|
+
export declare const valueToSchemaOptionsForDeepEqual: Readonly<{
|
|
116
|
+
readonly literalEmptyObjects: true;
|
|
117
|
+
readonly literalPrimitives: true;
|
|
118
|
+
readonly literalRegExp: true;
|
|
119
|
+
readonly literalTuples: true;
|
|
120
|
+
readonly strict: true;
|
|
121
|
+
}>;
|
|
122
|
+
//# sourceMappingURL=value-to-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-to-schema.d.ts","sourceRoot":"","sources":["../../src/value-to-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAiB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,eAAO,MAAM,aAAa,GACxB,OAAO,OAAO,EACd,UAAS,oBAAyB,EAClC,yBAA+B,KAC9B,CAAC,CAAC,OAAO,CAAC,GAAG,CA2Uf,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAQnC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC;;;;;;EAMH,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC;;;;;;EAMH,CAAC"}
|