prisma-nestjs-graphql
Advanced tools
Comparing version 12.2.1 to 13.0.0
239
index.js
@@ -364,19 +364,5 @@ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty; | ||
function getGraphqlImport(args) { | ||
const { | ||
fileType, | ||
location, | ||
typeName, | ||
isId, | ||
customType: customType2, | ||
sourceFile, | ||
getSourceFile | ||
} = args; | ||
if (customType2 && customType2.graphqlType) { | ||
return { | ||
name: customType2.graphqlType, | ||
specifier: customType2.graphqlModule | ||
}; | ||
} | ||
const { fileType, location, typeName, isId, noTypeId, sourceFile, getSourceFile } = args; | ||
if (location === "scalar") { | ||
if (isId) { | ||
if (isId && !noTypeId) { | ||
return { name: "ID", specifier: "@nestjs/graphql" }; | ||
@@ -511,3 +497,3 @@ } | ||
function inputType(args) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c; | ||
const { | ||
@@ -563,7 +549,6 @@ inputType: inputType2, | ||
const typeName = String(type); | ||
const customType2 = config.types[typeName]; | ||
const settings = modelFieldSettings == null ? void 0 : modelFieldSettings.get(name); | ||
const propertySettings = settings == null ? void 0 : settings.getPropertyType(); | ||
const isCustomsApplicable = typeName === ((_a = model == null ? void 0 : model.fields.find((f) => f.name === name)) == null ? void 0 : _a.type); | ||
const propertyType = _lodash.castArray.call(void 0, (propertySettings == null ? void 0 : propertySettings.name) || ((_b = customType2 == null ? void 0 : customType2.fieldType) == null ? void 0 : _b.split("|").map((element) => _lodash.trim.call(void 0, element))) || getPropertyType({ | ||
const propertyType = _lodash.castArray.call(void 0, (propertySettings == null ? void 0 : propertySettings.name) || getPropertyType({ | ||
location, | ||
@@ -578,3 +563,3 @@ type: typeName | ||
}); | ||
(_c = classStructure.properties) == null ? void 0 : _c.push(property); | ||
(_b = classStructure.properties) == null ? void 0 : _b.push(property); | ||
if (propertySettings) { | ||
@@ -593,3 +578,2 @@ importDeclarations.create(__spreadValues({}, propertySettings)); | ||
typeName, | ||
customType: customType2, | ||
getSourceFile | ||
@@ -607,3 +591,3 @@ }); | ||
importDeclarations.add("HideField", "@nestjs/graphql"); | ||
(_d = property.decorators) == null ? void 0 : _d.push({ name: "HideField", arguments: [] }); | ||
(_c = property.decorators) == null ? void 0 : _c.push({ name: "HideField", arguments: [] }); | ||
} else { | ||
@@ -801,3 +785,3 @@ property.decorators.push({ | ||
function modelOutputType(outputType2, args) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
const { getSourceFile, models, config, modelFields, fieldSettings, eventEmitter } = args; | ||
@@ -811,28 +795,17 @@ const model = models.get(outputType2.name); | ||
const sourceFileStructure = sourceFile.getStructure(); | ||
const imports = _lodash.remove.call(void 0, sourceFileStructure.statements, (s) => s.kind === _tsmorph.StructureKind.ImportDeclaration).flatMap((s) => { | ||
return s.namedImports.map((x) => [ | ||
x.name || x.alias, | ||
const exportDeclaration = getExportDeclaration(model.name, sourceFileStructure.statements); | ||
const importDeclarations = new ImportDeclarationMap(); | ||
const classStructure = { | ||
kind: _tsmorph.StructureKind.Class, | ||
isExported: true, | ||
name: outputType2.name, | ||
decorators: [ | ||
{ | ||
moduleSpecifier: s.moduleSpecifier, | ||
namedImports: [{ name: x.name, alias: x.alias }] | ||
name: "ObjectType", | ||
arguments: [] | ||
} | ||
]); | ||
}); | ||
const importDeclarations = new ImportDeclarationMap(imports); | ||
let classStructure = sourceFileStructure.statements.find((s) => s.kind === _tsmorph.StructureKind.Class); | ||
if (!classStructure) { | ||
classStructure = { | ||
kind: _tsmorph.StructureKind.Class, | ||
isExported: true, | ||
name: outputType2.name, | ||
decorators: [ | ||
{ | ||
name: "ObjectType", | ||
arguments: [] | ||
} | ||
], | ||
properties: [] | ||
}; | ||
sourceFileStructure.statements.push(classStructure); | ||
} | ||
], | ||
properties: [] | ||
}; | ||
sourceFileStructure.statements.push(classStructure); | ||
const decorator = (_a = classStructure.decorators) == null ? void 0 : _a.find((d) => d.name === "ObjectType"); | ||
@@ -854,5 +827,2 @@ _assert.ok.call(void 0, decorator, "ObjectType decorator not found"); | ||
for (const field of outputType2.fields) { | ||
if ((_c = classStructure.properties) == null ? void 0 : _c.some((p) => p.name === field.name)) { | ||
continue; | ||
} | ||
let fileType = "model"; | ||
@@ -865,8 +835,7 @@ const { location, isList, type, namespace } = field.outputType; | ||
} | ||
const customType2 = config.types[outputTypeName]; | ||
const modelField = (_d = modelFields.get(model.name)) == null ? void 0 : _d.get(field.name); | ||
const settings = (_e = fieldSettings.get(model.name)) == null ? void 0 : _e.get(field.name); | ||
const modelField = (_c = modelFields.get(model.name)) == null ? void 0 : _c.get(field.name); | ||
const settings = (_d = fieldSettings.get(model.name)) == null ? void 0 : _d.get(field.name); | ||
const fieldType = settings == null ? void 0 : settings.getFieldType(); | ||
const propertySettings = settings == null ? void 0 : settings.getPropertyType(); | ||
const propertyType = _lodash.castArray.call(void 0, (propertySettings == null ? void 0 : propertySettings.name) || ((_f = customType2 == null ? void 0 : customType2.fieldType) == null ? void 0 : _f.split("|").map(_lodash.trim)) || getPropertyType({ | ||
const propertyType = _lodash.castArray.call(void 0, (propertySettings == null ? void 0 : propertySettings.name) || getPropertyType({ | ||
location, | ||
@@ -889,4 +858,4 @@ type: outputTypeName | ||
isId: modelField == null ? void 0 : modelField.isId, | ||
noTypeId: config.noTypeId, | ||
typeName: outputTypeName, | ||
customType: customType2, | ||
getSourceFile | ||
@@ -911,14 +880,11 @@ }); | ||
} | ||
(_g = classStructure.properties) == null ? void 0 : _g.push(property); | ||
(_e = classStructure.properties) == null ? void 0 : _e.push(property); | ||
if (propertySettings) { | ||
importDeclarations.create(__spreadValues({}, propertySettings)); | ||
} | ||
if (customType2 && customType2.fieldType && customType2.fieldModule) { | ||
importDeclarations.add(customType2.fieldType, customType2.fieldModule); | ||
} | ||
if (settings == null ? void 0 : settings.shouldHideField({ name: outputType2.name, output: true })) { | ||
importDeclarations.add("HideField", nestjsGraphql); | ||
(_h = property.decorators) == null ? void 0 : _h.push({ name: "HideField", arguments: [] }); | ||
(_f = property.decorators) == null ? void 0 : _f.push({ name: "HideField", arguments: [] }); | ||
} else { | ||
(_i = property.decorators) == null ? void 0 : _i.push({ | ||
(_g = property.decorators) == null ? void 0 : _g.push({ | ||
name: "Field", | ||
@@ -938,3 +904,3 @@ arguments: [ | ||
} | ||
(_j = property.decorators) == null ? void 0 : _j.push({ | ||
(_h = property.decorators) == null ? void 0 : _h.push({ | ||
name: options.name, | ||
@@ -949,11 +915,6 @@ arguments: options.arguments | ||
} | ||
const hasExportDeclaration = sourceFileStructure.statements.some((structure) => { | ||
return structure.kind === _tsmorph.StructureKind.ExportDeclaration && structure.namedExports.some((o) => (o.alias || o.name) === model.name); | ||
}); | ||
if (hasExportDeclaration) { | ||
let commentStatement; | ||
while (commentStatement = sourceFile.getStatementByKind(2)) { | ||
commentStatement.remove(); | ||
} | ||
sourceFile.addStatements([classStructure]); | ||
if (exportDeclaration) { | ||
sourceFile.set({ | ||
statements: [exportDeclaration, "\n", classStructure] | ||
}); | ||
const classDeclaration = sourceFile.getClassOrThrow(model.name); | ||
@@ -964,6 +925,12 @@ const commentedText = classDeclaration.getText().split("\n").map((x) => `// ${x}`); | ||
} else { | ||
sourceFileStructure.statements.unshift(...importDeclarations.toStatements()); | ||
sourceFile.set(sourceFileStructure); | ||
sourceFile.set({ | ||
statements: [...importDeclarations.toStatements(), classStructure] | ||
}); | ||
} | ||
} | ||
function getExportDeclaration(name, statements) { | ||
return statements.find((structure) => { | ||
return structure.kind === _tsmorph.StructureKind.ExportDeclaration && structure.namedExports.some((o) => (o.alias || o.name) === name); | ||
}); | ||
} | ||
@@ -1007,3 +974,3 @@ // src/handlers/no-atomic-operations.ts | ||
function outputType(outputType2, args) { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
var _a, _b, _c, _d, _e, _f; | ||
const { getSourceFile, models, config, eventEmitter, fieldSettings, getModelName: getModelName2 } = args; | ||
@@ -1044,5 +1011,4 @@ const importDeclarations = new ImportDeclarationMap(); | ||
const isCustomsApplicable = outputTypeName === ((_b = model == null ? void 0 : model.fields.find((f) => f.name === field.name)) == null ? void 0 : _b.type); | ||
const customType2 = config.types[outputTypeName]; | ||
field.outputType.type = outputTypeName; | ||
const propertyType = _lodash.castArray.call(void 0, (propertySettings == null ? void 0 : propertySettings.name) || ((_c = customType2 == null ? void 0 : customType2.fieldType) == null ? void 0 : _c.split("|").map(_lodash.trim)) || getPropertyType({ | ||
const propertyType = _lodash.castArray.call(void 0, (propertySettings == null ? void 0 : propertySettings.name) || getPropertyType({ | ||
location, | ||
@@ -1057,3 +1023,3 @@ type: outputTypeName | ||
}); | ||
(_d = classStructure.properties) == null ? void 0 : _d.push(property); | ||
(_c = classStructure.properties) == null ? void 0 : _c.push(property); | ||
if (propertySettings) { | ||
@@ -1068,3 +1034,2 @@ importDeclarations.create(__spreadValues({}, propertySettings)); | ||
typeName: outputTypeName, | ||
customType: customType2, | ||
getSourceFile | ||
@@ -1076,10 +1041,7 @@ }); | ||
} | ||
if (customType2 && customType2.fieldModule && customType2.fieldType) { | ||
importDeclarations.add(customType2.fieldType, customType2.fieldModule); | ||
} | ||
if (settings == null ? void 0 : settings.shouldHideField({ name: outputType2.name, output: true })) { | ||
importDeclarations.add("HideField", nestjsGraphql2); | ||
(_e = property.decorators) == null ? void 0 : _e.push({ name: "HideField", arguments: [] }); | ||
(_d = property.decorators) == null ? void 0 : _d.push({ name: "HideField", arguments: [] }); | ||
} else { | ||
(_f = property.decorators) == null ? void 0 : _f.push({ | ||
(_e = property.decorators) == null ? void 0 : _e.push({ | ||
name: "Field", | ||
@@ -1098,3 +1060,3 @@ arguments: [ | ||
} | ||
(_g = property.decorators) == null ? void 0 : _g.push({ | ||
(_f = property.decorators) == null ? void 0 : _f.push({ | ||
name: options.name, | ||
@@ -1162,3 +1124,3 @@ arguments: options.arguments | ||
return sourceFile.getBaseName() !== "index.ts"; | ||
}).map((sourcesFile) => getExportDeclaration(directory, sourcesFile)); | ||
}).map((sourcesFile) => getExportDeclaration2(directory, sourcesFile)); | ||
directory.createSourceFile("index.ts", { | ||
@@ -1174,3 +1136,3 @@ statements: exportDeclarations | ||
return sourceFile.getBaseName() !== "index.ts"; | ||
}).map((sourceFile) => getExportDeclaration(rootDirectory, sourceFile)); | ||
}).map((sourceFile) => getExportDeclaration2(rootDirectory, sourceFile)); | ||
rootDirectory.createSourceFile("index.ts", { | ||
@@ -1186,3 +1148,3 @@ statements: exportDeclarations | ||
const sourceFile = directory.getSourceFileOrThrow("index.ts"); | ||
exportDeclarations.push(getExportDeclaration(rootDirectory, sourceFile)); | ||
exportDeclarations.push(getExportDeclaration2(rootDirectory, sourceFile)); | ||
} | ||
@@ -1196,3 +1158,3 @@ rootDirectory.createSourceFile("index.ts", { | ||
} | ||
function getExportDeclaration(directory, sourceFile) { | ||
function getExportDeclaration2(directory, sourceFile) { | ||
return { | ||
@@ -1207,49 +1169,2 @@ kind: _tsmorph.StructureKind.ExportDeclaration, | ||
// src/helpers/generate-import.ts | ||
function generateImport(args) { | ||
const { moduleSpecifier, name, sourceFile } = args; | ||
if (!moduleSpecifier) { | ||
return name; | ||
} | ||
let importDeclaration = sourceFile.getImportDeclaration((importDeclaration2) => importDeclaration2.getModuleSpecifier().getLiteralValue() === moduleSpecifier); | ||
if (!importDeclaration) { | ||
importDeclaration = sourceFile.addImportDeclaration({ | ||
moduleSpecifier | ||
}); | ||
} | ||
let importSpecifier = importDeclaration.getNamedImports().find((importSpecifier2) => importSpecifier2.getName() === name); | ||
if (!importSpecifier) { | ||
importSpecifier = importDeclaration.addNamedImport({ | ||
name | ||
}); | ||
} | ||
return importSpecifier.getName(); | ||
} | ||
// src/helpers/update-object-property.ts | ||
function updateObjectProperty(args) { | ||
const { expression, name, value } = args; | ||
let propertyAssignment = expression.getProperty(name); | ||
if (value === void 0) { | ||
if (propertyAssignment) { | ||
propertyAssignment.remove(); | ||
} | ||
return; | ||
} | ||
if (!propertyAssignment) { | ||
propertyAssignment = expression.addProperty({ | ||
name, | ||
kind: _tsmorph.StructureKind.PropertyAssignment, | ||
initializer: "undefined" | ||
}); | ||
} | ||
propertyAssignment.setInitializer(JSON.stringify(value)); | ||
} | ||
// src/handlers/register-enum.ts | ||
function registerEnum(enumType, args) { | ||
@@ -1262,30 +1177,23 @@ const { getSourceFile, enums } = args; | ||
}); | ||
generateImport({ | ||
sourceFile, | ||
name: "registerEnumType", | ||
const importDeclarations = new ImportDeclarationMap(); | ||
importDeclarations.set("registerEnumType", { | ||
namedImports: [{ name: "registerEnumType" }], | ||
moduleSpecifier: "@nestjs/graphql" | ||
}); | ||
if (!sourceFile.getEnum(enumType.name)) { | ||
sourceFile.addEnum({ | ||
isExported: true, | ||
name: enumType.name, | ||
members: enumType.values.map((v) => ({ | ||
name: v, | ||
initializer: JSON.stringify(v) | ||
})) | ||
}); | ||
} | ||
let statement = sourceFile.getStatement((s) => _tsmorph.Node.isExpressionStatement(s) && _tsmorph.Node.isCallExpression(s.getExpression()) && s.getExpression().getFirstChild((node) => _tsmorph.Node.isIdentifier(node) && node.getText() === "registerEnumType") != void 0); | ||
if (!statement) { | ||
[statement] = sourceFile.addStatements([ | ||
const enumStructure = { | ||
kind: _tsmorph.StructureKind.Enum, | ||
isExported: true, | ||
name: enumType.name, | ||
members: enumType.values.map((v) => ({ | ||
name: v, | ||
initializer: JSON.stringify(v) | ||
})) | ||
}; | ||
sourceFile.set({ | ||
statements: [ | ||
...importDeclarations.toStatements(), | ||
enumStructure, | ||
"\n", | ||
`registerEnumType(${enumType.name}, { name: '${enumType.name}', description: undefined })` | ||
]); | ||
} | ||
_assert.ok.call(void 0, statement, "Failed to add registerEnumType statement"); | ||
const objectLiteralExpression = statement.getExpression().getArguments().find((x) => _tsmorph.Node.isObjectLiteralExpression(x)); | ||
updateObjectProperty({ | ||
expression: objectLiteralExpression, | ||
name: "description", | ||
value: dataModelEnum == null ? void 0 : dataModelEnum.documentation | ||
`registerEnumType(${enumType.name}, { name: '${enumType.name}', description: ${JSON.stringify(dataModelEnum == null ? void 0 : dataModelEnum.documentation)} })` | ||
] | ||
}); | ||
@@ -1326,3 +1234,2 @@ } | ||
} | ||
const types = _lodash.merge.call(void 0, {}, config.types); | ||
const fields = Object.fromEntries(Object.entries((_a = config.fields) != null ? _a : {}).filter(({ 1: value }) => typeof value === "object").map(([name, value]) => { | ||
@@ -1339,5 +1246,2 @@ const fieldSetting = { | ||
})); | ||
if (Object.keys(types).length > 0) { | ||
$warnings.push("Configuration throu `types_*` is deprecated, use @FieldType/@PropertyType https://github.com/unlight/prisma-nestjs-graphql#field-settings"); | ||
} | ||
return { | ||
@@ -1348,3 +1252,2 @@ outputFilePattern, | ||
noAtomicOperations: toBoolean(config.noAtomicOperations), | ||
types, | ||
reExport: ReExport[String(config.reExport)] || ReExport.None, | ||
@@ -1356,3 +1259,4 @@ emitSingle: toBoolean(config.emitSingle), | ||
purgeOutput: toBoolean(config.purgeOutput), | ||
useInputType: createUseInputType(config.useInputType) | ||
useInputType: createUseInputType(config.useInputType), | ||
noTypeId: toBoolean(config.noTypeId) | ||
}; | ||
@@ -1427,4 +1331,3 @@ } | ||
filePath = `${output}/${filePath}`; | ||
const sourceFile = project.getSourceFile(filePath) || project.createSourceFile(filePath); | ||
return sourceFile; | ||
return project.getSourceFile(filePath) || project.createSourceFile(filePath); | ||
}; | ||
@@ -1431,0 +1334,0 @@ } |
{ | ||
"name": "prisma-nestjs-graphql", | ||
"version": "12.2.1", | ||
"version": "13.0.0", | ||
"license": "MIT", | ||
@@ -50,3 +50,3 @@ "description": "Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module", | ||
"dependencies": { | ||
"@prisma/generator-helper": "^2.27.0", | ||
"@prisma/generator-helper": "^2.30.0", | ||
"await-event-emitter": "^2.0.2", | ||
@@ -62,3 +62,3 @@ "filenamify": "4.X", | ||
"pupa": "2.X", | ||
"ts-morph": "^11.0.3" | ||
"ts-morph": ">=11 <=12" | ||
}, | ||
@@ -70,10 +70,10 @@ "peerDependencies": { | ||
"@arkweid/lefthook": "0.7.6", | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@nestjs/common": "^7.6.18", | ||
"@nestjs/core": "^7.6.18", | ||
"@nestjs/graphql": "^7.11.0", | ||
"@nestjs/platform-express": "^7.6.18", | ||
"@paljs/plugins": "^3.6.1", | ||
"@prisma/client": "^2.27.0", | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@nestjs/common": "^8.0.6", | ||
"@nestjs/core": "^8.0.6", | ||
"@nestjs/graphql": "^9.0.2", | ||
"@nestjs/platform-express": "^8.0.6", | ||
"@paljs/plugins": "^3.8.2", | ||
"@prisma/client": "^2.30.0", | ||
"@semantic-release/changelog": "^5.0.1", | ||
@@ -83,10 +83,10 @@ "@semantic-release/git": "^9.0.0", | ||
"@types/flat": "^5.0.2", | ||
"@types/lodash": "^4.14.171", | ||
"@types/lodash": "^4.14.172", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.4.1", | ||
"@types/node": "^16.7.4", | ||
"@types/pluralize": "^0.0.29", | ||
"@typescript-eslint/eslint-plugin": "^4.28.4", | ||
"@typescript-eslint/parser": "^4.28.4", | ||
"apollo-server-express": "^2.25.2", | ||
"c8": "^7.7.3", | ||
"@typescript-eslint/eslint-plugin": "^4.29.3", | ||
"@typescript-eslint/parser": "^4.29.3", | ||
"apollo-server-express": "^3.3.0", | ||
"c8": "^7.8.0", | ||
"class-transformer": "^0.4.0", | ||
@@ -97,17 +97,17 @@ "class-validator": "^0.13.1", | ||
"decimal.js": "^10.3.1", | ||
"eslint": "^7.31.0", | ||
"eslint-import-resolver-node": "^0.3.4", | ||
"eslint": "^7.32.0", | ||
"eslint-import-resolver-node": "^0.3.6", | ||
"eslint-plugin-etc": "^1.5.4", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-only-warn": "^1.0.2", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-only-warn": "^1.0.3", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-regexp": "^0.13.2", | ||
"eslint-plugin-regexp": "^1.0.0", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"eslint-plugin-sonarjs": "^0.9.1", | ||
"eslint-plugin-sonarjs": "^0.10.0", | ||
"eslint-plugin-sort-class-members": "^1.11.0", | ||
"eslint-plugin-total-functions": "^4.9.0", | ||
"eslint-plugin-unicorn": "^34.0.1", | ||
"eslint-plugin-unicorn": "^35.0.0", | ||
"eslint-plugin-wix-editor": "^3.3.0", | ||
"expect": "^27.0.6", | ||
"expect": "^27.1.0", | ||
"find-cache-dir": "^3.3.1", | ||
@@ -118,18 +118,18 @@ "git-branch-is": "^4.0.0", | ||
"graphql-type-json": "^0.3.2", | ||
"mocha": "^9.0.2", | ||
"mocha": "^9.1.0", | ||
"ololog": "^1.1.175", | ||
"precise-commits": "^1.0.2", | ||
"prettier": "^2.3.2", | ||
"prisma": "^2.27.0", | ||
"prisma": "^2.30.0", | ||
"prisma-graphql-type-decimal": "^1.0.0", | ||
"reflect-metadata": "^0.1.13", | ||
"rxjs": "^6.6.7", | ||
"semantic-release": "^17.4.4", | ||
"rxjs": "^7.3.0", | ||
"semantic-release": "^17.4.7", | ||
"simplytyped": "^3.3.0", | ||
"ts-node": "^10.1.0", | ||
"ts-node": "^10.2.1", | ||
"ts-node-dev": "^1.1.8", | ||
"tslib": "^2.3.0", | ||
"typescript": "^4.3.5", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.4.2", | ||
"watchexec-bin": "^1.0.0" | ||
} | ||
} |
@@ -123,2 +123,8 @@ # prisma-nestjs-graphql | ||
#### `noTypeId` | ||
Disable usage of graphql `ID` type and use `Int/Float` for fields marked as `@id` in schema. | ||
Type: `boolean` | ||
Default: `false` | ||
#### `useInputType` | ||
@@ -183,50 +189,2 @@ | ||
#### `types_*` (deprecated) | ||
<details> | ||
Map prisma scalar types in [flatten](https://github.com/hughsk/flat) style | ||
- `types_{type}_fieldType` TypeScript field type name | ||
- `types_{type}_fieldModule` Module to import | ||
- `types_{type}_graphqlType` GraphQL type name | ||
- `types_{type}_graphqlModule` Module to import | ||
Where `{type}` is prisma type in schema | ||
Example (Decimal): | ||
```prisma | ||
types_Decimal_fieldType = "Decimal" | ||
types_Decimal_fieldModule = "decimal.js" | ||
types_Decimal_graphqlType = "GraphQLDecimal" | ||
types_Decimal_graphqlModule = "graphql-type-decimal" | ||
``` | ||
Generates field: | ||
```ts | ||
import { GraphQLDecimal } from 'graphql-type-decimal'; | ||
import { Decimal } from 'decimal.js'; | ||
... | ||
@Field(() => GraphQLDecimal) | ||
field: Decimal; | ||
``` | ||
Example (DateTime): | ||
```prisma | ||
types_DateTime_fieldType = "Date" | ||
types_DateTime_graphqlType = "GraphQLISODateTime" | ||
types_DateTime_graphqlModule = "@nestjs/graphql" | ||
``` | ||
Generated fields: | ||
```ts | ||
@Field(() => GraphQLISODateTime) | ||
field: Date; | ||
``` | ||
</details> | ||
## Field Settings | ||
@@ -233,0 +191,0 @@ |
67494
1479
453
+ Added@ts-morph/common@0.11.1(transitive)
+ Addedts-morph@12.2.0(transitive)
- Removed@ts-morph/common@0.10.1(transitive)
- Removedts-morph@11.0.3(transitive)
Updatedts-morph@>=11 <=12