@alevnyacow/nzmt 0.32.0 → 0.33.0
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/bin/cli.js +9 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -118,6 +118,9 @@ function createDefaultConfig() {
|
|
|
118
118
|
prisma: {
|
|
119
119
|
clientPath: prismaClientPath
|
|
120
120
|
},
|
|
121
|
+
},
|
|
122
|
+
services: {
|
|
123
|
+
defaultInjections: []
|
|
121
124
|
}
|
|
122
125
|
} : {
|
|
123
126
|
coreFolder,
|
|
@@ -133,6 +136,9 @@ function createDefaultConfig() {
|
|
|
133
136
|
sharedErrors: '/domain/errors',
|
|
134
137
|
queries: '/ui/shared/queries',
|
|
135
138
|
clientUtils: '/ui/shared/utils'
|
|
139
|
+
},
|
|
140
|
+
services: {
|
|
141
|
+
defaultInjections: []
|
|
136
142
|
}
|
|
137
143
|
}, null, '\t'))
|
|
138
144
|
}
|
|
@@ -924,6 +930,7 @@ function toKebabFromPascal(str) {
|
|
|
924
930
|
|
|
925
931
|
function generateService(lowerCase, upperCase, store) {
|
|
926
932
|
const folder = config?.paths?.services ? path.resolve(process.cwd(), `${config.coreFolder}${config?.paths?.services}`, entityName) : path.resolve(process.cwd(), entityName);
|
|
933
|
+
const defaultInjections = config?.services?.defaultInjections
|
|
927
934
|
|
|
928
935
|
const proxiedStore = store || options.find(x => x.startsWith('p:'))?.split(':')?.at(-1)
|
|
929
936
|
if (proxiedStore && !proxiedStore.endsWith('Store')) {
|
|
@@ -935,6 +942,8 @@ function generateService(lowerCase, upperCase, store) {
|
|
|
935
942
|
injections = injections.concat(proxiedStore)
|
|
936
943
|
}
|
|
937
944
|
|
|
945
|
+
injections = [...defaultInjections, ...injections.filter(x => !defaultInjections.includes(x))]
|
|
946
|
+
|
|
938
947
|
const importInjections = injections.map((i) => {
|
|
939
948
|
if (i.endsWith('Service') || i.endsWith('Controller')) {
|
|
940
949
|
throw 'Only stores and infrastructure can be injected in services'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alevnyacow/nzmt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Next Zod Modules Toolkit",
|
|
5
5
|
"keywords": ["next", "full-stack", "server", "backend", "cli", "scaffolding", "zod", "rest", "contract programming", "contract-first", "react-query", "ddd", "domain-driven"],
|
|
6
6
|
"repository": {
|