@alevnyacow/nzmt 0.38.1 → 0.39.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/bin/cli.js CHANGED
@@ -1126,7 +1126,7 @@ function generateController(upperCase, lowerCase, crudService) {
1126
1126
  ...importInjections,
1127
1127
  ``,
1128
1128
  `@injectable()`,
1129
- `export class ${upperCase}Controller {`,
1129
+ `export class ${upperCase}Controller implements Controller.EndpointList<typeof ${lowerCase}ControllerMetadata> {`,
1130
1130
  `\tconstructor(`,
1131
1131
  ...injections.map(x => `\t\t@inject('${x}' satisfies DITokens) private readonly ${x.charAt(0).toLowerCase() + x.slice(1)}: ${x},`),
1132
1132
  `\t) {}`,
@@ -1,3 +1,4 @@
1
+ declare function jsonResponse<T>(data: T, init?: ResponseInit): import("undici-types").Response;
1
2
  import { type NextRequest, type NextResponse } from 'next/server';
2
3
  import z, { type ZodType, type ZodObject, type ZodUnion } from 'zod';
3
4
  import { type ControllerErrorModel, type ErrorBaseCreatingPayload } from './errors.utils';
@@ -26,7 +27,7 @@ export type OnErrorHandler = (request: {
26
27
  req: NextRequest;
27
28
  }) => Promise<void>;
28
29
  export type EndpointList<T extends Metadata> = {
29
- [K in keyof T['schemas']]: (request: NextRequest) => Promise<Response>;
30
+ [K in keyof T['schemas']]: (request: NextRequest) => Promise<ReturnType<typeof jsonResponse>>;
30
31
  };
31
32
  type EndpointLogic<T extends ZodAPISchemas> = {
32
33
  handler: (payload: (T['query'] extends ZodType ? z.infer<T['query']> : {}) & (T['body'] extends ZodType ? z.infer<T['body']> : {}), request: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alevnyacow/nzmt",
3
- "version": "0.38.1",
3
+ "version": "0.39.0",
4
4
  "description": "Next Zod Modules Toolkit",
5
5
  "keywords": ["next", "full-stack", "server", "backend", "cli", "scaffolding", "zod", "rest", "contract programming", "contract-first", "react-query", "ddd", "domain-driven"],
6
6
  "repository": {