@alevnyacow/nzmt 0.20.1 → 0.20.2

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.
Files changed (2) hide show
  1. package/bin/cli.js +5 -4
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -403,13 +403,14 @@ function initPrisma() {
403
403
  )
404
404
  }
405
405
 
406
- function initAPIGuards() {
406
+ function initEndpointGuards() {
407
407
  const config = loadConfig()
408
408
  const endpointGuardsFolder = path.resolve(process.cwd(), `${config.coreFolder}${config?.paths?.infrastructure}`, 'endpoint-guards')
409
409
  fs.mkdirSync(endpointGuardsFolder, { recursive: true })
410
410
 
411
411
  fs.writeFileSync(path.resolve(endpointGuardsFolder, 'endpoint-guards.ts'), [
412
- `import { Controller } from '@alevnyacow/nzmt'`,
412
+ `import type { Controller } from '@alevnyacow/nzmt'`,
413
+ '',
413
414
  `export class EndpointGuards {`,
414
415
  `\tdummyGuard: Controller.Guard = async () => { return undefined }`,
415
416
  `}`
@@ -489,7 +490,7 @@ if (command.toLowerCase() === 'init' || command === 'i') {
489
490
  initSharedErrors()
490
491
  initPrisma()
491
492
  initLogger()
492
- initAPIGuards()
493
+ initEndpointGuards()
493
494
 
494
495
  process.exit(0)
495
496
  }
@@ -1059,7 +1060,7 @@ function generateController(upperCase, lowerCase, crudService) {
1059
1060
  ``,
1060
1061
  `\tprivate readonly endpoints = Controller.endpoints(`,
1061
1062
  `\t\t${lowerCase}ControllerMetadata,`,
1062
- '\t\t{ onErrorHandlers: [this.logger.error] }',
1063
+ '\t\t{ onErrorHandlers: [this.logger.error], guards: [] }',
1063
1064
  '\t)',
1064
1065
  ``,
1065
1066
  crudService ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alevnyacow/nzmt",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Next Zod Modules Toolkit",
5
5
  "keywords": ["next", "full-stack", "server", "backend", "cli", "scaffolder", "zod", "rest", "contract programming", "react-query", "ddd", "domain-driven"],
6
6
  "repository": {