@postxl/generator 0.40.1 → 0.41.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.
|
@@ -117,7 +117,8 @@ exports.getEnumAttributes = getEnumAttributes;
|
|
|
117
117
|
function getFieldAttributes(field) {
|
|
118
118
|
const attributes = parseAttributesFromDocumentation(field);
|
|
119
119
|
// Prisma also has an "@ignore" attribute - see https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#ignore
|
|
120
|
-
//
|
|
120
|
+
// The `isIgnored` property is not documented in the DMMF anymore, but it is still provided by Prisma.
|
|
121
|
+
// In case it is found but our attribute is missing, we throw an error, forcing the user to also set our attribute.
|
|
121
122
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
122
123
|
const isPrismaIgnored = field.isIgnored === true;
|
|
123
124
|
const exampleDecoder = zod_1.default.union([zod_1.default.string(), zod_1.default.number(), zod_1.default.boolean(), zod_1.default.null()]);
|
|
@@ -141,8 +142,11 @@ function getFieldAttributes(field) {
|
|
|
141
142
|
})
|
|
142
143
|
.transform((obj) => {
|
|
143
144
|
var _a;
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
if (isPrismaIgnored && !obj.ignore) {
|
|
146
|
+
throw new Error(`Field ${field.name} is ignored by Prisma, but is missing the "ignore" PostXL attribute!`);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
ignore: obj.ignore,
|
|
146
150
|
description: obj.description,
|
|
147
151
|
isDefaultField: obj.isDefault,
|
|
148
152
|
isLabel: obj.label,
|
|
@@ -151,7 +155,7 @@ function getFieldAttributes(field) {
|
|
|
151
155
|
isReadonly: obj.readonly || field.isGenerated || field.isUpdatedAt || field.name === 'createdAt' || field.isId,
|
|
152
156
|
isUpdatedAt: (_a = field.isUpdatedAt) !== null && _a !== void 0 ? _a : false,
|
|
153
157
|
isCreatedAt: field.name === 'createdAt',
|
|
154
|
-
}
|
|
158
|
+
};
|
|
155
159
|
});
|
|
156
160
|
const result = decoder.safeParse(attributes);
|
|
157
161
|
if (!result.success) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postxl/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"main": "./dist/generator.js",
|
|
5
5
|
"typings": "./dist/generator.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -15,8 +15,8 @@
|
|
|
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.6.0",
|
|
19
|
+
"@prisma/internals": "^5.6.0",
|
|
20
20
|
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
21
21
|
"@typescript-eslint/parser": "^6.10.0",
|
|
22
22
|
"@typescript-eslint/utils": "^6.10.0",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@postxl/lock": "1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@prisma/client": "^5.
|
|
33
|
+
"@prisma/client": "^5.6.0",
|
|
34
34
|
"@types/eslint": "^8.44.7",
|
|
35
35
|
"@types/jest": "^29.5.0",
|
|
36
36
|
"@types/node": "18.15.10",
|
|
37
37
|
"jest": "29.7.0",
|
|
38
|
-
"prisma": "5.
|
|
38
|
+
"prisma": "5.6.0",
|
|
39
39
|
"ts-jest": "29.0.5",
|
|
40
40
|
"ts-node": "10.9.1",
|
|
41
41
|
"ts-toolbelt": "^9.6.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typescript": "5.2.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"prisma": "5.
|
|
46
|
+
"prisma": "5.6.0"
|
|
47
47
|
},
|
|
48
48
|
"wallaby": {
|
|
49
49
|
"autoDetect": true
|