@express-zod-api/zod-plugin 1.0.0-beta.3 → 1.0.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 +7 -0
- package/README.md +1 -1
- package/dist/index.d.ts +11 -2
- package/package.json +8 -1
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ This module extends Zod functionality when it's imported:
|
|
|
11
11
|
- Adds `.label()` method to `ZodDefault`:
|
|
12
12
|
- shorthand for `.meta({ default: ... })`;
|
|
13
13
|
- Adds `.remap()` method to `ZodObject` for renaming object properties:
|
|
14
|
-
- Supports a mapping
|
|
14
|
+
- Supports a mapping object or an object transforming function as an argument;
|
|
15
15
|
- Relies on `R.renameKeys()` from the `ramda` library;
|
|
16
16
|
- Alters the `.brand()` method on all Zod schemas by making the assigned brand available in runtime:
|
|
17
17
|
- The provided `getBrand()` method can retrieve the brand from the schema.
|
package/dist/index.d.ts
CHANGED
|
@@ -24,14 +24,23 @@ declare module "zod/v4/core" {
|
|
|
24
24
|
examples?: unknown[];
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @fileoverview Zod Runtime Plugin
|
|
29
|
+
* @see https://github.com/colinhacks/zod/blob/90efe7fa6135119224412c7081bd12ef0bccef26/plugin/effect/src/index.ts#L21-L31
|
|
30
|
+
* @desc This code modifies and extends zod's functionality immediately when importing the plugin.
|
|
31
|
+
* @desc Enables .example() and .deprecated() on all schemas (ZodType)
|
|
32
|
+
* @desc Enables .label() on ZodDefault
|
|
33
|
+
* @desc Enables .remap() on ZodObject
|
|
34
|
+
* @desc Stores the argument supplied to .brand() on all schemas (runtime distinguishable branded types)
|
|
35
|
+
* */
|
|
27
36
|
declare module "zod" {
|
|
28
37
|
interface ZodType<out Output = unknown, out Input = unknown, out Internals extends z.core.$ZodTypeInternals<Output, Input> = z.core.$ZodTypeInternals<Output, Input>> extends z.core.$ZodType<Output, Input, Internals> {
|
|
29
|
-
/** @desc
|
|
38
|
+
/** @desc Shorthand for .meta({ examples }) */
|
|
30
39
|
example(example: z.output<this>): this;
|
|
31
40
|
deprecated(): this;
|
|
32
41
|
}
|
|
33
42
|
interface ZodDefault<T extends z.core.SomeType = z.core.$ZodType> extends z._ZodType<z.core.$ZodDefaultInternals<T>>, z.core.$ZodDefault<T> {
|
|
34
|
-
/** @desc
|
|
43
|
+
/** @desc Shorthand for .meta({ default }) */
|
|
35
44
|
label(label: string): this;
|
|
36
45
|
}
|
|
37
46
|
interface ZodObject<out Shape extends z.core.$ZodShape = z.core.$ZodLooseShape, out Config extends z.core.$ZodObjectConfig = z.core.$strip> extends z._ZodType<z.core.$ZodObjectInternals<Shape, Config>>, z.core.$ZodObject<Shape, Config> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@express-zod-api/zod-plugin",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Zod plugin for express-zod-api",
|
|
6
6
|
"sideEffects": true,
|
|
@@ -41,6 +41,13 @@
|
|
|
41
41
|
"typescript": "^5.8.3",
|
|
42
42
|
"zod": "^4.0.0"
|
|
43
43
|
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"zod",
|
|
46
|
+
"schema",
|
|
47
|
+
"validation",
|
|
48
|
+
"plugin",
|
|
49
|
+
"typescript"
|
|
50
|
+
],
|
|
44
51
|
"scripts": {
|
|
45
52
|
"pretest": "tsc --noEmit",
|
|
46
53
|
"test": "vitest run",
|