@postxl/generator 0.28.1 → 0.29.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.
|
@@ -69,7 +69,7 @@ export const ${meta.react.switcherFieldName} = ({
|
|
|
69
69
|
React.ComponentPropsWithoutRef<typeof ${meta.react.switcherInputName}>,
|
|
70
70
|
'value' | 'onChange'
|
|
71
71
|
>) => {
|
|
72
|
-
const [field,
|
|
72
|
+
const [field, , helpers] = useField<${enumerator.name}>({ name })
|
|
73
73
|
|
|
74
74
|
return <${meta.react.switcherInputName} value={field.value} onChange={helpers.setValue} {...delegated} />
|
|
75
75
|
}
|
|
@@ -275,8 +275,7 @@ function _generateMainBuildingBlocks_InMemoryOnly({ model, meta, blocks, }) {
|
|
|
275
275
|
if (!existingItem) {
|
|
276
276
|
throw new Error(\`Could not update ${meta.userFriendlyName} with id \${item.id}. Not found!\`)
|
|
277
277
|
}
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
|
|
280
279
|
${blocks.maxLengthBlocks.updateCode.join('\n')}
|
|
281
280
|
|
|
282
281
|
${blocks.uniqueStringFieldsBlocks.updateCode.join('\n')}
|
|
@@ -66,22 +66,15 @@ export const ${meta.trpc.routerName} = router({
|
|
|
66
66
|
return ctx.data.${meta.data.dataServiceName}.getList(input)
|
|
67
67
|
}),
|
|
68
68
|
|
|
69
|
-
${
|
|
70
|
-
|
|
71
|
-
${
|
|
69
|
+
${createMethod}
|
|
70
|
+
|
|
71
|
+
${updateMethod}
|
|
72
|
+
|
|
73
|
+
${deleteMethod}
|
|
72
74
|
})
|
|
73
75
|
`;
|
|
74
76
|
}
|
|
75
77
|
exports.generateRoute = generateRoute;
|
|
76
|
-
function omit(lines, omitted) {
|
|
77
|
-
if (!omitted) {
|
|
78
|
-
return lines;
|
|
79
|
-
}
|
|
80
|
-
return lines
|
|
81
|
-
.split('\n')
|
|
82
|
-
.map((l) => `// ${l}`)
|
|
83
|
-
.join('\n');
|
|
84
|
-
}
|
|
85
78
|
function getCreateMethod({ model: { fields }, meta }) {
|
|
86
79
|
const parameters = fields
|
|
87
80
|
.filter((f) => f.kind !== 'id')
|
package/dist/lib/attributes.d.ts
CHANGED
|
@@ -5,18 +5,6 @@ export type ModelAttributes = {
|
|
|
5
5
|
* Schema tag: ´@@Ignore()`
|
|
6
6
|
*/
|
|
7
7
|
ignore: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Schema tag: ´@@SkipUpdate()`
|
|
10
|
-
*/
|
|
11
|
-
skipUpdate: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Schema tag: ´@@SkipCreate()`
|
|
14
|
-
*/
|
|
15
|
-
skipCreate: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Schema tag: ´@@SkipDelete()`
|
|
18
|
-
*/
|
|
19
|
-
skipDelete: boolean;
|
|
20
8
|
/**
|
|
21
9
|
* Schema tag: ´@@Description("Description of the model")`
|
|
22
10
|
*/
|
|
@@ -68,12 +68,6 @@ function getModelAttributes(model) {
|
|
|
68
68
|
const decoder = zod_1.default
|
|
69
69
|
.object({
|
|
70
70
|
ignore: blankStringBooleanDecoder,
|
|
71
|
-
skipUpdate: blankStringBooleanDecoder,
|
|
72
|
-
customUpdate: blankStringBooleanDecoder,
|
|
73
|
-
skipCreate: blankStringBooleanDecoder,
|
|
74
|
-
customCreate: blankStringBooleanDecoder,
|
|
75
|
-
skipDelete: blankStringBooleanDecoder,
|
|
76
|
-
customDelete: blankStringBooleanDecoder,
|
|
77
71
|
inMemoryOnly: blankStringBooleanDecoder,
|
|
78
72
|
description: zod_1.default.string().optional(),
|
|
79
73
|
schema: zod_1.default.string().optional(),
|
|
@@ -81,9 +75,6 @@ function getModelAttributes(model) {
|
|
|
81
75
|
})
|
|
82
76
|
.transform((obj) => ({
|
|
83
77
|
ignore: obj.ignore,
|
|
84
|
-
skipUpdate: obj.skipUpdate || obj.customUpdate,
|
|
85
|
-
skipCreate: obj.skipCreate || obj.customCreate,
|
|
86
|
-
skipDelete: obj.skipDelete || obj.customDelete,
|
|
87
78
|
inMemoryOnly: obj.inMemoryOnly,
|
|
88
79
|
description: obj.description,
|
|
89
80
|
databaseSchema: obj.schema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postxl/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"main": "./dist/generator.js",
|
|
5
5
|
"typings": "./dist/generator.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -15,29 +15,29 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@faker-js/faker": "7.6.0",
|
|
18
|
-
"@prisma/generator-helper": "5.
|
|
19
|
-
"@prisma/internals": "^5.
|
|
18
|
+
"@prisma/generator-helper": "^5.2.0",
|
|
19
|
+
"@prisma/internals": "^5.2.0",
|
|
20
20
|
"exceljs": "^4.3.0",
|
|
21
21
|
"fast-glob": "^3.2.12",
|
|
22
|
-
"prettier": "^2.8.
|
|
22
|
+
"prettier": "^2.8.8",
|
|
23
23
|
"remeda": "1.9.4",
|
|
24
24
|
"zod": "3.21.4",
|
|
25
25
|
"@postxl/lock": "0.4.8"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@prisma/client": "5.
|
|
28
|
+
"@prisma/client": "^5.2.0",
|
|
29
29
|
"@types/jest": "^29.5.0",
|
|
30
30
|
"@types/node": "18.15.10",
|
|
31
31
|
"jest": "29.5.0",
|
|
32
|
-
"prisma": "5.
|
|
32
|
+
"prisma": "5.2.0",
|
|
33
33
|
"ts-jest": "29.0.5",
|
|
34
34
|
"ts-node": "10.9.1",
|
|
35
35
|
"ts-toolbelt": "^9.6.0",
|
|
36
36
|
"tsconfig-paths": "4.1.2",
|
|
37
|
-
"typescript": "5.
|
|
37
|
+
"typescript": "5.2.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"prisma": "
|
|
40
|
+
"prisma": "5.2.0"
|
|
41
41
|
},
|
|
42
42
|
"wallaby": {
|
|
43
43
|
"autoDetect": true
|