express-zod-api 24.6.2 → 25.0.0-beta.3
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 +11 -13
- package/README.md +17 -37
- package/SECURITY.md +1 -0
- package/dist/index.d.ts +31 -26
- package/dist/index.js +8 -8
- package/package.json +8 -14
- package/dist/index.cjs +0 -23
- package/dist/index.d.cts +0 -942
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## Version
|
|
3
|
+
## Version 25
|
|
4
|
+
|
|
5
|
+
### v25.0.0
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
- Supported Node.js versions: `^20.19.0 || ^22.12.0 || ^24.0.0`:
|
|
8
|
+
- The framework distribution is now ESM-only (finally);
|
|
9
|
+
- All the Node.js versions listed above support `require(ESM)` syntax;
|
|
10
|
+
- Supported `zod` version: `^4.0.0`;
|
|
11
|
+
- Changes to the `Middleware` class:
|
|
12
|
+
- When the `input` schema is not defined, the `input` argument of the `handler` method is now `unknown`;
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
- Make sure the `moduleResolution` in your `tsconfig.json` is either `node16`, `nodenext` or `bundler`;
|
|
9
|
-
- Consider the [recommended tsconfig base, Node 20+](https://github.com/tsconfig/bases/blob/main/bases/node20.json);
|
|
10
|
-
- Then you MAY `import { z } from "zod"`;
|
|
11
|
-
- Otherwise, you MUST keep `import { z } from "zod/v4"`;
|
|
12
|
-
- In some cases module augmentation (Zod plugin) did not work and caused schema assignment errors for some users;
|
|
13
|
-
- The issue was reported by [@MichaelHindley](https://github.com/MichaelHindley);
|
|
14
|
-
- This potential inconvenience will be resolved by dropping `zod@^3` in the next version of Express Zod API:
|
|
15
|
-
- If you're having troubles using the framework with `zod@^4.0.0`, consider upgrading to v25 (currently beta).
|
|
14
|
+
## Version 24
|
|
16
15
|
|
|
17
16
|
### v24.6.1
|
|
18
17
|
|
|
@@ -26,8 +25,7 @@
|
|
|
26
25
|
### v24.6.0
|
|
27
26
|
|
|
28
27
|
- Supporting `zod` versions `^3.25.35 || ^4.0.0`:
|
|
29
|
-
- If you use `zod@^4.0.0` then
|
|
30
|
-
- If facing error, ensure `moduleResolution` in your `tsconfig.json` is either `node16`, `nodenext` or `bundler`;
|
|
28
|
+
- If you use `zod@^4.0.0` then `import { z } from "zod"`;
|
|
31
29
|
- If you use `zod@^3.25.35` then keep `import { z } from "zod/v4"`;
|
|
32
30
|
- For more details, see the [Explanation of the versioning strategy](https://github.com/colinhacks/zod/issues/4371).
|
|
33
31
|
|
package/README.md
CHANGED
|
@@ -58,8 +58,7 @@ Start your API server with I/O schema validation and custom middlewares in minut
|
|
|
58
58
|
5. [Graceful shutdown](#graceful-shutdown)
|
|
59
59
|
6. [Subscriptions](#subscriptions)
|
|
60
60
|
8. [Caveats](#caveats)
|
|
61
|
-
1. [
|
|
62
|
-
2. [Excessive properties in endpoint output](#excessive-properties-in-endpoint-output)
|
|
61
|
+
1. [Excessive properties in endpoint output](#excessive-properties-in-endpoint-output)
|
|
63
62
|
9. [Your input to my output](#your-input-to-my-output)
|
|
64
63
|
|
|
65
64
|
See also [Changelog](CHANGELOG.md) and [automated migration](https://www.npmjs.com/package/@express-zod-api/migration).
|
|
@@ -85,7 +84,6 @@ Therefore, many basic tasks can be accomplished faster and easier, in particular
|
|
|
85
84
|
|
|
86
85
|
These people contributed to the improvement of the framework by reporting bugs, making changes and suggesting ideas:
|
|
87
86
|
|
|
88
|
-
[<img src="https://github.com/MichaelHindley.png" alt="@MichaelHindley" width="50px" />](https://github.com/MichaelHindley)
|
|
89
87
|
[<img src="https://github.com/zoton2.png" alt="@zoton2" width="50px" />](https://github.com/zoton2)
|
|
90
88
|
[<img src="https://github.com/ThomasKientz.png" alt="@ThomasKientz" width="50px" />](https://github.com/ThomasKientz)
|
|
91
89
|
[<img src="https://github.com/james10424.png" alt="@james10424" width="50px" />](https://github.com/james10424)
|
|
@@ -177,11 +175,7 @@ pnpm add express-zod-api express zod typescript http-errors
|
|
|
177
175
|
pnpm add -D @types/express @types/node @types/http-errors
|
|
178
176
|
```
|
|
179
177
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
Consider using the recommended `tsconfig.json` base for your project according to your Node.js version,
|
|
183
|
-
for example [the base for Node.js 20+](https://github.com/tsconfig/bases/blob/main/bases/node20.json).
|
|
184
|
-
Ensure having the following options in order to make it work as expected:
|
|
178
|
+
Ensure having the following options in your `tsconfig.json` file in order to make it work as expected:
|
|
185
179
|
|
|
186
180
|
```json
|
|
187
181
|
{
|
|
@@ -192,8 +186,6 @@ Ensure having the following options in order to make it work as expected:
|
|
|
192
186
|
}
|
|
193
187
|
```
|
|
194
188
|
|
|
195
|
-
See also how `moduleResolution` may cause [Zod 4 schema assignment error](#zod-4-schema-assignment-error).
|
|
196
|
-
|
|
197
189
|
## Set up config
|
|
198
190
|
|
|
199
191
|
Create a minimal configuration. Find out all configurable options
|
|
@@ -215,7 +207,7 @@ Learn how to make factories for [custom response](#response-customization) and b
|
|
|
215
207
|
|
|
216
208
|
```typescript
|
|
217
209
|
import { defaultEndpointsFactory } from "express-zod-api";
|
|
218
|
-
import { z } from "zod
|
|
210
|
+
import { z } from "zod";
|
|
219
211
|
|
|
220
212
|
const helloWorldEndpoint = defaultEndpointsFactory.build({
|
|
221
213
|
// method: "get" (default) or array ["get", "post", ...]
|
|
@@ -327,7 +319,7 @@ Inputs of middlewares are also available to endpoint handlers within `input`.
|
|
|
327
319
|
Here is an example of the authentication middleware, that checks a `key` from input and `token` from headers:
|
|
328
320
|
|
|
329
321
|
```typescript
|
|
330
|
-
import { z } from "zod
|
|
322
|
+
import { z } from "zod";
|
|
331
323
|
import createHttpError from "http-errors";
|
|
332
324
|
import { Middleware } from "express-zod-api";
|
|
333
325
|
|
|
@@ -457,7 +449,7 @@ You can implement additional validations within schemas using refinements.
|
|
|
457
449
|
Validation errors are reported in a response with a status code `400`.
|
|
458
450
|
|
|
459
451
|
```typescript
|
|
460
|
-
import { z } from "zod
|
|
452
|
+
import { z } from "zod";
|
|
461
453
|
import { Middleware } from "express-zod-api";
|
|
462
454
|
|
|
463
455
|
const nicknameConstraintMiddleware = new Middleware({
|
|
@@ -498,7 +490,7 @@ Since parameters of GET requests come in the form of strings, there is often a n
|
|
|
498
490
|
arrays of numbers.
|
|
499
491
|
|
|
500
492
|
```typescript
|
|
501
|
-
import { z } from "zod
|
|
493
|
+
import { z } from "zod";
|
|
502
494
|
|
|
503
495
|
const getUserEndpoint = endpointsFactory.build({
|
|
504
496
|
input: z.object({
|
|
@@ -529,7 +521,7 @@ Here is a recommended solution: it is important to use shallow transformations o
|
|
|
529
521
|
```ts
|
|
530
522
|
import camelize from "camelize-ts";
|
|
531
523
|
import snakify from "snakify-ts";
|
|
532
|
-
import { z } from "zod
|
|
524
|
+
import { z } from "zod";
|
|
533
525
|
|
|
534
526
|
const endpoint = endpointsFactory.build({
|
|
535
527
|
input: z
|
|
@@ -582,7 +574,7 @@ provides your endpoint handler or middleware with a `Date`. It supports the foll
|
|
|
582
574
|
format for the response transmission. Both schemas accept metadata as an argument. Consider the following example:
|
|
583
575
|
|
|
584
576
|
```typescript
|
|
585
|
-
import { z } from "zod
|
|
577
|
+
import { z } from "zod";
|
|
586
578
|
import { ez, defaultEndpointsFactory } from "express-zod-api";
|
|
587
579
|
|
|
588
580
|
const updateUserEndpoint = defaultEndpointsFactory.build({
|
|
@@ -757,7 +749,7 @@ In a similar way you can enable request headers as the input source. This is an
|
|
|
757
749
|
|
|
758
750
|
```typescript
|
|
759
751
|
import { createConfig, Middleware } from "express-zod-api";
|
|
760
|
-
import { z } from "zod
|
|
752
|
+
import { z } from "zod";
|
|
761
753
|
|
|
762
754
|
createConfig({
|
|
763
755
|
inputSources: {
|
|
@@ -792,7 +784,7 @@ type DefaultResponse<OUT> =
|
|
|
792
784
|
You can create your own result handler by using this example as a template:
|
|
793
785
|
|
|
794
786
|
```typescript
|
|
795
|
-
import { z } from "zod
|
|
787
|
+
import { z } from "zod";
|
|
796
788
|
import {
|
|
797
789
|
ResultHandler,
|
|
798
790
|
ensureHttpError,
|
|
@@ -917,7 +909,7 @@ which is `express.urlencoded()` by default. The request content type should be `
|
|
|
917
909
|
|
|
918
910
|
```ts
|
|
919
911
|
import { defaultEndpointsFactory, ez } from "express-zod-api";
|
|
920
|
-
import { z } from "zod
|
|
912
|
+
import { z } from "zod";
|
|
921
913
|
|
|
922
914
|
export const submitFeedbackEndpoint = defaultEndpointsFactory.build({
|
|
923
915
|
method: "post",
|
|
@@ -957,7 +949,7 @@ const config = createConfig({
|
|
|
957
949
|
Then use `ez.upload()` schema for a corresponding property. The request content type must be `multipart/form-data`:
|
|
958
950
|
|
|
959
951
|
```typescript
|
|
960
|
-
import { z } from "zod
|
|
952
|
+
import { z } from "zod";
|
|
961
953
|
import { ez, defaultEndpointsFactory } from "express-zod-api";
|
|
962
954
|
|
|
963
955
|
const fileUploadEndpoint = defaultEndpointsFactory.build({
|
|
@@ -1035,7 +1027,7 @@ from outputs of previous middlewares, if the one being tested somehow depends on
|
|
|
1035
1027
|
either by `errorHandler` configured within given `configProps` or `defaultResultHandler`.
|
|
1036
1028
|
|
|
1037
1029
|
```typescript
|
|
1038
|
-
import { z } from "zod
|
|
1030
|
+
import { z } from "zod";
|
|
1039
1031
|
import { Middleware, testMiddleware } from "express-zod-api";
|
|
1040
1032
|
|
|
1041
1033
|
const middleware = new Middleware({
|
|
@@ -1178,7 +1170,7 @@ You can also deprecate all routes the `Endpoint` assigned to by setting `Endpoin
|
|
|
1178
1170
|
|
|
1179
1171
|
```ts
|
|
1180
1172
|
import { Routing, DependsOnMethod } from "express-zod-api";
|
|
1181
|
-
import { z } from "zod
|
|
1173
|
+
import { z } from "zod";
|
|
1182
1174
|
|
|
1183
1175
|
const someEndpoint = factory.build({
|
|
1184
1176
|
deprecated: true, // deprecates all routes the endpoint assigned to
|
|
@@ -1203,7 +1195,7 @@ need to reuse a handling rule for multiple brands, use the exposed types `Depict
|
|
|
1203
1195
|
|
|
1204
1196
|
```ts
|
|
1205
1197
|
import ts from "typescript";
|
|
1206
|
-
import { z } from "zod
|
|
1198
|
+
import { z } from "zod";
|
|
1207
1199
|
import {
|
|
1208
1200
|
Documentation,
|
|
1209
1201
|
Integration,
|
|
@@ -1360,7 +1352,7 @@ Client application can subscribe to the event stream using `EventSource` class i
|
|
|
1360
1352
|
the implementation emitting the `time` event each second.
|
|
1361
1353
|
|
|
1362
1354
|
```typescript
|
|
1363
|
-
import { z } from "zod
|
|
1355
|
+
import { z } from "zod";
|
|
1364
1356
|
import { EventStreamFactory } from "express-zod-api";
|
|
1365
1357
|
import { setTimeout } from "node:timers/promises";
|
|
1366
1358
|
|
|
@@ -1385,18 +1377,6 @@ framework, [Zod Sockets](https://github.com/RobinTail/zod-sockets), which has si
|
|
|
1385
1377
|
There are some well-known issues and limitations, or third party bugs that cannot be fixed in the usual way, but you
|
|
1386
1378
|
should be aware of them.
|
|
1387
1379
|
|
|
1388
|
-
## Zod 4 schema assignment error
|
|
1389
|
-
|
|
1390
|
-
When using `zod@^4` and doing `import { z } from "zod"` you may encounter the following error:
|
|
1391
|
-
|
|
1392
|
-
```text
|
|
1393
|
-
TS2739: ZodObject<...> is missing the following properties from ZodType<...>: example, deprecated.
|
|
1394
|
-
```
|
|
1395
|
-
|
|
1396
|
-
In this case make sure the `moduleResolution` in your `tsconfig.json` is either `node16`, `nodenext` or `bundler`.
|
|
1397
|
-
Consider the [recommended tsconfig base, Node 20+](https://github.com/tsconfig/bases/blob/main/bases/node20.json).
|
|
1398
|
-
Otherwise, keep importing `from "zod/v4"` or consider upgrading the framework to v25.
|
|
1399
|
-
|
|
1400
1380
|
## Excessive properties in endpoint output
|
|
1401
1381
|
|
|
1402
1382
|
The schema validator removes excessive properties by default. However, Typescript
|
|
@@ -1405,7 +1385,7 @@ in this case during development. You can achieve this verification by assigning
|
|
|
1405
1385
|
reusing it in forced type of the output:
|
|
1406
1386
|
|
|
1407
1387
|
```typescript
|
|
1408
|
-
import { z } from "zod
|
|
1388
|
+
import { z } from "zod";
|
|
1409
1389
|
|
|
1410
1390
|
const output = z.object({
|
|
1411
1391
|
anything: z.number(),
|
package/SECURITY.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Code name | Release | Supported |
|
|
6
6
|
| ------: | :------------ | :------ | :----------------: |
|
|
7
|
+
| 25.x.x | Sara | 08.2025 | :white_check_mark: |
|
|
7
8
|
| 24.x.x | Ashley | 06.2025 | :white_check_mark: |
|
|
8
9
|
| 23.x.x | Sonia | 04.2025 | :white_check_mark: |
|
|
9
10
|
| 22.x.x | Tai | 01.2025 | :white_check_mark: |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { z } from 'zod
|
|
1
|
+
import * as zod from 'zod';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import * as zod_v4_core from 'zod/v4/core';
|
|
4
4
|
import { $ZodTypeInternals, $ZodType, SomeType, $ZodDefaultInternals, $ZodDefault, $ZodShape, $ZodLooseShape, $ZodObjectConfig, $strip, $ZodObjectInternals, $ZodObject, JSONSchema } from 'zod/v4/core';
|
|
5
5
|
import compression from 'compression';
|
|
@@ -46,7 +46,7 @@ declare module "zod/v4/core" {
|
|
|
46
46
|
default?: unknown;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
declare module "zod
|
|
49
|
+
declare module "zod" {
|
|
50
50
|
interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
|
|
51
51
|
/** @desc Alias for .meta({examples}), but argument is typed to ensure the correct placement for transformations */
|
|
52
52
|
example(example: z.output<this>): this;
|
|
@@ -68,10 +68,11 @@ declare module "zod/v4" {
|
|
|
68
68
|
declare const methods: ("delete" | "get" | "post" | "put" | "patch")[];
|
|
69
69
|
type Method = (typeof methods)[number];
|
|
70
70
|
|
|
71
|
+
/** @since zod 3.25.61 output type fixed */
|
|
72
|
+
declare const emptySchema: z.ZodObject<{}, z.core.$strip>;
|
|
73
|
+
type EmptySchema = typeof emptySchema;
|
|
71
74
|
/** @desc this type does not allow props assignment, but it works for reading them when merged with another interface */
|
|
72
75
|
type EmptyObject = z.output<EmptySchema>;
|
|
73
|
-
/** Avoiding z.ZodObject<Record<string, never>, $strip>, because its z.output<> is generic "object" (external issue) */
|
|
74
|
-
type EmptySchema = z.ZodRecord<z.ZodString, z.ZodNever>;
|
|
75
76
|
type FlatObject = Record<string, unknown>;
|
|
76
77
|
/** @link https://stackoverflow.com/a/65492934 */
|
|
77
78
|
type NoNever<T, F> = [T] extends [never] ? F : T;
|
|
@@ -155,6 +156,16 @@ declare class BuiltinLogger implements AbstractLogger {
|
|
|
155
156
|
profile(options: ProfilerOptions): () => void;
|
|
156
157
|
}
|
|
157
158
|
|
|
159
|
+
type Base$1 = object & {
|
|
160
|
+
[Symbol.iterator]?: never;
|
|
161
|
+
};
|
|
162
|
+
/** @desc The type allowed on the top level of Middlewares and Endpoints */
|
|
163
|
+
type IOSchema = z.ZodType<Base$1>;
|
|
164
|
+
/** EndpointsFactory schema extended type when adding a Middleware */
|
|
165
|
+
type Extension<Current extends IOSchema | undefined, Inc extends IOSchema | undefined> = Current extends IOSchema ? Inc extends IOSchema ? z.ZodIntersection<Current, Inc> : Current : Inc;
|
|
166
|
+
/** The Endpoint input schema type, condition wrapped into schema to make it z.output-compatible */
|
|
167
|
+
type FinalInputSchema<FIN extends IOSchema | undefined, BIN extends IOSchema> = z.ZodIntersection<FIN extends IOSchema ? FIN : BIN, BIN>;
|
|
168
|
+
|
|
158
169
|
type LogicalOr<T> = {
|
|
159
170
|
or: T[];
|
|
160
171
|
};
|
|
@@ -260,12 +271,12 @@ declare abstract class AbstractMiddleware {
|
|
|
260
271
|
logger: ActualLogger;
|
|
261
272
|
}): Promise<FlatObject>;
|
|
262
273
|
}
|
|
263
|
-
declare class Middleware<OPT extends FlatObject, OUT extends FlatObject, SCO extends string, IN extends IOSchema =
|
|
274
|
+
declare class Middleware<OPT extends FlatObject, OUT extends FlatObject, SCO extends string, IN extends IOSchema | undefined = undefined> extends AbstractMiddleware {
|
|
264
275
|
#private;
|
|
265
276
|
constructor({ input, security, handler, }: {
|
|
266
277
|
/**
|
|
267
278
|
* @desc Input schema of the Middleware, combining properties from all the enabled input sources
|
|
268
|
-
* @default
|
|
279
|
+
* @default undefined
|
|
269
280
|
* @see defaultInputSources
|
|
270
281
|
* */
|
|
271
282
|
input?: IN;
|
|
@@ -290,13 +301,6 @@ declare class ExpressMiddleware<R extends Request, S extends Response, OUT exten
|
|
|
290
301
|
});
|
|
291
302
|
}
|
|
292
303
|
|
|
293
|
-
type Base$1 = object & {
|
|
294
|
-
[Symbol.iterator]?: never;
|
|
295
|
-
};
|
|
296
|
-
/** @desc The type allowed on the top level of Middlewares and Endpoints */
|
|
297
|
-
type IOSchema = z.ZodType<Base$1>;
|
|
298
|
-
type ConditionalIntersection<Current extends IOSchema | undefined, Inc extends IOSchema> = z.ZodIntersection<Current extends IOSchema ? Current : Inc, Inc>;
|
|
299
|
-
|
|
300
304
|
declare class DependsOnMethod extends Routable {
|
|
301
305
|
#private;
|
|
302
306
|
constructor(endpoints: Partial<Record<Method, AbstractEndpoint>>);
|
|
@@ -613,7 +617,7 @@ interface BuildProps<IN extends IOSchema, OUT extends IOSchema | z.ZodVoid, MIN
|
|
|
613
617
|
/** @desc The schema by which the returns of the Endpoint handler is validated */
|
|
614
618
|
output: OUT;
|
|
615
619
|
/** @desc The Endpoint handler receiving the validated inputs, returns of added Middlewares (options) and a logger */
|
|
616
|
-
handler: Handler<z.output<
|
|
620
|
+
handler: Handler<z.output<FinalInputSchema<MIN, IN>>, z.input<OUT>, OPT>;
|
|
617
621
|
/** @desc The operation description for the generated Documentation */
|
|
618
622
|
description?: string;
|
|
619
623
|
/** @desc The operation summary for the generated Documentation (50 symbols max) */
|
|
@@ -642,18 +646,19 @@ interface BuildProps<IN extends IOSchema, OUT extends IOSchema | z.ZodVoid, MIN
|
|
|
642
646
|
declare class EndpointsFactory<IN extends IOSchema | undefined = undefined, OUT extends FlatObject = EmptyObject, SCO extends string = string> {
|
|
643
647
|
#private;
|
|
644
648
|
protected resultHandler: AbstractResultHandler;
|
|
649
|
+
protected schema: IN;
|
|
645
650
|
protected middlewares: AbstractMiddleware[];
|
|
646
651
|
constructor(resultHandler: AbstractResultHandler);
|
|
647
|
-
addMiddleware<AOUT extends FlatObject, ASCO extends string, AIN extends IOSchema =
|
|
652
|
+
addMiddleware<AOUT extends FlatObject, ASCO extends string, AIN extends IOSchema | undefined = undefined>(subject: Middleware<OUT, AOUT, ASCO, AIN> | ConstructorParameters<typeof Middleware<OUT, AOUT, ASCO, AIN>>[0]): EndpointsFactory<Extension<IN, AIN>, OUT & AOUT, SCO & ASCO>;
|
|
648
653
|
use: <R extends Request, S extends Response, AOUT extends FlatObject = Record<string, never>>(nativeMw: (request: R, response: S, next: express.NextFunction) => any, params_1?: {
|
|
649
654
|
provider?: ((request: R, response: S) => AOUT | Promise<AOUT>) | undefined;
|
|
650
655
|
transformer?: (err: Error) => Error;
|
|
651
|
-
} | undefined) => EndpointsFactory<IN, OUT & AOUT, SCO>;
|
|
652
|
-
addExpressMiddleware<R extends Request, S extends Response, AOUT extends FlatObject = EmptyObject>(...params: ConstructorParameters<typeof ExpressMiddleware<R, S, AOUT>>): EndpointsFactory<IN, OUT & AOUT, SCO>;
|
|
653
|
-
addOptions<AOUT extends FlatObject>(getOptions: () => Promise<AOUT>): EndpointsFactory<IN, OUT & AOUT, SCO>;
|
|
654
|
-
build<BOUT extends IOSchema, BIN extends IOSchema = EmptySchema>({ input, output: outputSchema, operationId, scope, tag, method, ...rest }: BuildProps<BIN, BOUT, IN, OUT, SCO>): Endpoint<
|
|
656
|
+
} | undefined) => EndpointsFactory<Extension<IN, undefined>, OUT & AOUT, SCO>;
|
|
657
|
+
addExpressMiddleware<R extends Request, S extends Response, AOUT extends FlatObject = EmptyObject>(...params: ConstructorParameters<typeof ExpressMiddleware<R, S, AOUT>>): EndpointsFactory<Extension<IN, undefined>, OUT & AOUT, SCO>;
|
|
658
|
+
addOptions<AOUT extends FlatObject>(getOptions: () => Promise<AOUT>): EndpointsFactory<Extension<IN, undefined>, OUT & AOUT, SCO>;
|
|
659
|
+
build<BOUT extends IOSchema, BIN extends IOSchema = EmptySchema>({ input, output: outputSchema, operationId, scope, tag, method, ...rest }: BuildProps<BIN, BOUT, IN, OUT, SCO>): Endpoint<FinalInputSchema<IN, BIN>, BOUT, OUT>;
|
|
655
660
|
/** @desc shorthand for returning {} while having output schema z.object({}) */
|
|
656
|
-
buildVoid<BIN extends IOSchema = EmptySchema>({ handler, ...rest }: Omit<BuildProps<BIN, z.ZodVoid, IN, OUT, SCO>, "output">): Endpoint<
|
|
661
|
+
buildVoid<BIN extends IOSchema = EmptySchema>({ handler, ...rest }: Omit<BuildProps<BIN, z.ZodVoid, IN, OUT, SCO>, "output">): Endpoint<FinalInputSchema<IN, BIN>, z.ZodObject<{}, z.core.$strip>, OUT>;
|
|
657
662
|
}
|
|
658
663
|
declare const defaultEndpointsFactory: EndpointsFactory<undefined, Record<string, never>, string>;
|
|
659
664
|
/**
|
|
@@ -931,12 +936,12 @@ declare function raw(): Base;
|
|
|
931
936
|
declare function raw<S extends $ZodShape>(extra: S): ReturnType<typeof extended<S>>;
|
|
932
937
|
|
|
933
938
|
declare const ez: {
|
|
934
|
-
dateIn: ({ examples, ...rest }?: Parameters<
|
|
935
|
-
dateOut: (meta?: Parameters<
|
|
936
|
-
form: <S extends zod_v4_core.$ZodShape>(base: S |
|
|
937
|
-
upload: () => zod_v4_core.$ZodBranded<
|
|
939
|
+
dateIn: ({ examples, ...rest }?: Parameters<zod.ZodString["meta"]>[0]) => zod_v4_core.$ZodBranded<zod.ZodPipe<zod.ZodPipe<zod.ZodUnion<readonly [zod.ZodISODate, zod.ZodISODateTime, zod.ZodISODateTime]>, zod.ZodTransform<Date, string>>, zod.ZodDate>, symbol>;
|
|
940
|
+
dateOut: (meta?: Parameters<zod.ZodString["meta"]>[0]) => zod_v4_core.$ZodBranded<zod.ZodPipe<zod.ZodDate, zod.ZodTransform<string, Date>>, symbol>;
|
|
941
|
+
form: <S extends zod_v4_core.$ZodShape>(base: S | zod.ZodObject<S>) => zod_v4_core.$ZodBranded<zod.ZodObject<S, zod_v4_core.$strip>, symbol>;
|
|
942
|
+
upload: () => zod_v4_core.$ZodBranded<zod.ZodCustom<express_fileupload.UploadedFile, express_fileupload.UploadedFile>, symbol>;
|
|
938
943
|
raw: typeof raw;
|
|
939
|
-
buffer: () => zod_v4_core.$ZodBranded<
|
|
944
|
+
buffer: () => zod_v4_core.$ZodBranded<zod.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, symbol>;
|
|
940
945
|
};
|
|
941
946
|
|
|
942
947
|
export { type ApiResponse, type AppConfig, type BasicSecurity, type BearerSecurity, BuiltinLogger, type CommonConfig, type CookieSecurity, DependsOnMethod, type Depicter, Documentation, DocumentationError, EndpointsFactory, EventStreamFactory, type FlatObject, type HeaderSecurity, type IOSchema, type InputSecurity, InputValidationError, Integration, type LoggerOverrides, type Method, Middleware, MissingPeerError, type OAuth2Security, type OpenIdSecurity, OutputValidationError, type Producer, ResultHandler, type Routing, RoutingError, ServeStatic, type ServerConfig, type TagOverrides, arrayEndpointsFactory, arrayResultHandler, attachRouting, createConfig, createServer, defaultEndpointsFactory, defaultResultHandler, ensureHttpError, ez, getExamples, getMessageFromError, testEndpoint, testMiddleware };
|