@alevnyacow/nzmt 0.5.0 → 0.5.1
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 +5 -5
- 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
|
@@ -471,13 +471,13 @@ function generateEntity(upperCase) {
|
|
|
471
471
|
|
|
472
472
|
const body = [
|
|
473
473
|
"import z from 'zod'",
|
|
474
|
-
"import {
|
|
474
|
+
"import { ValueObjects } from '@alevnyacow/nzmt'",
|
|
475
475
|
"",
|
|
476
476
|
`export type ${upperCase}Model = z.infer<typeof ${upperCase}.schema>`,
|
|
477
477
|
"",
|
|
478
478
|
`export class ${upperCase} {`,
|
|
479
479
|
"\tstatic schema = z.object({",
|
|
480
|
-
"\t\tid:
|
|
480
|
+
"\t\tid: ValueObjects.Identifier.schema,",
|
|
481
481
|
fields.length ?
|
|
482
482
|
fields.map(([fieldName, description]) => {
|
|
483
483
|
return `\t\t${fieldName}: z.${description.split('.').join('().')}(),`
|
|
@@ -628,7 +628,7 @@ function generateService(lowerCase, upperCase, withCrud) {
|
|
|
628
628
|
// Metadata
|
|
629
629
|
if (withCrud) {
|
|
630
630
|
fs.writeFileSync(path.resolve(folder, `${entityName}.service.metadata.ts`), [
|
|
631
|
-
"import { type Module,
|
|
631
|
+
"import { type Module, ValueObjects } from '@alevnyacow/nzmt'",
|
|
632
632
|
"import z from 'zod'",
|
|
633
633
|
`import { ${lowerCase}StoreMetadata } from '${config?.paths?.stores?.replace('./src', '@')}/${entityName}'`,
|
|
634
634
|
"",
|
|
@@ -646,7 +646,7 @@ function generateService(lowerCase, upperCase, withCrud) {
|
|
|
646
646
|
`\t\tgetList: {`,
|
|
647
647
|
`\t\t\tpayload: z.object({`,
|
|
648
648
|
`\t\t\t\tfilter: ${lowerCase}StoreMetadata.searchPayload.list,`,
|
|
649
|
-
`\t\t\t\tpagination:
|
|
649
|
+
`\t\t\t\tpagination: ValueObjects.Pagination.schema.optional()`,
|
|
650
650
|
`\t\t\t}),`,
|
|
651
651
|
`\t\t\tresponse: z.object({`,
|
|
652
652
|
`\t\t\t\titems: z.array(${lowerCase}StoreMetadata.models.list)`,
|
|
@@ -664,7 +664,7 @@ function generateService(lowerCase, upperCase, withCrud) {
|
|
|
664
664
|
`\t\t\t\tpayload: ${lowerCase}StoreMetadata.actionsPayload.create`,
|
|
665
665
|
`\t\t\t}),`,
|
|
666
666
|
`\t\t\tresponse: z.object({`,
|
|
667
|
-
`\t\t\t\tid:
|
|
667
|
+
`\t\t\t\tid: ValueObjects.Identifier.schema`,
|
|
668
668
|
`\t\t\t}),`,
|
|
669
669
|
`\t\t},`,
|
|
670
670
|
`\t\tdeleteOne: {`,
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
36
36
|
Controller: ()=>zod_controller_utils_namespaceObject,
|
|
37
37
|
Store: ()=>store_namespaceObject,
|
|
38
38
|
Module: ()=>zod_module_utils_namespaceObject,
|
|
39
|
-
|
|
39
|
+
ValueObjects: ()=>entities_namespaceObject
|
|
40
40
|
});
|
|
41
41
|
var zod_module_utils_namespaceObject = {};
|
|
42
42
|
__webpack_require__.r(zod_module_utils_namespaceObject);
|
|
@@ -540,14 +540,14 @@ class Identifier {
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
exports.Controller = __webpack_exports__.Controller;
|
|
543
|
-
exports.Entities = __webpack_exports__.Entities;
|
|
544
543
|
exports.Module = __webpack_exports__.Module;
|
|
545
544
|
exports.Store = __webpack_exports__.Store;
|
|
545
|
+
exports.ValueObjects = __webpack_exports__.ValueObjects;
|
|
546
546
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
547
547
|
"Controller",
|
|
548
|
-
"Entities",
|
|
549
548
|
"Module",
|
|
550
|
-
"Store"
|
|
549
|
+
"Store",
|
|
550
|
+
"ValueObjects"
|
|
551
551
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
552
552
|
Object.defineProperty(exports, '__esModule', {
|
|
553
553
|
value: true
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -499,4 +499,4 @@ class Identifier {
|
|
|
499
499
|
return zod.uuidv4().safeParse(this.data).success;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
export { entities_namespaceObject as
|
|
502
|
+
export { entities_namespaceObject as ValueObjects, store_namespaceObject as Store, zod_controller_utils_namespaceObject as Controller, zod_module_utils_namespaceObject as Module };
|