prisma-nestjs-graphql
Advanced tools
Comparing version 7.1.0 to 7.2.0
43
index.js
@@ -127,3 +127,6 @@ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __assign = Object.assign; | ||
"ScalarField", | ||
"GroupBy" | ||
"GroupBy", | ||
"UncheckedUpdate", | ||
"UncheckedCreate", | ||
"ScalarWhere" | ||
].sort((a, b) => b.length - a.length); | ||
@@ -376,5 +379,5 @@ var endsWithKeywords = [ | ||
} | ||
classDeclaration.getProperties().filter((p) => Boolean(p.getDecorator("Field"))).forEach((p) => { | ||
for (const p of classDeclaration.getProperties().filter((p2) => Boolean(p2.getDecorator("Field")))) { | ||
p.remove(); | ||
}); | ||
} | ||
const properties = (_b = decorator.properties) == null ? void 0 : _b.filter((p) => p.value !== void 0); | ||
@@ -546,3 +549,3 @@ if (properties && properties.length > 0) { | ||
for (const field of inputType.fields) { | ||
field.inputTypes.filter((x) => ["object", "enum"].includes(fieldLocationToKind(x.location)) && x.type !== className).forEach((inputType3) => { | ||
for (const inputType3 of field.inputTypes.filter((x) => ["object", "enum"].includes(fieldLocationToKind(x.location)) && x.type !== className)) { | ||
const kind = fieldLocationToKind(inputType3.location); | ||
@@ -555,3 +558,3 @@ generateProjectImport({ | ||
}); | ||
}); | ||
} | ||
const propertyTypes = field.inputTypes.map((t) => { | ||
@@ -617,6 +620,6 @@ return toPropertyType(__assign(__assign({}, t), { | ||
} | ||
names.forEach((name) => { | ||
for (const name of names) { | ||
const aggregateInput = aggregateInputs.find((t) => t.name === `${feature}${name}AggregateInput`); | ||
if (!aggregateInput) { | ||
return; | ||
continue; | ||
} | ||
@@ -635,3 +638,3 @@ inputType.fields.push({ | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -701,3 +704,3 @@ generateInput({ | ||
}); | ||
model.fields.filter((field) => !classDeclaration.getProperty(field.name)).forEach((field) => { | ||
for (const field of model.fields.filter((field2) => !classDeclaration.getProperty(field2.name))) { | ||
generateProperty({ | ||
@@ -712,3 +715,3 @@ field, | ||
}); | ||
}); | ||
} | ||
checkExport({name: model.name, classDeclaration, sourceFile}); | ||
@@ -720,3 +723,3 @@ sourceFile.organizeImports({ensureNewLineAtEndOfFile: true}); | ||
function replacementTypeName(name) { | ||
const pattern = /^(Nested|Nullable)?(String|Int|Float|DateTime|Boolean|Decimal|Json|BigInt|Bytes|Enum\w+?)(Nullable)?(Filter|Input)$/; | ||
const pattern = /^(Nested|Nullable)?(String|Int|Float|DateTime|Boolean|Decimal|Json|BigInt|Bytes|Enum\w+?)(Nullable)?(Filter|WithAggregatesFilter|Input)$/; | ||
const match = pattern.exec(name); | ||
@@ -731,2 +734,6 @@ if (match) { | ||
return "BooleanFilter"; | ||
case "NestedBoolNullableWithAggregatesFilter": | ||
case "BoolNullableWithAggregatesFilter": | ||
case "NestedBoolWithAggregatesFilter": | ||
return "BooleanWithAggregatesFilter"; | ||
} | ||
@@ -742,5 +749,5 @@ return name; | ||
} | ||
inputType.fields.forEach((field) => { | ||
for (const field of inputType.fields) { | ||
field.inputTypes = field.inputTypes.filter((input) => input.type !== "Null"); | ||
field.inputTypes.forEach((input) => { | ||
for (const input of field.inputTypes) { | ||
const name = String(input.type); | ||
@@ -751,4 +758,4 @@ const newTypeName2 = replacements[name]; | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
return inputType; | ||
@@ -912,5 +919,5 @@ }; | ||
const name = getOutputTypeName(outputType.name); | ||
outputType.fields.forEach((field) => { | ||
for (const field of outputType.fields) { | ||
field.outputType.type = getOutputTypeName(String(field.outputType.type)); | ||
}); | ||
} | ||
const sourceFile = await createSourceFile({type: "output", name}); | ||
@@ -922,3 +929,3 @@ const model = { | ||
name: t.name, | ||
isRequired: t.isRequired | ||
isRequired: !t.isNullable | ||
}, t.outputType), { | ||
@@ -925,0 +932,0 @@ type: String(t.outputType.type), |
{ | ||
"name": "prisma-nestjs-graphql", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"license": "MIT", | ||
@@ -57,3 +57,3 @@ "description": "Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module", | ||
"dependencies": { | ||
"@prisma/generator-helper": "^2.14.0", | ||
"@prisma/generator-helper": "^2.15.0", | ||
"flat": "^5.0.2", | ||
@@ -75,7 +75,7 @@ "get-relative-path": "^1.0.2", | ||
"@nestjs/core": "^7.6.5", | ||
"@nestjs/graphql": "^7.9.4", | ||
"@nestjs/graphql": "^7.9.8", | ||
"@nestjs/platform-express": "^7.6.5", | ||
"@paljs/plugins": "^2.11.0", | ||
"@prisma/cli": "^2.14.0", | ||
"@prisma/client": ">=2.13", | ||
"@paljs/plugins": "^2.11.1", | ||
"@prisma/cli": "^2.15.0", | ||
"@prisma/client": ">=2.15", | ||
"@semantic-release/changelog": "^5.0.1", | ||
@@ -85,18 +85,18 @@ "@semantic-release/git": "^9.0.0", | ||
"@types/flat": "^5.0.1", | ||
"@types/lodash": "^4.14.167", | ||
"@types/lodash": "^4.14.168", | ||
"@types/mocha": "^8.2.0", | ||
"@types/node": "^14.14.20", | ||
"@types/node": "^14.14.22", | ||
"@types/pluralize": "^0.0.29", | ||
"@typescript-eslint/eslint-plugin": "^4.12.0", | ||
"@typescript-eslint/parser": "^4.12.0", | ||
"apollo-server-express": "^2.19.1", | ||
"@typescript-eslint/eslint-plugin": "^4.14.0", | ||
"@typescript-eslint/parser": "^4.14.0", | ||
"apollo-server-express": "^2.19.2", | ||
"c8": "^7.4.0", | ||
"class-transformer": "^0.3.1", | ||
"class-validator": "^0.12.2", | ||
"commitizen": "^4.2.2", | ||
"class-transformer": "^0.3.2", | ||
"class-validator": "^0.13.1", | ||
"commitizen": "^4.2.3", | ||
"cz-customizable": "^6.3.0", | ||
"decimal.js": "^10.2.1", | ||
"eslint": "^7.17.0", | ||
"eslint": "^7.18.0", | ||
"eslint-import-resolver-node": "^0.3.4", | ||
"eslint-plugin-etc": "^1.1.7", | ||
"eslint-plugin-etc": "^1.1.8", | ||
"eslint-plugin-import": "^2.22.1", | ||
@@ -111,3 +111,3 @@ "eslint-plugin-only-warn": "^1.0.2", | ||
"eslint-plugin-total-functions": "^4.7.2", | ||
"eslint-plugin-unicorn": "^25.0.1", | ||
"eslint-plugin-unicorn": "^27.0.0", | ||
"eslint-plugin-wix-editor": "^3.2.0", | ||
@@ -119,3 +119,3 @@ "expect": "^26.6.2", | ||
"graphql-type-json": "^0.3.2", | ||
"husky": "^4.3.7", | ||
"husky": "^4.3.8", | ||
"mocha": "^8.2.1", | ||
@@ -126,3 +126,3 @@ "precise-commits": "^1.0.2", | ||
"rxjs": "^6.6.3", | ||
"semantic-release": "^17.3.1", | ||
"semantic-release": "^17.3.7", | ||
"simplytyped": "^3.3.0", | ||
@@ -129,0 +129,0 @@ "ts-node": "^9.1.1", |
40272
974