zod-nest 3.1.0 → 3.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/dist/express/index.d.mts +5 -5
- package/dist/express/index.d.ts +5 -5
- package/dist/express/index.js +195 -26
- package/dist/express/index.js.map +1 -1
- package/dist/express/index.mjs +195 -26
- package/dist/express/index.mjs.map +1 -1
- package/dist/fastify/index.d.mts +5 -5
- package/dist/fastify/index.d.ts +5 -5
- package/dist/fastify/index.js +195 -26
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/index.mjs +195 -26
- package/dist/fastify/index.mjs.map +1 -1
- package/dist/{zod-multipart.decorator-CjiQkmkR.d.ts → param-decorators-CX1cUqfY.d.ts} +52 -33
- package/dist/{zod-multipart.decorator-CxS2KuSv.d.mts → param-decorators-DbgygRVn.d.mts} +52 -33
- package/package.json +1 -1
|
@@ -1,6 +1,55 @@
|
|
|
1
|
-
import * as _nestjs_common from '@nestjs/common';
|
|
2
|
-
import { Z as ZodNestRegistry } from './registry-C9xStKa6.js';
|
|
3
1
|
import { z } from 'zod';
|
|
2
|
+
import { Z as ZodNestRegistry } from './registry-C9xStKa6.js';
|
|
3
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Where the multipart parser puts uploaded files. Multer leaves them on the
|
|
7
|
+
* request (`req.file` / `req.files`) with only text fields in `req.body`;
|
|
8
|
+
* `@fastify/multipart` with `attachFieldsToBody: true` puts everything in
|
|
9
|
+
* `req.body`.
|
|
10
|
+
*/
|
|
11
|
+
declare const MultipartFilesIn: {
|
|
12
|
+
readonly Request: "request";
|
|
13
|
+
readonly Body: "body";
|
|
14
|
+
};
|
|
15
|
+
type MultipartFilesIn = (typeof MultipartFilesIn)[keyof typeof MultipartFilesIn];
|
|
16
|
+
/** Shape accepted by `@ZodMultipart` — one Zod schema per form field. */
|
|
17
|
+
type MultipartShape = Readonly<Record<string, z.ZodType>>;
|
|
18
|
+
|
|
19
|
+
declare const MULTIPART_CONTENT_TYPE = "multipart/form-data";
|
|
20
|
+
/**
|
|
21
|
+
* Body declaration accepted by `@ZodMultipart`: a flat shape record, or any
|
|
22
|
+
* Zod schema. A record is the common case; a schema covers named bodies
|
|
23
|
+
* (`.meta({ id })` → `$ref`) and composites an object literal can't express.
|
|
24
|
+
*/
|
|
25
|
+
type MultipartBody = MultipartShape | z.ZodType;
|
|
26
|
+
interface ZodMultipartOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Where the parser puts uploaded files. Defaults to the platform entry
|
|
29
|
+
* point's convention — `'request'` from `zod-nest/express`, `'body'` from
|
|
30
|
+
* `zod-nest/fastify`.
|
|
31
|
+
*/
|
|
32
|
+
readonly filesIn?: MultipartFilesIn;
|
|
33
|
+
/**
|
|
34
|
+
* Forces this id, overriding any `.meta({ id })` on the schema. A named body
|
|
35
|
+
* is emitted as a `$ref` to `components.schemas`, which keeps a stable name
|
|
36
|
+
* for client generators — at the cost of Swagger UI's `try-it-out` form,
|
|
37
|
+
* which doesn't follow `$ref` for `multipart/form-data`.
|
|
38
|
+
*/
|
|
39
|
+
readonly id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Merge an intersection / union of `z.object` arms into one flat inline
|
|
42
|
+
* object. Needed for composite bodies whose `try-it-out` form must render.
|
|
43
|
+
* All merged properties become optional. See `@ZodBody`'s `flatten`.
|
|
44
|
+
*/
|
|
45
|
+
readonly flatten?: boolean;
|
|
46
|
+
/** Registry to register named descendants into. Defaults to `defaultRegistry`. */
|
|
47
|
+
readonly registry?: ZodNestRegistry;
|
|
48
|
+
/** OpenAPI `description` for the request body. */
|
|
49
|
+
readonly description?: string;
|
|
50
|
+
/** Whether the body is required. Defaults to `true`. */
|
|
51
|
+
readonly required?: boolean;
|
|
52
|
+
}
|
|
4
53
|
|
|
5
54
|
interface BaseFileOptions {
|
|
6
55
|
/**
|
|
@@ -40,34 +89,4 @@ declare const ZodUploadedFiles: (...dataOrPipes: (string | _nestjs_common.PipeTr
|
|
|
40
89
|
*/
|
|
41
90
|
declare const ZodMultipartBody: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
42
91
|
|
|
43
|
-
|
|
44
|
-
* Where the multipart parser puts uploaded files. Multer leaves them on the
|
|
45
|
-
* request (`req.file` / `req.files`) with only text fields in `req.body`;
|
|
46
|
-
* `@fastify/multipart` with `attachFieldsToBody: true` puts everything in
|
|
47
|
-
* `req.body`.
|
|
48
|
-
*/
|
|
49
|
-
declare const MultipartFilesIn: {
|
|
50
|
-
readonly Request: "request";
|
|
51
|
-
readonly Body: "body";
|
|
52
|
-
};
|
|
53
|
-
type MultipartFilesIn = (typeof MultipartFilesIn)[keyof typeof MultipartFilesIn];
|
|
54
|
-
/** Shape accepted by `@ZodMultipart` — one Zod schema per form field. */
|
|
55
|
-
type MultipartShape = Readonly<Record<string, z.ZodType>>;
|
|
56
|
-
|
|
57
|
-
declare const MULTIPART_CONTENT_TYPE = "multipart/form-data";
|
|
58
|
-
interface ZodMultipartOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Where the parser puts uploaded files. Defaults to the platform entry
|
|
61
|
-
* point's convention — `'request'` from `zod-nest/express`, `'body'` from
|
|
62
|
-
* `zod-nest/fastify`.
|
|
63
|
-
*/
|
|
64
|
-
readonly filesIn?: MultipartFilesIn;
|
|
65
|
-
/** Registry to register named descendants into. Defaults to `defaultRegistry`. */
|
|
66
|
-
readonly registry?: ZodNestRegistry;
|
|
67
|
-
/** OpenAPI `description` for the request body. */
|
|
68
|
-
readonly description?: string;
|
|
69
|
-
/** Whether the body is required. Defaults to `true`. */
|
|
70
|
-
readonly required?: boolean;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { type BaseFileOptions as B, MULTIPART_CONTENT_TYPE as M, ZodMultipartBody as Z, type MultipartShape as a, type ZodMultipartOptions as b, ZodUploadedFile as c, ZodUploadedFiles as d };
|
|
92
|
+
export { type BaseFileOptions as B, MULTIPART_CONTENT_TYPE as M, ZodMultipartBody as Z, type MultipartBody as a, type MultipartShape as b, type ZodMultipartOptions as c, ZodUploadedFile as d, ZodUploadedFiles as e };
|
|
@@ -1,6 +1,55 @@
|
|
|
1
|
-
import * as _nestjs_common from '@nestjs/common';
|
|
2
|
-
import { Z as ZodNestRegistry } from './registry-C9xStKa6.mjs';
|
|
3
1
|
import { z } from 'zod';
|
|
2
|
+
import { Z as ZodNestRegistry } from './registry-C9xStKa6.mjs';
|
|
3
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Where the multipart parser puts uploaded files. Multer leaves them on the
|
|
7
|
+
* request (`req.file` / `req.files`) with only text fields in `req.body`;
|
|
8
|
+
* `@fastify/multipart` with `attachFieldsToBody: true` puts everything in
|
|
9
|
+
* `req.body`.
|
|
10
|
+
*/
|
|
11
|
+
declare const MultipartFilesIn: {
|
|
12
|
+
readonly Request: "request";
|
|
13
|
+
readonly Body: "body";
|
|
14
|
+
};
|
|
15
|
+
type MultipartFilesIn = (typeof MultipartFilesIn)[keyof typeof MultipartFilesIn];
|
|
16
|
+
/** Shape accepted by `@ZodMultipart` — one Zod schema per form field. */
|
|
17
|
+
type MultipartShape = Readonly<Record<string, z.ZodType>>;
|
|
18
|
+
|
|
19
|
+
declare const MULTIPART_CONTENT_TYPE = "multipart/form-data";
|
|
20
|
+
/**
|
|
21
|
+
* Body declaration accepted by `@ZodMultipart`: a flat shape record, or any
|
|
22
|
+
* Zod schema. A record is the common case; a schema covers named bodies
|
|
23
|
+
* (`.meta({ id })` → `$ref`) and composites an object literal can't express.
|
|
24
|
+
*/
|
|
25
|
+
type MultipartBody = MultipartShape | z.ZodType;
|
|
26
|
+
interface ZodMultipartOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Where the parser puts uploaded files. Defaults to the platform entry
|
|
29
|
+
* point's convention — `'request'` from `zod-nest/express`, `'body'` from
|
|
30
|
+
* `zod-nest/fastify`.
|
|
31
|
+
*/
|
|
32
|
+
readonly filesIn?: MultipartFilesIn;
|
|
33
|
+
/**
|
|
34
|
+
* Forces this id, overriding any `.meta({ id })` on the schema. A named body
|
|
35
|
+
* is emitted as a `$ref` to `components.schemas`, which keeps a stable name
|
|
36
|
+
* for client generators — at the cost of Swagger UI's `try-it-out` form,
|
|
37
|
+
* which doesn't follow `$ref` for `multipart/form-data`.
|
|
38
|
+
*/
|
|
39
|
+
readonly id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Merge an intersection / union of `z.object` arms into one flat inline
|
|
42
|
+
* object. Needed for composite bodies whose `try-it-out` form must render.
|
|
43
|
+
* All merged properties become optional. See `@ZodBody`'s `flatten`.
|
|
44
|
+
*/
|
|
45
|
+
readonly flatten?: boolean;
|
|
46
|
+
/** Registry to register named descendants into. Defaults to `defaultRegistry`. */
|
|
47
|
+
readonly registry?: ZodNestRegistry;
|
|
48
|
+
/** OpenAPI `description` for the request body. */
|
|
49
|
+
readonly description?: string;
|
|
50
|
+
/** Whether the body is required. Defaults to `true`. */
|
|
51
|
+
readonly required?: boolean;
|
|
52
|
+
}
|
|
4
53
|
|
|
5
54
|
interface BaseFileOptions {
|
|
6
55
|
/**
|
|
@@ -40,34 +89,4 @@ declare const ZodUploadedFiles: (...dataOrPipes: (string | _nestjs_common.PipeTr
|
|
|
40
89
|
*/
|
|
41
90
|
declare const ZodMultipartBody: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
42
91
|
|
|
43
|
-
|
|
44
|
-
* Where the multipart parser puts uploaded files. Multer leaves them on the
|
|
45
|
-
* request (`req.file` / `req.files`) with only text fields in `req.body`;
|
|
46
|
-
* `@fastify/multipart` with `attachFieldsToBody: true` puts everything in
|
|
47
|
-
* `req.body`.
|
|
48
|
-
*/
|
|
49
|
-
declare const MultipartFilesIn: {
|
|
50
|
-
readonly Request: "request";
|
|
51
|
-
readonly Body: "body";
|
|
52
|
-
};
|
|
53
|
-
type MultipartFilesIn = (typeof MultipartFilesIn)[keyof typeof MultipartFilesIn];
|
|
54
|
-
/** Shape accepted by `@ZodMultipart` — one Zod schema per form field. */
|
|
55
|
-
type MultipartShape = Readonly<Record<string, z.ZodType>>;
|
|
56
|
-
|
|
57
|
-
declare const MULTIPART_CONTENT_TYPE = "multipart/form-data";
|
|
58
|
-
interface ZodMultipartOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Where the parser puts uploaded files. Defaults to the platform entry
|
|
61
|
-
* point's convention — `'request'` from `zod-nest/express`, `'body'` from
|
|
62
|
-
* `zod-nest/fastify`.
|
|
63
|
-
*/
|
|
64
|
-
readonly filesIn?: MultipartFilesIn;
|
|
65
|
-
/** Registry to register named descendants into. Defaults to `defaultRegistry`. */
|
|
66
|
-
readonly registry?: ZodNestRegistry;
|
|
67
|
-
/** OpenAPI `description` for the request body. */
|
|
68
|
-
readonly description?: string;
|
|
69
|
-
/** Whether the body is required. Defaults to `true`. */
|
|
70
|
-
readonly required?: boolean;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { type BaseFileOptions as B, MULTIPART_CONTENT_TYPE as M, ZodMultipartBody as Z, type MultipartShape as a, type ZodMultipartOptions as b, ZodUploadedFile as c, ZodUploadedFiles as d };
|
|
92
|
+
export { type BaseFileOptions as B, MULTIPART_CONTENT_TYPE as M, ZodMultipartBody as Z, type MultipartBody as a, type MultipartShape as b, type ZodMultipartOptions as c, ZodUploadedFile as d, ZodUploadedFiles as e };
|