prisma-nestjs-graphql 15.3.1 → 15.3.2

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.
Files changed (4) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -4
  3. package/index.js +22 -4
  4. package/package.json +15 -15
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021
3
+ Copyright (c) 2022
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 double slash will projected to typescript code comments
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
- // Old description
349
- // @deprecated Use new name instead
350
- oldName
348
+ /// Old description
349
+ /// @deprecated Use new name instead
350
+ oldName String
351
351
  }
352
352
  ```
353
353
 
package/index.js CHANGED
@@ -1321,6 +1321,12 @@ function getExportDeclaration(name, statements) {
1321
1321
  }
1322
1322
  __name(getExportDeclaration, "getExportDeclaration");
1323
1323
 
1324
+ // src/helpers/is-list-input.ts
1325
+ function isListInput(typeName, model) {
1326
+ return typeName.startsWith(`${model}Create`) || typeName.startsWith(`${model}Update`);
1327
+ }
1328
+ __name(isListInput, "isListInput");
1329
+
1324
1330
  // src/handlers/no-atomic-operations.ts
1325
1331
  function noAtomicOperations(eventEmitter) {
1326
1332
  eventEmitter.on("BeforeInputType", beforeInputType2);
@@ -1328,10 +1334,12 @@ function noAtomicOperations(eventEmitter) {
1328
1334
  }
1329
1335
  __name(noAtomicOperations, "noAtomicOperations");
1330
1336
  function beforeInputType2(args) {
1331
- const { inputType: inputType1 } = args;
1337
+ const { inputType: inputType1, getModelName: getModelName2 } = args;
1332
1338
  for (const field of inputType1.fields) {
1333
1339
  field.inputTypes = field.inputTypes.filter((inputType2) => {
1334
- if (isAtomicOperation(String(inputType2.type))) {
1340
+ const inputTypeName = String(inputType2.type);
1341
+ const modelName = getModelName2(inputTypeName);
1342
+ if (isAtomicOperation(inputTypeName) || modelName && isListInput(inputTypeName, modelName)) {
1335
1343
  return false;
1336
1344
  }
1337
1345
  return true;
@@ -1350,8 +1358,11 @@ function beforeGenerateFiles(args) {
1350
1358
  }
1351
1359
  }
1352
1360
  __name(beforeGenerateFiles, "beforeGenerateFiles");
1353
- function isAtomicOperation(name) {
1354
- return name.endsWith("FieldUpdateOperationsInput");
1361
+ function isAtomicOperation(typeName) {
1362
+ if (typeName.endsWith("FieldUpdateOperationsInput")) {
1363
+ return true;
1364
+ }
1365
+ return false;
1355
1366
  }
1356
1367
  __name(isAtomicOperation, "isAtomicOperation");
1357
1368
 
@@ -1920,6 +1931,13 @@ function getModelName(args) {
1920
1931
  return test;
1921
1932
  }
1922
1933
  }
1934
+ if (name.slice(-5) === "Input") {
1935
+ for (const model of modelNames) {
1936
+ if (isListInput(name, model)) {
1937
+ return model;
1938
+ }
1939
+ }
1940
+ }
1923
1941
  return void 0;
1924
1942
  }
1925
1943
  __name(getModelName, "getModelName");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-nestjs-graphql",
3
- "version": "15.3.1",
3
+ "version": "15.3.2",
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
- "@nestjs/apollo": "^10.0.9",
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.10",
72
+ "@nestjs/graphql": "^10.0.11",
73
73
  "@nestjs/platform-express": "^8.4.4",
74
- "@paljs/plugins": "^4.0.18",
75
- "@prisma/client": "^3.13.0",
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.174",
79
- "@swc/helpers": "^0.3.10",
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.21.0",
87
- "@typescript-eslint/parser": "^5.21.0",
88
- "apollo-server-express": "^3.6.7",
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.14.0",
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.2",
106
+ "expect": "^28.1.0",
107
107
  "ghooks": "^2.0.4",
108
108
  "git-branch-is": "^4.0.0",
109
- "graphql": "^16.4.0",
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.13.0",
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",