@alevnyacow/nzmt 0.1.1 → 0.1.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
import z, { type ZodObject } from 'zod';
|
|
2
|
+
import z, { ZodType, type ZodObject } from 'zod';
|
|
3
3
|
import { type ControllerErrorModel, type ErrorBaseCreatingPayload } from './errors.utils';
|
|
4
4
|
export declare enum DefaultErrorCodes {
|
|
5
5
|
REQUEST_PARSING = "ZOD-CONTROLLER___REQUEST-PARSING",
|
|
@@ -9,7 +9,7 @@ type SuccessResponse<ResponseZodSchema> = ResponseZodSchema extends undefined ?
|
|
|
9
9
|
type ZodAPISchemas = {
|
|
10
10
|
body?: ZodObject;
|
|
11
11
|
query?: ZodObject;
|
|
12
|
-
response?:
|
|
12
|
+
response?: ZodType;
|
|
13
13
|
};
|
|
14
14
|
type ErrorResponse = {
|
|
15
15
|
code: string;
|
|
@@ -30,7 +30,7 @@ type EndpointLogic<T extends ZodAPISchemas> = {
|
|
|
30
30
|
request: NextRequest;
|
|
31
31
|
flags: Record<string, boolean>;
|
|
32
32
|
endpointError: EndpointErrorGenerator;
|
|
33
|
-
}) => Promise<T['response'] extends
|
|
33
|
+
}) => Promise<T['response'] extends ZodType ? z.infer<T['response']> : void>;
|
|
34
34
|
guards?: Guard[];
|
|
35
35
|
eventHandlers?: {
|
|
36
36
|
onSuccess?: Array<(data: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alevnyacow/nzmt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Next Zod Modules Toolkit",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/alevnyacow/nzmt.git"
|
|
8
|
+
},
|
|
5
9
|
"license": "MIT",
|
|
6
10
|
"type": "module",
|
|
7
11
|
"exports": {
|