Socket
Socket
Sign inDemoInstall

nexus-prisma-generate

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nexus-prisma-generate - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

18

dist/index.js

@@ -55,6 +55,6 @@ #!/usr/bin/env node

var nexusPrismaTypesPath = path_1.join(rootPath, output, 'nexus-prisma.ts');
var nexusPrismaTypes = renderNexusPrismaTypes(schema, config_1.getImportPathRelativeToOutput(resolvedPrismaClientDir, nexusPrismaTypesPath), renderedDatamodel, jsMode);
var nexusPrismaTypes = renderNexusPrismaTypes(schema, config_1.getImportPathRelativeToOutput(resolvedPrismaClientDir, nexusPrismaTypesPath));
fs_1.writeFileSync(nexusPrismaTypesPath, nexusPrismaTypes);
if (jsMode) {
var datamodelPath = path_1.join(rootPath, output, 'nexus-prisma-schema.js');
var datamodelPath = path_1.join(rootPath, output, 'meta-schema.js');
var indexPath = path_1.join(rootPath, output, 'index.js');

@@ -65,4 +65,6 @@ fs_1.writeFileSync(datamodelPath, "module.exports = " + renderedDatamodel);

else {
var datamodelPath = path_1.join(rootPath, output, 'meta-schema.ts');
var indexPath = path_1.join(rootPath, output, 'index.ts');
fs_1.writeFileSync(indexPath, "export { default } from './nexus-prisma'");
fs_1.writeFileSync(datamodelPath, "export default " + renderedDatamodel);
fs_1.writeFileSync(indexPath, "export { default } from './meta-schema'");
}

@@ -76,3 +78,3 @@ console.log("Types generated at " + output);

function renderIndexJs() {
return "const nexusPrismaSchema = require('./nexus-prisma-schema')\n \nmodule.exports = nexusPrismaSchema\n ";
return "const metaSchema = require('./meta-schema')\n \nmodule.exports = metaSchema\n ";
}

@@ -89,3 +91,3 @@ function renderDatamodel(datamodel, schema) {

}
function renderNexusPrismaTypes(schema, prismaClientPath, renderedDatamodel, jsMode) {
function renderNexusPrismaTypes(schema, prismaClientPath) {
var types = Object.values(schema.getTypeMap());

@@ -95,3 +97,3 @@ var objectTypes = types.filter(function (t) { return graphql_1.isObjectType(t) && !t.name.startsWith('__'); });

var enumTypes = types.filter(function (t) { return graphql_1.isEnumType(t) && !t.name.startsWith('__'); });
return "// GENERATED TYPES FOR NEXUS-PRISMA. /!\\ DO NOT EDIT MANUALLY\n\nimport { core } from 'nexus'\nimport { GraphQLResolveInfo } from 'graphql'\nimport * as prisma from '" + prismaClientPath + "'\n\ndeclare global {\n interface NexusPrismaGen extends NexusPrismaTypes {}\n}\n\n" + objectTypes.map(renderObjectType).join(os_1.EOL) + "\n\n" + inputTypes.map(renderInputType).join(os_1.EOL) + "\n\n" + enumTypes.map(renderEnumType).join(os_1.EOL) + "\n\nexport interface NexusPrismaTypes {\n objectTypes: {\n fields: {\n" + objectTypes
return "// GENERATED TYPES FOR NEXUS-PRISMA. /!\\ DO NOT EDIT MANUALLY\n\nimport { core } from 'nexus'\nimport { GraphQLResolveInfo } from 'graphql'\nimport * as prisma from '" + prismaClientPath + "'\n\ndeclare global {\n interface NexusPrismaGen extends NexusPrismaTypes {}\n}\n\nexport interface NexusPrismaTypes {\n objectTypes: {\n fields: {\n" + objectTypes
.map(function (type) { return " " + type.name + ": " + getObjectTypeFieldsName(type); })

@@ -106,3 +108,3 @@ .join(os_1.EOL) + "\n }\n fieldsDetails: {\n" + objectTypes

.map(function (type) { return " " + type.name + ": " + getEnumTypeName(type) + ","; })
.join(os_1.EOL) + "\n }\n}\n" + (jsMode ? '' : "export default " + renderedDatamodel) + "\n ";
.join(os_1.EOL) + "\n }\n}\n\n" + objectTypes.map(renderObjectType).join(os_1.EOL) + "\n\n" + inputTypes.map(renderInputType).join(os_1.EOL) + "\n\n" + enumTypes.map(renderEnumType).join(os_1.EOL) + "\n ";
}

@@ -115,3 +117,3 @@ function renderObjectType(type) {

return "export interface " + getObjectTypeFieldsDetailsName(type) + " {\n" + fields
.map(function (field) { return " " + field.name + ": {\n type: '" + graphql_2.getTypeName(type) + "'\n args: " + (field.args.length > 0
.map(function (field) { return " " + field.name + ": {\n type: '" + graphql_2.getTypeName(field.type) + "'\n args: " + (field.args.length > 0
? "Record<" + getTypeFieldArgName(type, field) + ", core.NexusArgDef<string>>"

@@ -118,0 +120,0 @@ : '{}') + "\n description: string\n list: " + (graphql_2.isList(field.type) ? true : undefined) + "\n nullable: " + !graphql_2.isRequired(field.type) + "\n resolve: " + (graphql_1.isScalarType(graphql_2.getFinalType(field.type))

{
"name": "nexus-prisma-generate",
"version": "0.1.5",
"version": "0.2.0",
"typings": "dist/index.d.ts",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc