bupkis 0.1.2 → 0.2.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 +13 -0
- package/README.md +8 -8
- package/dist/commonjs/assertion/assertion-types.d.ts +33 -82
- package/dist/commonjs/assertion/assertion-types.d.ts.map +1 -1
- package/dist/commonjs/assertion/create.d.ts +5 -33
- package/dist/commonjs/assertion/create.d.ts.map +1 -1
- package/dist/commonjs/assertion/create.js +17 -6
- package/dist/commonjs/assertion/create.js.map +1 -1
- package/dist/commonjs/assertion/impl/async.d.ts +5 -5
- package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/async.js +2 -2
- package/dist/commonjs/assertion/impl/async.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync-parametric.d.ts +24 -24
- package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/sync-parametric.js +3 -3
- package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync.d.ts +50 -50
- package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
- package/dist/commonjs/bootstrap.d.ts +71 -61
- package/dist/commonjs/bootstrap.d.ts.map +1 -1
- package/dist/commonjs/bootstrap.js +20 -10
- package/dist/commonjs/bootstrap.js.map +1 -1
- package/dist/commonjs/error.d.ts +12 -5
- package/dist/commonjs/error.d.ts.map +1 -1
- package/dist/commonjs/error.js +19 -4
- package/dist/commonjs/error.js.map +1 -1
- package/dist/commonjs/expect.d.ts +130 -3
- package/dist/commonjs/expect.d.ts.map +1 -1
- package/dist/commonjs/expect.js +115 -0
- package/dist/commonjs/expect.js.map +1 -1
- package/dist/commonjs/guards.d.ts +22 -15
- package/dist/commonjs/guards.d.ts.map +1 -1
- package/dist/commonjs/guards.js +34 -20
- package/dist/commonjs/guards.js.map +1 -1
- package/dist/commonjs/index.d.ts +113 -62
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +44 -42
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/metadata.d.ts +1 -27
- package/dist/commonjs/metadata.d.ts.map +1 -1
- package/dist/commonjs/metadata.js +16 -15
- package/dist/commonjs/metadata.js.map +1 -1
- package/dist/commonjs/schema.d.ts +59 -26
- package/dist/commonjs/schema.d.ts.map +1 -1
- package/dist/commonjs/schema.js +57 -24
- package/dist/commonjs/schema.js.map +1 -1
- package/dist/commonjs/types.d.ts +449 -39
- package/dist/commonjs/types.d.ts.map +1 -1
- package/dist/commonjs/types.js +12 -2
- package/dist/commonjs/types.js.map +1 -1
- package/dist/commonjs/util.d.ts +7 -0
- package/dist/commonjs/util.d.ts.map +1 -1
- package/dist/commonjs/util.js +7 -0
- package/dist/commonjs/util.js.map +1 -1
- package/dist/esm/assertion/assertion-types.d.ts +33 -82
- package/dist/esm/assertion/assertion-types.d.ts.map +1 -1
- package/dist/esm/assertion/create.d.ts +5 -33
- package/dist/esm/assertion/create.d.ts.map +1 -1
- package/dist/esm/assertion/create.js +14 -4
- package/dist/esm/assertion/create.js.map +1 -1
- package/dist/esm/assertion/impl/async.d.ts +5 -5
- package/dist/esm/assertion/impl/async.d.ts.map +1 -1
- package/dist/esm/assertion/impl/async.js +2 -2
- package/dist/esm/assertion/impl/async.js.map +1 -1
- package/dist/esm/assertion/impl/sync-parametric.d.ts +24 -24
- package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
- package/dist/esm/assertion/impl/sync-parametric.js +3 -3
- package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
- package/dist/esm/assertion/impl/sync.d.ts +50 -50
- package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
- package/dist/esm/bootstrap.d.ts +71 -61
- package/dist/esm/bootstrap.d.ts.map +1 -1
- package/dist/esm/bootstrap.js +19 -9
- package/dist/esm/bootstrap.js.map +1 -1
- package/dist/esm/error.d.ts +12 -5
- package/dist/esm/error.d.ts.map +1 -1
- package/dist/esm/error.js +19 -4
- package/dist/esm/error.js.map +1 -1
- package/dist/esm/expect.d.ts +130 -3
- package/dist/esm/expect.d.ts.map +1 -1
- package/dist/esm/expect.js +115 -0
- package/dist/esm/expect.js.map +1 -1
- package/dist/esm/guards.d.ts +22 -15
- package/dist/esm/guards.d.ts.map +1 -1
- package/dist/esm/guards.js +29 -13
- package/dist/esm/guards.js.map +1 -1
- package/dist/esm/index.d.ts +113 -62
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +46 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/metadata.d.ts +1 -27
- package/dist/esm/metadata.d.ts.map +1 -1
- package/dist/esm/metadata.js +2 -1
- package/dist/esm/metadata.js.map +1 -1
- package/dist/esm/schema.d.ts +59 -26
- package/dist/esm/schema.d.ts.map +1 -1
- package/dist/esm/schema.js +57 -24
- package/dist/esm/schema.js.map +1 -1
- package/dist/esm/types.d.ts +449 -39
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +12 -2
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/util.d.ts +7 -0
- package/dist/esm/util.d.ts.map +1 -1
- package/dist/esm/util.js +7 -0
- package/dist/esm/util.js.map +1 -1
- package/package.json +89 -15
- package/src/assertion/assertion-types.ts +38 -41
- package/src/assertion/create.ts +16 -65
- package/src/assertion/impl/async.ts +2 -2
- package/src/assertion/impl/sync-parametric.ts +3 -3
- package/src/bootstrap.ts +21 -10
- package/src/error.ts +21 -4
- package/src/expect.ts +269 -18
- package/src/guards.ts +29 -51
- package/src/index.ts +71 -11
- package/src/metadata.ts +3 -4
- package/src/schema.ts +59 -26
- package/src/types.ts +593 -72
- package/src/util.ts +7 -0
- package/dist/commonjs/api.d.ts +0 -93
- package/dist/commonjs/api.d.ts.map +0 -1
- package/dist/commonjs/api.js +0 -8
- package/dist/commonjs/api.js.map +0 -1
- package/dist/esm/api.d.ts +0 -93
- package/dist/esm/api.d.ts.map +0 -1
- package/dist/esm/api.js +0 -7
- package/dist/esm/api.js.map +0 -1
- package/src/api.ts +0 -149
- package/src/schema.md +0 -15
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
* Defines Bupkis' Zod metadata registry
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
|
+
* @internal
|
|
5
6
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
7
|
import { kStringLiteral } from './constant.js';
|
|
8
|
-
/**
|
|
9
|
-
* Metadata stored in Zod registry
|
|
10
|
-
*
|
|
11
|
-
* @knipignore
|
|
12
|
-
*/
|
|
13
|
-
export type BupkisMeta = z.infer<typeof BupkisRegistrySchema>;
|
|
14
8
|
/**
|
|
15
9
|
* Zod metadata registry for Bupkis
|
|
16
10
|
*/
|
|
@@ -30,24 +24,4 @@ export declare const BupkisRegistry: z.core.$ZodRegistry<{
|
|
|
30
24
|
description?: string | undefined;
|
|
31
25
|
name?: string | undefined;
|
|
32
26
|
}, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
33
|
-
/**
|
|
34
|
-
* Final schema for Bupkis registry
|
|
35
|
-
*/
|
|
36
|
-
declare const BupkisRegistrySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
37
|
-
description: z.ZodOptional<z.ZodString>;
|
|
38
|
-
name: z.ZodOptional<z.ZodString>;
|
|
39
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
-
value: z.ZodString;
|
|
41
|
-
values: z.ZodOptional<z.ZodNever>;
|
|
42
|
-
[kStringLiteral]: z.ZodLiteral<true>;
|
|
43
|
-
description: z.ZodOptional<z.ZodString>;
|
|
44
|
-
name: z.ZodOptional<z.ZodString>;
|
|
45
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
-
value: z.ZodOptional<z.ZodNever>;
|
|
47
|
-
values: z.ZodReadonly<z.ZodTuple<[z.ZodString], z.ZodString>>;
|
|
48
|
-
[kStringLiteral]: z.ZodLiteral<true>;
|
|
49
|
-
description: z.ZodOptional<z.ZodString>;
|
|
50
|
-
name: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.core.$strip>]>;
|
|
52
|
-
export {};
|
|
53
27
|
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/C;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;iFAA2B,CAAC"}
|
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
* Defines Bupkis' Zod metadata registry
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
|
+
* @internal
|
|
6
7
|
*/
|
|
7
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
9
|
exports.BupkisRegistry = void 0;
|
|
9
|
-
const
|
|
10
|
+
const v4_1 = require("zod/v4");
|
|
10
11
|
const constant_js_1 = require("./constant.js");
|
|
11
12
|
/**
|
|
12
13
|
* Zod metadata registry for Bupkis
|
|
13
14
|
*/
|
|
14
|
-
exports.BupkisRegistry =
|
|
15
|
+
exports.BupkisRegistry = v4_1.z.registry();
|
|
15
16
|
/**
|
|
16
17
|
* Base schema for all metadata
|
|
17
18
|
*/
|
|
18
|
-
const BaseBupkisMetadataSchema =
|
|
19
|
-
description:
|
|
20
|
-
name:
|
|
19
|
+
const BaseBupkisMetadataSchema = v4_1.z.object({
|
|
20
|
+
description: v4_1.z.string().optional().describe('Human-friendly description'),
|
|
21
|
+
name: v4_1.z
|
|
21
22
|
.string()
|
|
22
23
|
.optional()
|
|
23
24
|
.describe('Internal name; used by Assertion.prototype.toString()'),
|
|
@@ -25,27 +26,27 @@ const BaseBupkisMetadataSchema = zod_1.z.object({
|
|
|
25
26
|
/**
|
|
26
27
|
* Base schema for metadata referring to string literal flag
|
|
27
28
|
*/
|
|
28
|
-
const StringLiteralFlagSchema =
|
|
29
|
+
const StringLiteralFlagSchema = v4_1.z.object({
|
|
29
30
|
...BaseBupkisMetadataSchema.shape,
|
|
30
|
-
[constant_js_1.kStringLiteral]:
|
|
31
|
+
[constant_js_1.kStringLiteral]: v4_1.z.literal(true),
|
|
31
32
|
});
|
|
32
33
|
/**
|
|
33
34
|
* Final schema for Bupkis registry
|
|
34
35
|
*/
|
|
35
36
|
// TODO: Figure out how to make this rule allow type-only usage. Or just export it and tag it.
|
|
36
37
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
|
-
const BupkisRegistrySchema =
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const BupkisRegistrySchema = v4_1.z.union([
|
|
39
|
+
v4_1.z.object({ ...BaseBupkisMetadataSchema.shape }),
|
|
40
|
+
v4_1.z.object({
|
|
40
41
|
...StringLiteralFlagSchema.shape,
|
|
41
|
-
value:
|
|
42
|
-
values:
|
|
42
|
+
value: v4_1.z.string(),
|
|
43
|
+
values: v4_1.z.never().optional(),
|
|
43
44
|
}),
|
|
44
|
-
|
|
45
|
+
v4_1.z.object({
|
|
45
46
|
...StringLiteralFlagSchema.shape,
|
|
46
|
-
value:
|
|
47
|
+
value: v4_1.z.never().optional(),
|
|
47
48
|
// eslint-disable-next-line no-restricted-syntax
|
|
48
|
-
values:
|
|
49
|
+
values: v4_1.z.tuple([v4_1.z.string()]).rest(v4_1.z.string()).readonly(),
|
|
49
50
|
}),
|
|
50
51
|
]);
|
|
51
52
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/metadata.ts"],"names":[],"mappings":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AC"}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Zod
|
|
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
|
|
7
|
-
*
|
|
6
|
+
* throughout the assertion system. These tend to work around the impedence
|
|
7
|
+
* mismatch between **BUPKIS** and Zod.
|
|
8
8
|
*
|
|
9
9
|
* These are used internally, but consumers may also find them useful.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* For example, we have {@link FunctionSchema} which accepts any
|
|
12
|
+
* function—regardless of its signature. We need this because Zod v4's
|
|
13
|
+
* `z.function()` no longer returns a `ZodType` (ref:
|
|
14
|
+
* {@link https://zod.dev/v4/changelog | Zod v4 Migration Guide}) and so behaves
|
|
15
|
+
* differently. `FunctionSchema` allows us to work with functions as _values_
|
|
16
|
+
* instead of something to be implemented.
|
|
17
|
+
*
|
|
18
|
+
* Similarly—but not a new development—`z.promise()` does not parse a
|
|
19
|
+
* {@link Promise} object; it parses the _fulfilled value_. This is not what we
|
|
20
|
+
* want for "is a Promise" assertions, but it _can_ be useful for making sense
|
|
21
|
+
* of the fulfilled value. To solve this, we have
|
|
22
|
+
* {@link WrappedPromiseLikeSchema} (which explicitly supports
|
|
23
|
+
* {@link PromiseLike}/"thenable" objects).
|
|
24
|
+
*
|
|
25
|
+
* @category API
|
|
26
|
+
* @example
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* import * as schema from 'bupkis/schema';
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
12
32
|
* @packageDocumentation
|
|
13
33
|
*/
|
|
14
34
|
import { z } from 'zod/v4';
|
|
15
|
-
import { type Constructor } from './types.js';
|
|
35
|
+
import { type Constructor, type MutableOrReadonly } from './types.js';
|
|
16
36
|
/**
|
|
17
37
|
* A Zod schema that validates JavaScript classes or constructor functions.
|
|
18
38
|
*
|
|
@@ -21,10 +41,9 @@ import { type Constructor } from './types.js';
|
|
|
21
41
|
* uses the {@link isConstructable} guard function to determine if a value can be
|
|
22
42
|
* invoked with the `new` operator to create object instances.
|
|
23
43
|
*
|
|
24
|
-
* @
|
|
44
|
+
* @privateRemarks
|
|
25
45
|
* The schema is registered in the {@link BupkisRegistry} with the name
|
|
26
46
|
* `ClassSchema` for later reference and type checking purposes.
|
|
27
|
-
* @category Schema
|
|
28
47
|
* @example
|
|
29
48
|
*
|
|
30
49
|
* ```typescript
|
|
@@ -38,6 +57,8 @@ import { type Constructor } from './types.js';
|
|
|
38
57
|
* ClassSchema.parse(() => {}); // ✗ Throws validation error
|
|
39
58
|
* ClassSchema.parse({}); // ✗ Throws validation error
|
|
40
59
|
* ```
|
|
60
|
+
*
|
|
61
|
+
* @group Schema
|
|
41
62
|
*/
|
|
42
63
|
export declare const ClassSchema: z.ZodCustom<Constructor, Constructor>;
|
|
43
64
|
/**
|
|
@@ -49,10 +70,9 @@ export declare const ClassSchema: z.ZodCustom<Constructor, Constructor>;
|
|
|
49
70
|
* including regular functions, arrow functions, async functions, generator
|
|
50
71
|
* functions, and methods.
|
|
51
72
|
*
|
|
52
|
-
* @
|
|
73
|
+
* @privateRemarks
|
|
53
74
|
* The schema is registered in the {@link BupkisRegistry} with the name
|
|
54
75
|
* `FunctionSchema` for later reference and type checking purposes.
|
|
55
|
-
* @category Schema
|
|
56
76
|
* @example
|
|
57
77
|
*
|
|
58
78
|
* ```typescript
|
|
@@ -64,8 +84,10 @@ export declare const ClassSchema: z.ZodCustom<Constructor, Constructor>;
|
|
|
64
84
|
* FunctionSchema.parse('not a function'); // ✗ Throws validation error
|
|
65
85
|
* FunctionSchema.parse({}); // ✗ Throws validation error
|
|
66
86
|
* ```
|
|
87
|
+
*
|
|
88
|
+
* @group Schema
|
|
67
89
|
*/
|
|
68
|
-
export declare const FunctionSchema: z.ZodCustom<(...args:
|
|
90
|
+
export declare const FunctionSchema: z.ZodCustom<(...args: MutableOrReadonly<unknown[]>) => unknown, (...args: MutableOrReadonly<unknown[]>) => unknown>;
|
|
69
91
|
/**
|
|
70
92
|
* A Zod schema that validates JavaScript property keys.
|
|
71
93
|
*
|
|
@@ -74,10 +96,9 @@ export declare const FunctionSchema: z.ZodCustom<(...args: any[]) => any, (...ar
|
|
|
74
96
|
* types that JavaScript automatically converts to property keys when used in
|
|
75
97
|
* object access or assignment operations.
|
|
76
98
|
*
|
|
77
|
-
* @
|
|
99
|
+
* @privateRemarks
|
|
78
100
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
79
101
|
* `PropertyKeySchema` for later reference and type checking purposes.
|
|
80
|
-
* @category Schema
|
|
81
102
|
* @example
|
|
82
103
|
*
|
|
83
104
|
* ```typescript
|
|
@@ -87,6 +108,8 @@ export declare const FunctionSchema: z.ZodCustom<(...args: any[]) => any, (...ar
|
|
|
87
108
|
* PropertyKeySchema.parse({}); // ✗ Throws validation error
|
|
88
109
|
* PropertyKeySchema.parse(null); // ✗ Throws validation error
|
|
89
110
|
* ```
|
|
111
|
+
*
|
|
112
|
+
* @group Schema
|
|
90
113
|
*/
|
|
91
114
|
export declare const PropertyKeySchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodSymbol]>;
|
|
92
115
|
/**
|
|
@@ -98,12 +121,11 @@ export declare const PropertyKeySchema: z.ZodUnion<readonly [z.ZodString, z.ZodN
|
|
|
98
121
|
* resolved value, meaning the result of parsing remains a Promise or thenable
|
|
99
122
|
* object.
|
|
100
123
|
*
|
|
101
|
-
* @
|
|
124
|
+
* @privateRemarks
|
|
102
125
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
103
126
|
* `WrappedPromiseLikeSchema` for later reference and type checking purposes.
|
|
104
127
|
* This is useful when you need to validate that something is thenable without
|
|
105
128
|
* automatically resolving it.
|
|
106
|
-
* @category Schema
|
|
107
129
|
* @example
|
|
108
130
|
*
|
|
109
131
|
* ```typescript
|
|
@@ -112,6 +134,8 @@ export declare const PropertyKeySchema: z.ZodUnion<readonly [z.ZodString, z.ZodN
|
|
|
112
134
|
* WrappedPromiseLikeSchema.parse(42); // ✗ Throws validation error
|
|
113
135
|
* WrappedPromiseLikeSchema.parse({}); // ✗ Throws validation error
|
|
114
136
|
* ```
|
|
137
|
+
*
|
|
138
|
+
* @group Schema
|
|
115
139
|
*/
|
|
116
140
|
export declare const WrappedPromiseLikeSchema: z.ZodCustom<PromiseLike<unknown>, PromiseLike<unknown>>;
|
|
117
141
|
/**
|
|
@@ -125,7 +149,6 @@ export declare const WrappedPromiseLikeSchema: z.ZodCustom<PromiseLike<unknown>,
|
|
|
125
149
|
* @remarks
|
|
126
150
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
127
151
|
* `StrongMapSchema` for later reference and type checking purposes.
|
|
128
|
-
* @category Schema
|
|
129
152
|
* @example
|
|
130
153
|
*
|
|
131
154
|
* ```typescript
|
|
@@ -138,6 +161,8 @@ export declare const WrappedPromiseLikeSchema: z.ZodCustom<PromiseLike<unknown>,
|
|
|
138
161
|
* const weakMap = new WeakMap();
|
|
139
162
|
* StrongMapSchema.parse(weakMap); // ✗ Throws validation error
|
|
140
163
|
* ```
|
|
164
|
+
*
|
|
165
|
+
* @group Schema
|
|
141
166
|
*/
|
|
142
167
|
export declare const StrongMapSchema: z.ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>>;
|
|
143
168
|
/**
|
|
@@ -151,7 +176,6 @@ export declare const StrongMapSchema: z.ZodCustom<Map<unknown, unknown>, Map<unk
|
|
|
151
176
|
* @remarks
|
|
152
177
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
153
178
|
* `StrongSetSchema` for later reference and type checking purposes.
|
|
154
|
-
* @category Schema
|
|
155
179
|
* @example
|
|
156
180
|
*
|
|
157
181
|
* ```typescript
|
|
@@ -161,6 +185,8 @@ export declare const StrongMapSchema: z.ZodCustom<Map<unknown, unknown>, Map<unk
|
|
|
161
185
|
* const weakSet = new WeakSet();
|
|
162
186
|
* StrongSetSchema.parse(weakSet); // ✗ Throws validation error
|
|
163
187
|
* ```
|
|
188
|
+
*
|
|
189
|
+
* @group Schema
|
|
164
190
|
*/
|
|
165
191
|
export declare const StrongSetSchema: z.ZodCustom<Set<unknown>, Set<unknown>>;
|
|
166
192
|
/**
|
|
@@ -175,7 +201,6 @@ export declare const StrongSetSchema: z.ZodCustom<Set<unknown>, Set<unknown>>;
|
|
|
175
201
|
* @remarks
|
|
176
202
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
177
203
|
* `ObjectWithNullPrototype` for later reference and type checking purposes.
|
|
178
|
-
* @category Schema
|
|
179
204
|
* @example
|
|
180
205
|
*
|
|
181
206
|
* ```typescript
|
|
@@ -189,6 +214,8 @@ export declare const StrongSetSchema: z.ZodCustom<Set<unknown>, Set<unknown>>;
|
|
|
189
214
|
* const emptyObj = {};
|
|
190
215
|
* NullProtoObjectSchema.parse(emptyObj); // ✗ Throws validation error
|
|
191
216
|
* ```
|
|
217
|
+
*
|
|
218
|
+
* @group Schema
|
|
192
219
|
*/
|
|
193
220
|
export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unknown>, Record<PropertyKey, unknown>>;
|
|
194
221
|
/**
|
|
@@ -205,7 +232,6 @@ export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unkn
|
|
|
205
232
|
* schema cannot reliably detect functions that return Promises but are not
|
|
206
233
|
* declared with `async`, as this determination requires static analysis that is
|
|
207
234
|
* not available at runtime.
|
|
208
|
-
* @category Schema
|
|
209
235
|
* @example
|
|
210
236
|
*
|
|
211
237
|
* ```typescript
|
|
@@ -225,8 +251,10 @@ export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unkn
|
|
|
225
251
|
* const regularFn = () => 42;
|
|
226
252
|
* AsyncFunctionSchema.parse(regularFn); // ✗ Throws validation error
|
|
227
253
|
* ```
|
|
254
|
+
*
|
|
255
|
+
* @group Schema
|
|
228
256
|
*/
|
|
229
|
-
export declare const AsyncFunctionSchema: z.ZodCustom<(...args:
|
|
257
|
+
export declare const AsyncFunctionSchema: z.ZodCustom<(...args: MutableOrReadonly<unknown[]>) => unknown, (...args: MutableOrReadonly<unknown[]>) => unknown>;
|
|
230
258
|
/**
|
|
231
259
|
* A Zod schema that validates truthy JavaScript values.
|
|
232
260
|
*
|
|
@@ -238,7 +266,6 @@ export declare const AsyncFunctionSchema: z.ZodCustom<(...args: any[]) => any, (
|
|
|
238
266
|
* @remarks
|
|
239
267
|
* The schema is registered in the `BupkisRegistry` with the name `Truthy` and
|
|
240
268
|
* indicates that it accepts anything as valid input for evaluation.
|
|
241
|
-
* @category Schema
|
|
242
269
|
* @example
|
|
243
270
|
*
|
|
244
271
|
* ```typescript
|
|
@@ -252,6 +279,8 @@ export declare const AsyncFunctionSchema: z.ZodCustom<(...args: any[]) => any, (
|
|
|
252
279
|
* TruthySchema.parse(''); // ✗ Throws validation error
|
|
253
280
|
* TruthySchema.parse(null); // ✗ Throws validation error
|
|
254
281
|
* ```
|
|
282
|
+
*
|
|
283
|
+
* @group Schema
|
|
255
284
|
*/
|
|
256
285
|
export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
|
|
257
286
|
/**
|
|
@@ -265,7 +294,6 @@ export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
|
|
|
265
294
|
* @remarks
|
|
266
295
|
* The schema is registered in the `BupkisRegistry` with the name `Falsy` and
|
|
267
296
|
* indicates that it accepts anything as valid input for evaluation.
|
|
268
|
-
* @category Schema
|
|
269
297
|
* @example
|
|
270
298
|
*
|
|
271
299
|
* ```typescript
|
|
@@ -282,6 +310,8 @@ export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
|
|
|
282
310
|
* FalsySchema.parse('hello'); // ✗ Throws validation error
|
|
283
311
|
* FalsySchema.parse({}); // ✗ Throws validation error
|
|
284
312
|
* ```
|
|
313
|
+
*
|
|
314
|
+
* @group Schema
|
|
285
315
|
*/
|
|
286
316
|
export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
|
|
287
317
|
/**
|
|
@@ -296,7 +326,6 @@ export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
|
|
|
296
326
|
* @remarks
|
|
297
327
|
* The schema is registered in the `BupkisRegistry` with the name `Primitive`
|
|
298
328
|
* and indicates that it accepts primitive values as valid input.
|
|
299
|
-
* @category Schema
|
|
300
329
|
* @example
|
|
301
330
|
*
|
|
302
331
|
* ```typescript
|
|
@@ -311,6 +340,8 @@ export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
|
|
|
311
340
|
* PrimitiveSchema.parse([]); // ✗ Throws validation error (array)
|
|
312
341
|
* PrimitiveSchema.parse(() => {}); // ✗ Throws validation error (function)
|
|
313
342
|
* ```
|
|
343
|
+
*
|
|
344
|
+
* @group Schema
|
|
314
345
|
*/
|
|
315
346
|
export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodBigInt, z.ZodSymbol, z.ZodNull, z.ZodUndefined]>;
|
|
316
347
|
/**
|
|
@@ -323,12 +354,11 @@ export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNum
|
|
|
323
354
|
* it useful for validating collections where the specific array mutability or
|
|
324
355
|
* tuple structure is not critical.
|
|
325
356
|
*
|
|
326
|
-
* @
|
|
357
|
+
* @privateRemarks
|
|
327
358
|
* The schema is registered in the {@link BupkisRegistry} with the name
|
|
328
359
|
* `ArrayLike` for later reference and type checking purposes. This schema is
|
|
329
360
|
* particularly useful when you need to accept various forms of array-like data
|
|
330
361
|
* without being restrictive about mutability or exact tuple structure.
|
|
331
|
-
* @category Schema
|
|
332
362
|
* @example
|
|
333
363
|
*
|
|
334
364
|
* ```typescript
|
|
@@ -340,8 +370,10 @@ export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNum
|
|
|
340
370
|
* ArrayLikeSchema.parse({}); // ✗ Throws validation error
|
|
341
371
|
* ArrayLikeSchema.parse(null); // ✗ Throws validation error
|
|
342
372
|
* ```
|
|
373
|
+
*
|
|
374
|
+
* @group Schema
|
|
343
375
|
*/
|
|
344
|
-
export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.
|
|
376
|
+
export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
|
|
345
377
|
length: z.ZodNumber;
|
|
346
378
|
}, z.core.$loose>]>;
|
|
347
379
|
/**
|
|
@@ -356,7 +388,6 @@ export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>,
|
|
|
356
388
|
* @remarks
|
|
357
389
|
* The schema is registered in the `BupkisRegistry` with the name `RegExp` for
|
|
358
390
|
* later reference and type checking purposes.
|
|
359
|
-
* @category Schema
|
|
360
391
|
* @example
|
|
361
392
|
*
|
|
362
393
|
* ```typescript
|
|
@@ -368,6 +399,8 @@ export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>,
|
|
|
368
399
|
* RegExpSchema.parse(/abc/.source); // ✗ Throws validation error (string pattern)
|
|
369
400
|
* RegExpSchema.parse({}); // ✗ Throws validation error (object)
|
|
370
401
|
* ```
|
|
402
|
+
*
|
|
403
|
+
* @group Schema
|
|
371
404
|
*/
|
|
372
405
|
export declare const RegExpSchema: z.ZodCustom<RegExp, RegExp>;
|
|
373
406
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAU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