@alevnyacow/nzmt 0.0.13 → 0.0.15
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 +16 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -47,6 +47,7 @@ if (command === 'init-config') {
|
|
|
47
47
|
throw 'No package.json was found'
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
|
|
50
51
|
fs.writeFileSync(path.resolve(projectRoot, 'nzmt.config.json'), JSON.stringify({
|
|
51
52
|
paths: {
|
|
52
53
|
prismaImport: [
|
|
@@ -57,7 +58,8 @@ if (command === 'init-config') {
|
|
|
57
58
|
services: './backend/services',
|
|
58
59
|
providers: './backend/providers',
|
|
59
60
|
controllers: './backend/controllers'
|
|
60
|
-
}
|
|
61
|
+
},
|
|
62
|
+
dependencyInjection: 'inversifyjs'
|
|
61
63
|
}, null, '\t'))
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -80,7 +82,6 @@ function camelizeVariants(str) {
|
|
|
80
82
|
return [lowerCamel, upperCamel];
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
|
|
84
85
|
var [lowerCase, upperCase] = camelizeVariants(entityName)
|
|
85
86
|
|
|
86
87
|
if (command === 'store') {
|
|
@@ -119,20 +120,23 @@ if (command === 'store') {
|
|
|
119
120
|
// RAM
|
|
120
121
|
|
|
121
122
|
fs.writeFileSync(path.resolve(folder, `${entityName}.store.ram.ts`), [
|
|
123
|
+
config?.dependencyInjection === 'inversifyjs' ? "import { injectable } from 'inversify'" : undefined,
|
|
122
124
|
"import { Store } from '@alevnyacow/nzmt'",
|
|
123
125
|
`import { type ${upperCase}Store, ${lowerCase}StoreMetadata } from './${entityName}.store'`,
|
|
124
126
|
"",
|
|
125
127
|
`const CRUDInRAM = Store.InRAM(${lowerCase}StoreMetadata)`,
|
|
126
128
|
"",
|
|
129
|
+
config?.dependencyInjection === 'inversifyjs' ? "@injectable()" : undefined,
|
|
127
130
|
`export class ${upperCase}RAMStore extends CRUDInRAM implements ${upperCase}Store {`,
|
|
128
131
|
"\t",
|
|
129
132
|
"}"
|
|
130
|
-
].join('\n'))
|
|
133
|
+
].filter(x => typeof x === 'string').join('\n'))
|
|
131
134
|
|
|
132
135
|
// Prisma
|
|
133
136
|
|
|
134
137
|
fs.writeFileSync(path.resolve(folder, `${entityName}.store.prisma.ts`), [
|
|
135
138
|
...config?.paths?.['prismaImport'] ?? [],
|
|
139
|
+
config?.dependencyInjection === 'inversifyjs' ? "import { injectable } from 'inversify'" : undefined,
|
|
136
140
|
"import { Store } from '@alevnyacow/nzmt'",
|
|
137
141
|
`import { type ${upperCase}Store, ${lowerCase}StoreMetadata } from './${entityName}.store'`,
|
|
138
142
|
"",
|
|
@@ -171,6 +175,7 @@ if (command === 'store') {
|
|
|
171
175
|
"\t}",
|
|
172
176
|
"}",
|
|
173
177
|
"",
|
|
178
|
+
config?.dependencyInjection === 'inversifyjs' ? "@injectable()" : undefined,
|
|
174
179
|
`export class ${upperCase}PrismaStore implements ${upperCase}Store {`,
|
|
175
180
|
`\tprivate method = Store.methods(${lowerCase}StoreMetadata);`,
|
|
176
181
|
"",
|
|
@@ -234,5 +239,13 @@ if (command === 'store') {
|
|
|
234
239
|
"\t});",
|
|
235
240
|
"};"
|
|
236
241
|
].join('\n'))
|
|
242
|
+
|
|
243
|
+
// barrel
|
|
244
|
+
|
|
245
|
+
fs.writeFileSync(path.resolve(folder, 'index.ts'), [
|
|
246
|
+
`export * from './${entityName}.store.ts`,
|
|
247
|
+
`export * from './${entityName}.store.prisma.ts`,
|
|
248
|
+
`export * from './${entityName}.store.ram.ts`
|
|
249
|
+
].join('\n'))
|
|
237
250
|
}
|
|
238
251
|
|
package/dist/index.cjs
CHANGED
|
@@ -33,9 +33,9 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
Controller: ()=>zod_controller_utils_namespaceObject,
|
|
36
37
|
Store: ()=>store_namespaceObject,
|
|
37
|
-
zodModuleMethodFactory: ()=>zodModuleMethodFactory
|
|
38
|
-
API: ()=>zod_controller_utils_namespaceObject
|
|
38
|
+
zodModuleMethodFactory: ()=>zodModuleMethodFactory
|
|
39
39
|
});
|
|
40
40
|
var zod_controller_utils_namespaceObject = {};
|
|
41
41
|
__webpack_require__.r(zod_controller_utils_namespaceObject);
|
|
@@ -500,11 +500,11 @@ const InRAM = (schemas, options)=>{
|
|
|
500
500
|
}
|
|
501
501
|
return RAMStore;
|
|
502
502
|
};
|
|
503
|
-
exports.
|
|
503
|
+
exports.Controller = __webpack_exports__.Controller;
|
|
504
504
|
exports.Store = __webpack_exports__.Store;
|
|
505
505
|
exports.zodModuleMethodFactory = __webpack_exports__.zodModuleMethodFactory;
|
|
506
506
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
507
|
-
"
|
|
507
|
+
"Controller",
|
|
508
508
|
"Store",
|
|
509
509
|
"zodModuleMethodFactory"
|
|
510
510
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -461,4 +461,4 @@ const InRAM = (schemas, options)=>{
|
|
|
461
461
|
}
|
|
462
462
|
return RAMStore;
|
|
463
463
|
};
|
|
464
|
-
export { store_namespaceObject as Store, zodModuleMethodFactory, zod_controller_utils_namespaceObject as
|
|
464
|
+
export { store_namespaceObject as Store, zodModuleMethodFactory, zod_controller_utils_namespaceObject as Controller };
|