prisma-nestjs-graphql 15.3.0 → 15.3.3
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/LICENSE +1 -1
- package/README.md +5 -4
- package/index.js +18 -6
- package/package.json +15 -15
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -338,16 +338,16 @@ It will affect all inputs and outputs types (including models).
|
|
|
338
338
|
|
|
339
339
|
## Documentation and field options
|
|
340
340
|
|
|
341
|
-
Comments with
|
|
341
|
+
Comments with triple slash will projected to typescript code comments
|
|
342
342
|
and some `@Field()` decorator options
|
|
343
343
|
|
|
344
344
|
For example:
|
|
345
345
|
|
|
346
346
|
```prisma
|
|
347
347
|
model Product {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
oldName
|
|
348
|
+
/// Old description
|
|
349
|
+
/// @deprecated Use new name instead
|
|
350
|
+
oldName String
|
|
351
351
|
}
|
|
352
352
|
```
|
|
353
353
|
|
|
@@ -703,6 +703,7 @@ export class User {}
|
|
|
703
703
|
|
|
704
704
|
## Similar Projects
|
|
705
705
|
|
|
706
|
+
- https://github.com/omar-dulaimi/prisma-class-validator-generator
|
|
706
707
|
- https://github.com/kimjbstar/prisma-class-generator
|
|
707
708
|
- https://github.com/odroe/nest-gql-mix
|
|
708
709
|
- https://github.com/rfermann/nestjs-prisma-graphql-generator
|
package/index.js
CHANGED
|
@@ -1328,10 +1328,13 @@ function noAtomicOperations(eventEmitter) {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
__name(noAtomicOperations, "noAtomicOperations");
|
|
1330
1330
|
function beforeInputType2(args) {
|
|
1331
|
-
const { inputType: inputType1 } = args;
|
|
1331
|
+
const { inputType: inputType1, getModelName: getModelName2 } = args;
|
|
1332
1332
|
for (const field of inputType1.fields) {
|
|
1333
|
+
const fieldName = field.name;
|
|
1333
1334
|
field.inputTypes = field.inputTypes.filter((inputType2) => {
|
|
1334
|
-
|
|
1335
|
+
const inputTypeName = String(inputType2.type);
|
|
1336
|
+
const modelName = getModelName2(inputTypeName);
|
|
1337
|
+
if (isAtomicOperation(inputTypeName) || modelName && isListInput(inputTypeName, modelName, fieldName)) {
|
|
1335
1338
|
return false;
|
|
1336
1339
|
}
|
|
1337
1340
|
return true;
|
|
@@ -1350,10 +1353,17 @@ function beforeGenerateFiles(args) {
|
|
|
1350
1353
|
}
|
|
1351
1354
|
}
|
|
1352
1355
|
__name(beforeGenerateFiles, "beforeGenerateFiles");
|
|
1353
|
-
function isAtomicOperation(
|
|
1354
|
-
|
|
1356
|
+
function isAtomicOperation(typeName) {
|
|
1357
|
+
if (typeName.endsWith("FieldUpdateOperationsInput")) {
|
|
1358
|
+
return true;
|
|
1359
|
+
}
|
|
1360
|
+
return false;
|
|
1355
1361
|
}
|
|
1356
1362
|
__name(isAtomicOperation, "isAtomicOperation");
|
|
1363
|
+
function isListInput(typeName, model, field) {
|
|
1364
|
+
return typeName === `${model}Create${field}Input` || typeName === `${model}Update${field}Input`;
|
|
1365
|
+
}
|
|
1366
|
+
__name(isListInput, "isListInput");
|
|
1357
1367
|
|
|
1358
1368
|
// src/handlers/output-type.ts
|
|
1359
1369
|
var import_assert4 = require("assert");
|
|
@@ -1962,7 +1972,9 @@ var splitKeywords = [
|
|
|
1962
1972
|
"SumOrderBy",
|
|
1963
1973
|
"MinOrderBy",
|
|
1964
1974
|
"MaxOrderBy",
|
|
1965
|
-
"AvgOrderBy"
|
|
1975
|
+
"AvgOrderBy",
|
|
1976
|
+
"Create",
|
|
1977
|
+
"Update"
|
|
1966
1978
|
].sort((a, b) => b.length - a.length);
|
|
1967
1979
|
var endsWithKeywords = [
|
|
1968
1980
|
"Aggregate",
|
|
@@ -2108,7 +2120,7 @@ async function generate(args) {
|
|
|
2108
2120
|
for (const model of datamodel.models) {
|
|
2109
2121
|
await eventEmitter.emit("Model", model, eventArguments);
|
|
2110
2122
|
}
|
|
2111
|
-
for (const model1 of datamodel.types) {
|
|
2123
|
+
for (const model1 of datamodel.types || []) {
|
|
2112
2124
|
await eventEmitter.emit("Model", model1, eventArguments);
|
|
2113
2125
|
}
|
|
2114
2126
|
await eventEmitter.emit("PostBegin", eventArguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-nestjs-graphql",
|
|
3
|
-
"version": "15.3.
|
|
3
|
+
"version": "15.3.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@prisma/generator-helper": "^3.13.0",
|
|
54
|
+
"@prisma/generator-helper": "^3.14.0",
|
|
56
55
|
"await-event-emitter": "^2.0.2",
|
|
57
56
|
"filenamify": "4.X",
|
|
58
57
|
"flat": "^5.0.2",
|
|
@@ -65,34 +64,35 @@
|
|
|
65
64
|
"ts-morph": ">=11"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
67
|
+
"@nestjs/apollo": "^10.0.11",
|
|
68
68
|
"@commitlint/cli": "^16.2.4",
|
|
69
69
|
"@commitlint/config-conventional": "^16.2.4",
|
|
70
70
|
"@nestjs/common": "^8.4.4",
|
|
71
71
|
"@nestjs/core": "^8.4.4",
|
|
72
|
-
"@nestjs/graphql": "^10.0.
|
|
72
|
+
"@nestjs/graphql": "^10.0.11",
|
|
73
73
|
"@nestjs/platform-express": "^8.4.4",
|
|
74
|
-
"@paljs/plugins": "^4.0
|
|
75
|
-
"@prisma/client": "^3.
|
|
74
|
+
"@paljs/plugins": "^4.1.0",
|
|
75
|
+
"@prisma/client": "^3.14.0",
|
|
76
76
|
"@semantic-release/changelog": "^6.0.1",
|
|
77
77
|
"@semantic-release/git": "^10.0.1",
|
|
78
|
-
"@swc/core": "^1.2.
|
|
79
|
-
"@swc/helpers": "^0.3.
|
|
78
|
+
"@swc/core": "^1.2.181",
|
|
79
|
+
"@swc/helpers": "^0.3.13",
|
|
80
80
|
"@swc/register": "^0.1.10",
|
|
81
81
|
"@types/flat": "^5.0.2",
|
|
82
82
|
"@types/lodash": "^4.14.182",
|
|
83
83
|
"@types/mocha": "^9.1.1",
|
|
84
84
|
"@types/node": "^17.0.31",
|
|
85
85
|
"@types/pluralize": "^0.0.29",
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
87
|
-
"@typescript-eslint/parser": "^5.
|
|
88
|
-
"apollo-server-express": "^3.
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
|
87
|
+
"@typescript-eslint/parser": "^5.23.0",
|
|
88
|
+
"apollo-server-express": "^3.7.0",
|
|
89
89
|
"c8": "^7.11.2",
|
|
90
90
|
"class-transformer": "^0.5.1",
|
|
91
91
|
"class-validator": "^0.13.2",
|
|
92
92
|
"commitizen": "^4.2.4",
|
|
93
93
|
"cz-customizable": "^6.3.0",
|
|
94
94
|
"decimal.js": "^10.3.1",
|
|
95
|
-
"eslint": "^8.
|
|
95
|
+
"eslint": "^8.15.0",
|
|
96
96
|
"eslint-import-resolver-node": "^0.3.6",
|
|
97
97
|
"eslint-plugin-etc": "^2.0.2",
|
|
98
98
|
"eslint-plugin-import": "^2.26.0",
|
|
@@ -103,17 +103,17 @@
|
|
|
103
103
|
"eslint-plugin-sort-class-members": "^1.14.1",
|
|
104
104
|
"eslint-plugin-unicorn": "^42.0.0",
|
|
105
105
|
"eslint-plugin-wix-editor": "^3.3.0",
|
|
106
|
-
"expect": "^28.0
|
|
106
|
+
"expect": "^28.1.0",
|
|
107
107
|
"ghooks": "^2.0.4",
|
|
108
108
|
"git-branch-is": "^4.0.0",
|
|
109
|
-
"graphql": "^16.
|
|
109
|
+
"graphql": "^16.5.0",
|
|
110
110
|
"graphql-scalars": "^1.17.0",
|
|
111
111
|
"graphql-type-json": "^0.3.2",
|
|
112
112
|
"mocha": "^10.0.0",
|
|
113
113
|
"ololog": "^1.1.175",
|
|
114
114
|
"precise-commits": "^1.0.2",
|
|
115
115
|
"prettier": "^2.6.2",
|
|
116
|
-
"prisma": "^3.
|
|
116
|
+
"prisma": "^3.14.0",
|
|
117
117
|
"prisma-graphql-type-decimal": "^2.0.0",
|
|
118
118
|
"reflect-metadata": "^0.1.13",
|
|
119
119
|
"request": "^2.88.2",
|