bupkis 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +16 -16
- 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 +39 -84
- 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/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 +122 -21
- package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/async.js +114 -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-esoteric.js +1 -1
- package/dist/commonjs/assertion/impl/sync-esoteric.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync-parametric.d.ts +37 -34
- package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
- package/dist/commonjs/assertion/impl/sync-parametric.js +32 -47
- package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
- package/dist/commonjs/assertion/impl/sync.d.ts +105 -58
- 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 +199 -85
- package/dist/commonjs/bootstrap.d.ts.map +1 -1
- package/dist/commonjs/bootstrap.js +19 -10
- package/dist/commonjs/bootstrap.js.map +1 -1
- package/dist/commonjs/constant.js +7 -1
- package/dist/commonjs/constant.js.map +1 -1
- package/dist/commonjs/error.d.ts +32 -5
- package/dist/commonjs/error.d.ts.map +1 -1
- package/dist/commonjs/error.js +60 -5
- 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 +116 -1
- package/dist/commonjs/expect.js.map +1 -1
- package/dist/commonjs/guards.d.ts +45 -20
- package/dist/commonjs/guards.d.ts.map +1 -1
- package/dist/commonjs/guards.js +56 -40
- package/dist/commonjs/guards.js.map +1 -1
- package/dist/commonjs/index.d.ts +241 -86
- 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 +76 -33
- package/dist/commonjs/schema.d.ts.map +1 -1
- package/dist/commonjs/schema.js +77 -34
- package/dist/commonjs/schema.js.map +1 -1
- package/dist/commonjs/types.d.ts +480 -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 +72 -49
- package/dist/commonjs/util.d.ts.map +1 -1
- package/dist/commonjs/util.js +175 -155
- 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 +309 -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 +39 -84
- 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/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 +122 -21
- package/dist/esm/assertion/impl/async.d.ts.map +1 -1
- package/dist/esm/assertion/impl/async.js +113 -89
- 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-esoteric.js +2 -2
- package/dist/esm/assertion/impl/sync-esoteric.js.map +1 -1
- package/dist/esm/assertion/impl/sync-parametric.d.ts +37 -34
- package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
- package/dist/esm/assertion/impl/sync-parametric.js +32 -47
- package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
- package/dist/esm/assertion/impl/sync.d.ts +105 -58
- 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 +199 -85
- package/dist/esm/bootstrap.d.ts.map +1 -1
- package/dist/esm/bootstrap.js +19 -10
- package/dist/esm/bootstrap.js.map +1 -1
- package/dist/esm/constant.js +6 -0
- package/dist/esm/constant.js.map +1 -1
- package/dist/esm/error.d.ts +32 -5
- package/dist/esm/error.d.ts.map +1 -1
- package/dist/esm/error.js +59 -5
- 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 +117 -2
- package/dist/esm/expect.js.map +1 -1
- package/dist/esm/guards.d.ts +45 -20
- package/dist/esm/guards.d.ts.map +1 -1
- package/dist/esm/guards.js +48 -31
- package/dist/esm/guards.js.map +1 -1
- package/dist/esm/index.d.ts +241 -86
- 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 +76 -33
- package/dist/esm/schema.d.ts.map +1 -1
- package/dist/esm/schema.js +77 -34
- package/dist/esm/schema.js.map +1 -1
- package/dist/esm/types.d.ts +480 -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 +72 -49
- package/dist/esm/util.d.ts.map +1 -1
- package/dist/esm/util.js +159 -153
- 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 +305 -0
- package/dist/esm/value-to-schema.js.map +1 -0
- package/package.json +94 -17
- package/src/assertion/assertion-async.ts +113 -3
- package/src/assertion/assertion-sync.ts +5 -2
- package/src/assertion/assertion-types.ts +52 -45
- package/src/assertion/assertion.ts +2 -17
- package/src/assertion/create.ts +16 -65
- package/src/assertion/impl/async.ts +132 -92
- package/src/assertion/impl/callback.ts +882 -0
- package/src/assertion/impl/index.ts +1 -1
- package/src/assertion/impl/sync-esoteric.ts +2 -2
- package/src/assertion/impl/sync-parametric.ts +41 -49
- package/src/assertion/impl/sync.ts +3 -0
- package/src/bootstrap.ts +21 -11
- package/src/constant.ts +8 -0
- package/src/error.ts +75 -4
- package/src/expect.ts +275 -20
- package/src/guards.ts +74 -69
- package/src/index.ts +72 -11
- package/src/metadata.ts +3 -4
- package/src/schema.ts +80 -36
- package/src/types.ts +625 -72
- package/src/util.ts +174 -222
- package/src/value-to-schema.ts +464 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
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,KAAK,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,CAAC;AAEb;;GAEG;AACH,YAAY,EACV,MAAM,EACN,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,EACN,WAAW,EACX,MAAM,EACN,KAAK,EACL,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAC5D,QAAA;AACE;;;;;;;GAOG;AACH,eAAe;AACf;;;;;;;GAOG;AACH,oBAAoB;AACpB;;;;GAIG;AACH,IAAI;AACJ;;;;GAIG;AACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;icAEgB,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -7,54 +7,56 @@
|
|
|
7
7
|
* guards, schema definitions, utility functions, and error types.
|
|
8
8
|
*
|
|
9
9
|
* @module bupkis
|
|
10
|
+
* @category API
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { expect, expectAsync, z, createAssertion } from 'bupkis';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @showGroups
|
|
10
18
|
*/
|
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(o, k2, desc);
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
-
}) : function(o, v) {
|
|
25
|
-
o["default"] = v;
|
|
26
|
-
});
|
|
27
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
-
var ownKeys = function(o) {
|
|
29
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
-
var ar = [];
|
|
31
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
-
return ar;
|
|
33
|
-
};
|
|
34
|
-
return ownKeys(o);
|
|
35
|
-
};
|
|
36
|
-
return function (mod) {
|
|
37
|
-
if (mod && mod.__esModule) return mod;
|
|
38
|
-
var result = {};
|
|
39
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
-
__setModuleDefault(result, mod);
|
|
41
|
-
return result;
|
|
42
|
-
};
|
|
43
|
-
})();
|
|
44
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.use = exports.fail = exports.createAsyncAssertion = exports.createAssertion = exports.z = exports.
|
|
20
|
+
exports.use = exports.fail = exports.createAsyncAssertion = exports.createAssertion = exports.z = exports.AssertionError = exports.expectAsync = exports.expect = void 0;
|
|
21
|
+
const v4_1 = require("zod/v4");
|
|
22
|
+
Object.defineProperty(exports, "z", { enumerable: true, get: function () { return v4_1.z; } });
|
|
46
23
|
const bootstrap_js_1 = require("./bootstrap.js");
|
|
47
|
-
exports.assertion = __importStar(require("./assertion/index.js"));
|
|
48
24
|
var bootstrap_js_2 = require("./bootstrap.js");
|
|
49
25
|
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return bootstrap_js_2.expect; } });
|
|
50
26
|
Object.defineProperty(exports, "expectAsync", { enumerable: true, get: function () { return bootstrap_js_2.expectAsync; } });
|
|
51
|
-
|
|
52
|
-
exports
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
27
|
+
var error_js_1 = require("./error.js");
|
|
28
|
+
Object.defineProperty(exports, "AssertionError", { enumerable: true, get: function () { return error_js_1.AssertionError; } });
|
|
29
|
+
const {
|
|
30
|
+
/**
|
|
31
|
+
* The main factory function for creating asynchronous assertions.
|
|
32
|
+
*
|
|
33
|
+
* Exported from the entry point; is also a property of {@link Expect} and
|
|
34
|
+
* {@link ExpectAsync}.
|
|
35
|
+
*
|
|
36
|
+
* @function
|
|
37
|
+
*/
|
|
38
|
+
createAssertion,
|
|
39
|
+
/**
|
|
40
|
+
* The main factory function for creating asynchronous assertions.
|
|
41
|
+
*
|
|
42
|
+
* Exported from the entry point; is also a property of {@link Expect} and
|
|
43
|
+
* {@link ExpectAsync}.
|
|
44
|
+
*
|
|
45
|
+
* @function
|
|
46
|
+
*/
|
|
47
|
+
createAsyncAssertion,
|
|
48
|
+
/**
|
|
49
|
+
* {@inheritDoc FailFn}
|
|
50
|
+
*
|
|
51
|
+
* @function
|
|
52
|
+
*/
|
|
53
|
+
fail,
|
|
54
|
+
/**
|
|
55
|
+
* {@inheritDoc UseFn}
|
|
56
|
+
*
|
|
57
|
+
* @function
|
|
58
|
+
*/
|
|
59
|
+
use, ..._rest } = bootstrap_js_1.expect;
|
|
58
60
|
exports.createAssertion = createAssertion;
|
|
59
61
|
exports.createAsyncAssertion = createAsyncAssertion;
|
|
60
62
|
exports.fail = fail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,+BAA2B;AAuBlB,kFAvBA,MAAC,OAuBA;AArBV,iDAA6D;AAC7D,+CAAqD;AAA5C,sGAAA,MAAM,OAAA;AAAE,2GAAA,WAAW,OAAA;AAE5B,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AAkCvB,MAAM;AACJ;;;;;;;GAOG;AACH,eAAe;AACf;;;;;;;GAOG;AACH,oBAAoB;AACpB;;;;GAIG;AACH,IAAI;AACJ;;;;GAIG;AACH,GAAG,EACH,GAAG,KAAK,EACT,GAAG,qBAAiB,CAAC;AAjCb,0CAAe;AAAE,oDAAoB;AAAE,oBAAI;AAAE,kBAAG"}
|
|
@@ -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":";AAAA;;;;;GAKG;;;AAEH,+BAA2B;AAE3B,+CAA+C;AAO/C;;GAEG;AACU,QAAA,cAAc,GAAG,MAAC,CAAC,QAAQ,EAAc,CAAC;AAEvD;;GAEG;AACH,MAAM,wBAAwB,GAAG,MAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACzE,IAAI,EAAE,MAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;CACrE,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,uBAAuB,GAAG,MAAC,CAAC,MAAM,CAAC;IACvC,GAAG,wBAAwB,CAAC,KAAK;IACjC,CAAC,4BAAc,CAAC,EAAE,MAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACH,8FAA8F;AAC9F,6DAA6D;AAC7D,MAAM,oBAAoB,GAAG,MAAC,CAAC,KAAK,CAAC;IACnC,MAAC,CAAC,MAAM,CAAC,EAAE,GAAG,wBAAwB,CAAC,KAAK,EAAE,CAAC;IAC/C,MAAC,CAAC,MAAM,CAAC;QACP,GAAG,uBAAuB,CAAC,KAAK;QAChC,KAAK,EAAE,MAAC,CAAC,MAAM,EAAE;QACjB,MAAM,EAAE,MAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;KAC7B,CAAC;IACF,MAAC,CAAC,MAAM,CAAC;QACP,GAAG,uBAAuB,CAAC,KAAK;QAChC,KAAK,EAAE,MAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QAC3B,gDAAgD;QAChD,MAAM,EAAE,MAAC,CAAC,KAAK,CAAC,CAAC,MAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KAC1D,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1,30 +1,49 @@
|
|
|
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 impedance
|
|
7
|
+
* mismatch between **BUPKIS** and Zod.
|
|
8
8
|
*
|
|
9
9
|
* These are used internally, but consumers may also find them useful.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
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
|
*
|
|
19
39
|
* This schema validates values that can be used as constructors, including ES6
|
|
20
40
|
* classes, traditional constructor functions, and built-in constructors. It
|
|
21
|
-
* uses the {@link
|
|
41
|
+
* uses the {@link isConstructible} 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
|
/**
|
|
@@ -172,10 +198,12 @@ export declare const StrongSetSchema: z.ZodCustom<Set<unknown>, Set<unknown>>;
|
|
|
172
198
|
* `Object.prototype`, making them useful as pure data containers or
|
|
173
199
|
* dictionaries.
|
|
174
200
|
*
|
|
175
|
-
* @
|
|
201
|
+
* @privateRemarks
|
|
176
202
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
177
203
|
* `ObjectWithNullPrototype` for later reference and type checking purposes.
|
|
178
|
-
*
|
|
204
|
+
*
|
|
205
|
+
* Changing this to be a `ZodRecord` would be nice, but that would end up
|
|
206
|
+
* blasting away the original object's prototype.
|
|
179
207
|
* @example
|
|
180
208
|
*
|
|
181
209
|
* ```typescript
|
|
@@ -189,6 +217,15 @@ export declare const StrongSetSchema: z.ZodCustom<Set<unknown>, Set<unknown>>;
|
|
|
189
217
|
* const emptyObj = {};
|
|
190
218
|
* NullProtoObjectSchema.parse(emptyObj); // ✗ Throws validation error
|
|
191
219
|
* ```
|
|
220
|
+
*
|
|
221
|
+
* @group Schema
|
|
222
|
+
* @see Aliases: {@link NullProtoObjectSchema}, {@link DictionarySchema}
|
|
223
|
+
*/
|
|
224
|
+
export declare const DictionarySchema: z.ZodCustom<Record<PropertyKey, unknown>, Record<PropertyKey, unknown>>;
|
|
225
|
+
/**
|
|
226
|
+
* {@inheritDoc DictionarySchema}
|
|
227
|
+
*
|
|
228
|
+
* @group Schema
|
|
192
229
|
*/
|
|
193
230
|
export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unknown>, Record<PropertyKey, unknown>>;
|
|
194
231
|
/**
|
|
@@ -199,13 +236,12 @@ export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unkn
|
|
|
199
236
|
* function's internal `[[ToString]]` representation to distinguish async
|
|
200
237
|
* functions from regular functions that might return Promises.
|
|
201
238
|
*
|
|
202
|
-
* @
|
|
239
|
+
* @privateRemarks
|
|
203
240
|
* The schema is registered in the `BupkisRegistry` with the name
|
|
204
241
|
* `AsyncFunctionSchema` for later reference and type checking purposes. This
|
|
205
242
|
* schema cannot reliably detect functions that return Promises but are not
|
|
206
243
|
* declared with `async`, as this determination requires static analysis that is
|
|
207
244
|
* not available at runtime.
|
|
208
|
-
* @category Schema
|
|
209
245
|
* @example
|
|
210
246
|
*
|
|
211
247
|
* ```typescript
|
|
@@ -225,8 +261,10 @@ export declare const NullProtoObjectSchema: z.ZodCustom<Record<PropertyKey, unkn
|
|
|
225
261
|
* const regularFn = () => 42;
|
|
226
262
|
* AsyncFunctionSchema.parse(regularFn); // ✗ Throws validation error
|
|
227
263
|
* ```
|
|
264
|
+
*
|
|
265
|
+
* @group Schema
|
|
228
266
|
*/
|
|
229
|
-
export declare const AsyncFunctionSchema: z.ZodCustom<(...args:
|
|
267
|
+
export declare const AsyncFunctionSchema: z.ZodCustom<(...args: MutableOrReadonly<unknown[]>) => unknown, (...args: MutableOrReadonly<unknown[]>) => unknown>;
|
|
230
268
|
/**
|
|
231
269
|
* A Zod schema that validates truthy JavaScript values.
|
|
232
270
|
*
|
|
@@ -235,10 +273,9 @@ export declare const AsyncFunctionSchema: z.ZodCustom<(...args: any[]) => any, (
|
|
|
235
273
|
* if it converts to `true` when evaluated in a boolean context - essentially
|
|
236
274
|
* any value that is not one of the eight falsy values.
|
|
237
275
|
*
|
|
238
|
-
* @
|
|
276
|
+
* @privateRemarks
|
|
239
277
|
* The schema is registered in the `BupkisRegistry` with the name `Truthy` and
|
|
240
278
|
* indicates that it accepts anything as valid input for evaluation.
|
|
241
|
-
* @category Schema
|
|
242
279
|
* @example
|
|
243
280
|
*
|
|
244
281
|
* ```typescript
|
|
@@ -252,6 +289,8 @@ export declare const AsyncFunctionSchema: z.ZodCustom<(...args: any[]) => any, (
|
|
|
252
289
|
* TruthySchema.parse(''); // ✗ Throws validation error
|
|
253
290
|
* TruthySchema.parse(null); // ✗ Throws validation error
|
|
254
291
|
* ```
|
|
292
|
+
*
|
|
293
|
+
* @group Schema
|
|
255
294
|
*/
|
|
256
295
|
export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
|
|
257
296
|
/**
|
|
@@ -262,10 +301,9 @@ export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
|
|
|
262
301
|
* in JavaScript are: `false`, `0`, `-0`, `0n`, `""` (empty string), `null`,
|
|
263
302
|
* `undefined`, and `NaN`.
|
|
264
303
|
*
|
|
265
|
-
* @
|
|
304
|
+
* @privateRemarks
|
|
266
305
|
* The schema is registered in the `BupkisRegistry` with the name `Falsy` and
|
|
267
306
|
* indicates that it accepts anything as valid input for evaluation.
|
|
268
|
-
* @category Schema
|
|
269
307
|
* @example
|
|
270
308
|
*
|
|
271
309
|
* ```typescript
|
|
@@ -282,6 +320,8 @@ export declare const TruthySchema: z.ZodNonOptional<z.ZodAny>;
|
|
|
282
320
|
* FalsySchema.parse('hello'); // ✗ Throws validation error
|
|
283
321
|
* FalsySchema.parse({}); // ✗ Throws validation error
|
|
284
322
|
* ```
|
|
323
|
+
*
|
|
324
|
+
* @group Schema
|
|
285
325
|
*/
|
|
286
326
|
export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
|
|
287
327
|
/**
|
|
@@ -293,10 +333,9 @@ export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
|
|
|
293
333
|
* distinguishing them from objects and functions which are non-primitive
|
|
294
334
|
* reference types.
|
|
295
335
|
*
|
|
296
|
-
* @
|
|
336
|
+
* @privateRemarks
|
|
297
337
|
* The schema is registered in the `BupkisRegistry` with the name `Primitive`
|
|
298
338
|
* and indicates that it accepts primitive values as valid input.
|
|
299
|
-
* @category Schema
|
|
300
339
|
* @example
|
|
301
340
|
*
|
|
302
341
|
* ```typescript
|
|
@@ -311,6 +350,8 @@ export declare const FalsySchema: z.ZodNullable<z.ZodAny>;
|
|
|
311
350
|
* PrimitiveSchema.parse([]); // ✗ Throws validation error (array)
|
|
312
351
|
* PrimitiveSchema.parse(() => {}); // ✗ Throws validation error (function)
|
|
313
352
|
* ```
|
|
353
|
+
*
|
|
354
|
+
* @group Schema
|
|
314
355
|
*/
|
|
315
356
|
export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodBigInt, z.ZodSymbol, z.ZodNull, z.ZodUndefined]>;
|
|
316
357
|
/**
|
|
@@ -323,12 +364,11 @@ export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNum
|
|
|
323
364
|
* it useful for validating collections where the specific array mutability or
|
|
324
365
|
* tuple structure is not critical.
|
|
325
366
|
*
|
|
326
|
-
* @
|
|
367
|
+
* @privateRemarks
|
|
327
368
|
* The schema is registered in the {@link BupkisRegistry} with the name
|
|
328
369
|
* `ArrayLike` for later reference and type checking purposes. This schema is
|
|
329
370
|
* particularly useful when you need to accept various forms of array-like data
|
|
330
371
|
* without being restrictive about mutability or exact tuple structure.
|
|
331
|
-
* @category Schema
|
|
332
372
|
* @example
|
|
333
373
|
*
|
|
334
374
|
* ```typescript
|
|
@@ -340,8 +380,10 @@ export declare const PrimitiveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNum
|
|
|
340
380
|
* ArrayLikeSchema.parse({}); // ✗ Throws validation error
|
|
341
381
|
* ArrayLikeSchema.parse(null); // ✗ Throws validation error
|
|
342
382
|
* ```
|
|
383
|
+
*
|
|
384
|
+
* @group Schema
|
|
343
385
|
*/
|
|
344
|
-
export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.
|
|
386
|
+
export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodTuple<[z.ZodUnknown], z.ZodUnknown>, z.ZodObject<{
|
|
345
387
|
length: z.ZodNumber;
|
|
346
388
|
}, z.core.$loose>]>;
|
|
347
389
|
/**
|
|
@@ -353,10 +395,9 @@ export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>,
|
|
|
353
395
|
* It ensures the validated value is a proper regular expression object with all
|
|
354
396
|
* associated methods and properties.
|
|
355
397
|
*
|
|
356
|
-
* @
|
|
398
|
+
* @privateRemarks
|
|
357
399
|
* The schema is registered in the `BupkisRegistry` with the name `RegExp` for
|
|
358
400
|
* later reference and type checking purposes.
|
|
359
|
-
* @category Schema
|
|
360
401
|
* @example
|
|
361
402
|
*
|
|
362
403
|
* ```typescript
|
|
@@ -368,6 +409,8 @@ export declare const ArrayLikeSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>,
|
|
|
368
409
|
* RegExpSchema.parse(/abc/.source); // ✗ Throws validation error (string pattern)
|
|
369
410
|
* RegExpSchema.parse({}); // ✗ Throws validation error (object)
|
|
370
411
|
* ```
|
|
412
|
+
*
|
|
413
|
+
* @group Schema
|
|
371
414
|
*/
|
|
372
415
|
export declare const RegExpSchema: z.ZodCustom<RegExp, RegExp>;
|
|
373
416
|
//# 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;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,OAAO,EAAE,CAAC,KAAK,OAAO,YAAxC,iBAAiB,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAMzD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,8DAG4B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,wBAAwB,yDAK4B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe,2DAI4B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe,yCAI4B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,yEAKmC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,yEAAmB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,mBAAmB,wBAnNZ,iBAAiB,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,YAAxC,iBAAiB,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAuNA,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY,4BAOrB,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
|