@alevnyacow/nzmt 0.20.0 → 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 -3
  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,6 +490,7 @@ if (command.toLowerCase() === 'init' || command === 'i') {
489
490
  initSharedErrors()
490
491
  initPrisma()
491
492
  initLogger()
493
+ initEndpointGuards()
492
494
 
493
495
  process.exit(0)
494
496
  }
@@ -1058,7 +1060,7 @@ function generateController(upperCase, lowerCase, crudService) {
1058
1060
  ``,
1059
1061
  `\tprivate readonly endpoints = Controller.endpoints(`,
1060
1062
  `\t\t${lowerCase}ControllerMetadata,`,
1061
- '\t\t{ onErrorHandlers: [this.logger.error] }',
1063
+ '\t\t{ onErrorHandlers: [this.logger.error], guards: [] }',
1062
1064
  '\t)',
1063
1065
  ``,
1064
1066
  crudService ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alevnyacow/nzmt",
3
- "version": "0.20.0",
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": {