@alevnyacow/nzmt 0.1.12 → 0.1.14
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/README.md +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Returns zod module method generator.
|
|
|
34
34
|
```ts
|
|
35
35
|
import { Module } from '@alevnyacow/nzmt'
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const mathServiceMetadata = {
|
|
38
38
|
// Service name, will be used in errors
|
|
39
39
|
name: 'MathService',
|
|
40
40
|
// Method schemas description
|
|
@@ -53,8 +53,16 @@ const mathServiceMethods = Module.methods({
|
|
|
53
53
|
})
|
|
54
54
|
},
|
|
55
55
|
// ...another methods
|
|
56
|
-
}
|
|
57
|
-
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Use `... satisfies Module.Metadata` instead of
|
|
59
|
+
* `const mathServiceMetadata: Module.Metadata = ...`
|
|
60
|
+
* for correct TS autocompletion in your IDE when
|
|
61
|
+
* using `Module.methods`.
|
|
62
|
+
*/
|
|
63
|
+
} satisfies Module.Metadata
|
|
64
|
+
|
|
65
|
+
const mathServiceMethods = Module.methods(mathServiceMetadata)
|
|
58
66
|
```
|
|
59
67
|
|
|
60
68
|
2. How to use this generator (example with class, you can use it also without classes):
|
|
@@ -116,6 +124,10 @@ const { result } = mathService.basicOperation({
|
|
|
116
124
|
})
|
|
117
125
|
```
|
|
118
126
|
|
|
127
|
+
### Metadata
|
|
128
|
+
|
|
129
|
+
Desribes module metadata. Metadata is used as an argument in `methods`.
|
|
130
|
+
|
|
119
131
|
## <a id='controller'></a>Controller
|
|
120
132
|
|
|
121
133
|
## <a id='store'></a>Store
|