@mikemajesty/microservice-crud 6.1.1 → 6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikemajesty/microservice-crud",
3
- "version": "6.1.1",
3
+ "version": "6.1.3",
4
4
  "description": "Monorepo CLI",
5
5
  "main": "src/cli.js",
6
6
  "scripts": {
@@ -1,18 +1,24 @@
1
1
  const { dashToPascal } = require("../../textUtils")
2
2
 
3
3
  const getServiceInfra = (name) => `import { Injectable } from '@nestjs/common';
4
+ import { z } from 'zod';
5
+
6
+ import { ValidateSchema } from '@/utils/decorators';
4
7
 
5
8
  import { I${dashToPascal(name)}Adapter } from './adapter';
6
9
 
7
- export type ${dashToPascal(name)}GetInput = {};
8
- export type ${dashToPascal(name)}GetOutput = {};
10
+ const ${dashToPascal(name)}Schema = z.object({ name: z.string().trim() });
9
11
 
10
12
  @Injectable()
11
13
  export class ${dashToPascal(name)}Service implements I${dashToPascal(name)}Adapter {
14
+ @ValidateSchema(${dashToPascal(name)}Schema)
12
15
  get(input: ${dashToPascal(name)}GetInput): ${dashToPascal(name)}GetOutput {
13
16
  return input;
14
17
  }
15
18
  }
19
+
20
+ export type ${dashToPascal(name)}GetInput = z.infer<typeof ${dashToPascal(name)}Schema>;
21
+ export type ${dashToPascal(name)}GetOutput = ${dashToPascal(name)}GetInput;
16
22
  `
17
23
 
18
24
  module.exports = {
@@ -9,17 +9,16 @@ import { I${dashToPascal(name)}Adapter } from './adapter';
9
9
 
10
10
  const ${dashToPascal(name)}Schema = z.object({ name: z.string().trim() });
11
11
 
12
- export type ${dashToPascal(name)}Input = z.infer<typeof ${dashToPascal(name)}Schema>;
13
-
14
- export type ${dashToPascal(name)}Output = string;
15
-
16
12
  @Injectable()
17
13
  export class ${dashToPascal(name)}Service implements I${dashToPascal(name)}Adapter {
18
14
  @ValidateSchema(${dashToPascal(name)}Schema)
19
- get({ name }: ${dashToPascal(name)}Input): ${dashToPascal(name)}Output {
20
- return name;
15
+ get(input: ${dashToPascal(name)}Input): ${dashToPascal(name)}Output {
16
+ return input;
21
17
  }
22
18
  }
19
+
20
+ export type ${dashToPascal(name)}Input = z.infer<typeof ${dashToPascal(name)}Schema>;
21
+ export type ${dashToPascal(name)}Output = ${dashToPascal(name)}Input;
23
22
  `
24
23
 
25
24
  module.exports = {