@bmstravel/nvp-plop-templates 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,10 @@
1
- import { IBaseService, IBaseAction, Event } from "@src/types"
1
+ import { IBaseService, {{#if mixinAction}}IBaseAction,{{/if}} {{#if mixinEvent}}Event{{/if}} } from "@src/types"
2
+ {{#if mixinAction}}
3
+ import { Context } from "moleculer"
4
+ {{/if}}
5
+ {{#if mixinEvent}}
6
+ import { Context } from "moleculer"
7
+ {{/if}}
2
8
  import {
3
9
  /* MOL_METHODTYPE_MIXIN */
4
10
  {{#if mixinMethod}}
@@ -26,27 +32,25 @@ export const {{pascalCase mixinName}}Mixin = () => {
26
32
  {{#if mixinAction}}
27
33
  const actions: { [x: string]: IBaseAction } = {
28
34
  /* MOL_ACTION_MIXIN */
29
- async {{camelCase mixinAction}}({ }: {{pascalCase mixinAction}}Params) {
30
- const $this: IBaseService<any, any> = this
31
- return {
32
- code: 0,
33
- data: {}
34
- }
35
- },
35
+ {{camelCase mixinAction}}: {
36
+ async handler(ctx: Context<{{pascalCase mixinAction}}Params, any>) {
37
+ const $this: IBaseService<any, any> = this
38
+ return {
39
+ code: 0,
40
+ data: {}
41
+ }
42
+ },
43
+ }
36
44
  }
37
45
  {{/if}}
38
46
  {{#if mixinEvent}}
39
- const events: { [x: string]: Event } = {
47
+ const events: Event = {
40
48
  /* MOL_EVENT_MIXIN */
41
49
  "{{camelCase mixinEvent}}": {
42
50
  params: {},
43
51
  handler(ctx: Context<{{pascalCase mixinEvent}}Params, any>) {
44
52
  const $this: IBaseService<any, any> = this
45
53
  $this.logger.info("Event received, parameters OK!", ctx.params);
46
- return {
47
- code: 0,
48
- data: {}
49
- }
50
54
  }
51
55
  }
52
56
  }
@@ -67,4 +71,6 @@ export const {{pascalCase mixinName}}Mixin = () => {
67
71
  }
68
72
  }
69
73
 
74
+ {{#if mixinMethod}}
70
75
  export type {{pascalCase mixinName}}MethodMixin = ReturnType<typeof {{pascalCase mixinName}}Mixin>["methods"]
76
+ {{/if}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bmstravel/nvp-plop-templates",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "🏆 Using for plop templates",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -15,5 +15,5 @@
15
15
  "phongnv86 <phongnguyenvan86@gmail.com>",
16
16
  "phongnv86 <phongnv@media-one.vn>"
17
17
  ],
18
- "gitHead": "5994e445edb1297724a87a732e6cadbd698999ce"
18
+ "gitHead": "48e0a694fd31148faea00aa5506703d192d5d544"
19
19
  }