@paljs/nexus
Advanced tools
Comparing version 2.6.2 to 2.7.0
@@ -232,3 +232,3 @@ 'use strict'; | ||
input.fields.forEach(function (field) { | ||
var inputType = plugins.getInputType(field); | ||
var inputType = plugins.getInputType(field, settings); | ||
var hasEmptyType = inputType.kind === 'object' && plugins.hasEmptyTypeFields(inputType.type); | ||
@@ -235,0 +235,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@paljs/plugins"),t=require("@nexus/schema"),i=require("@prisma/client"),l=e(require("lowdb")),o=e(require("lowdb/adapters/FileSync")),a=require("fs"),r=require("path");exports.paljs=function(e){return t.plugin({name:"paljs",description:"paljs plugin to add Prisma select to your resolver and prisma admin queries and mutations and all models input types",onInstall:function(){var s,u=(null==e||null===(s=e.dmmf)||void 0===s?void 0:s.schema)||(null==i.dmmf?void 0:i.dmmf.schema),d=[t.objectType({name:"BatchPayload",definition:function(e){e.int("count",{nullable:!1})}}),t.scalarType({name:"Json",asNexusMethod:"json",description:"Json custom scalar type",serialize:function(e){return e}})];return d.push(t.scalarType({name:"DateTime",asNexusMethod:"date",description:"Date custom scalar type",parseValue:function(e){return e?new Date(e):null},serialize:function(e){return e?new Date(e):null},parseLiteral:function(e){return e.value?new Date(e.value):null}})),null==u||u.enums.forEach((function(e){d.push(t.enumType({name:e.name,members:e.values}))})),null==u||u.inputTypes.forEach((function(e){e.fields.length>0&&d.push(t.inputObjectType({name:e.name,definition:function(t){e.fields.forEach((function(e){var i=n.getInputType(e);if("object"!==i.kind||!n.hasEmptyTypeFields(i.type)){var l={type:i.type};e.isRequired&&(l.nullable=!1),i.isList&&(l.list=!0),t.field(e.name,l)}}))}}))})),null==u||u.outputTypes.filter((function(e){return e.name.includes("Aggregate")})).forEach((function(e){d.push(t.objectType({name:e.name,definition:function(n){e.fields.forEach((function(e){var t={type:e.outputType.type};e.isRequired&&(t.nullable=!1),e.outputType.isList&&(t.list=!0),n.field(e.name,t)}))}}))})),(null==e?void 0:e.includeAdmin)&&d.push.apply(d,function(e){if(void 0===e&&(e="adminSettings.json"),a.existsSync(r.join(process.cwd(),e))){var n=new o(e),i=l(n);return[t.queryField("getSchema",{type:"Schema",resolve:function(){try{return Promise.resolve(i.value())}catch(e){return Promise.reject(e)}}}),t.mutationField("updateModel",{type:"Model",args:{id:t.stringArg({nullable:!1}),data:"UpdateModelInput"},resolve:function(e,n){var t=n.id,l=n.data;try{return Promise.resolve(i.get("models").find({id:t}).assign(l).write())}catch(e){return Promise.reject(e)}}}),t.mutationField("updateField",{type:"Field",args:{id:t.stringArg({nullable:!1}),modelId:t.stringArg({nullable:!1}),data:"UpdateFieldInput"},resolve:function(e,n){var t=n.id,l=n.modelId,o=n.data;try{return Promise.resolve(i.get("models").find({id:l}).get("fields").find({id:t}).assign(o).write())}catch(e){return Promise.reject(e)}}}),t.objectType({name:"Enum",definition:function(e){e.string("name"),e.list.string("fields")}}),t.objectType({name:"Schema",definition:function(e){e.list.field("models",{type:"Model"}),e.list.field("enums",{type:"Enum"})}}),t.objectType({name:"Model",definition:function(e){e.string("id"),e.string("name"),e.string("idField"),e.list.string("displayFields"),e.boolean("create"),e.boolean("update"),e.boolean("delete"),e.list.field("fields",{type:"Field"})}}),t.objectType({name:"Field",definition:function(e){e.string("id"),e.string("name"),e.string("title"),e.string("type"),e.boolean("list"),e.boolean("required"),e.boolean("isId"),e.boolean("unique"),e.boolean("create"),e.boolean("update"),e.boolean("read"),e.boolean("filter"),e.boolean("sort"),e.boolean("editor"),e.boolean("upload"),e.boolean("relationField",{nullable:!0}),e.int("order"),e.field("kind",{type:"KindEnum"})}}),t.enumType({name:"KindEnum",members:["object","enum","scalar"]}),t.inputObjectType({name:"UpdateModelInput",definition:function(e){e.string("name"),e.string("idField"),e.list.string("displayFields"),e.boolean("create"),e.boolean("update"),e.boolean("delete"),e.list.field("fields",{type:"UpdateFieldInput"})}}),t.inputObjectType({name:"UpdateFieldInput",definition:function(e){e.string("id"),e.string("name"),e.string("title"),e.string("type"),e.boolean("list"),e.boolean("required"),e.boolean("isId"),e.boolean("unique"),e.boolean("create"),e.boolean("update"),e.boolean("read"),e.boolean("filter"),e.boolean("sort"),e.boolean("editor"),e.boolean("upload"),e.boolean("relationField",{nullable:!0}),e.int("order"),e.field("kind",{type:"KindEnum"})}})]}return[]}(null==e?void 0:e.adminSchemaPath)),{types:d}},onCreateFieldResolver:function(){return function(t,i,l,o,a){try{return l.select=new n.PrismaSelect(o,null==e?void 0:e.prismaSelectOptions).value,Promise.resolve(a(t,i,l,o))}catch(e){return Promise.reject(e)}}}})}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@paljs/plugins"),t=require("@nexus/schema"),i=require("@prisma/client"),l=e(require("lowdb")),o=e(require("lowdb/adapters/FileSync")),a=require("fs"),r=require("path");exports.paljs=function(e){return t.plugin({name:"paljs",description:"paljs plugin to add Prisma select to your resolver and prisma admin queries and mutations and all models input types",onInstall:function(){var s,u=(null==e||null===(s=e.dmmf)||void 0===s?void 0:s.schema)||(null==i.dmmf?void 0:i.dmmf.schema),d=[t.objectType({name:"BatchPayload",definition:function(e){e.int("count",{nullable:!1})}}),t.scalarType({name:"Json",asNexusMethod:"json",description:"Json custom scalar type",serialize:function(e){return e}})];return d.push(t.scalarType({name:"DateTime",asNexusMethod:"date",description:"Date custom scalar type",parseValue:function(e){return e?new Date(e):null},serialize:function(e){return e?new Date(e):null},parseLiteral:function(e){return e.value?new Date(e.value):null}})),null==u||u.enums.forEach((function(e){d.push(t.enumType({name:e.name,members:e.values}))})),null==u||u.inputTypes.forEach((function(i){i.fields.length>0&&d.push(t.inputObjectType({name:i.name,definition:function(t){i.fields.forEach((function(i){var l=n.getInputType(i,e);if("object"!==l.kind||!n.hasEmptyTypeFields(l.type)){var o={type:l.type};i.isRequired&&(o.nullable=!1),l.isList&&(o.list=!0),t.field(i.name,o)}}))}}))})),null==u||u.outputTypes.filter((function(e){return e.name.includes("Aggregate")})).forEach((function(e){d.push(t.objectType({name:e.name,definition:function(n){e.fields.forEach((function(e){var t={type:e.outputType.type};e.isRequired&&(t.nullable=!1),e.outputType.isList&&(t.list=!0),n.field(e.name,t)}))}}))})),(null==e?void 0:e.includeAdmin)&&d.push.apply(d,function(e){if(void 0===e&&(e="adminSettings.json"),a.existsSync(r.join(process.cwd(),e))){var n=new o(e),i=l(n);return[t.queryField("getSchema",{type:"Schema",resolve:function(){try{return Promise.resolve(i.value())}catch(e){return Promise.reject(e)}}}),t.mutationField("updateModel",{type:"Model",args:{id:t.stringArg({nullable:!1}),data:"UpdateModelInput"},resolve:function(e,n){var t=n.id,l=n.data;try{return Promise.resolve(i.get("models").find({id:t}).assign(l).write())}catch(e){return Promise.reject(e)}}}),t.mutationField("updateField",{type:"Field",args:{id:t.stringArg({nullable:!1}),modelId:t.stringArg({nullable:!1}),data:"UpdateFieldInput"},resolve:function(e,n){var t=n.id,l=n.modelId,o=n.data;try{return Promise.resolve(i.get("models").find({id:l}).get("fields").find({id:t}).assign(o).write())}catch(e){return Promise.reject(e)}}}),t.objectType({name:"Enum",definition:function(e){e.string("name"),e.list.string("fields")}}),t.objectType({name:"Schema",definition:function(e){e.list.field("models",{type:"Model"}),e.list.field("enums",{type:"Enum"})}}),t.objectType({name:"Model",definition:function(e){e.string("id"),e.string("name"),e.string("idField"),e.list.string("displayFields"),e.boolean("create"),e.boolean("update"),e.boolean("delete"),e.list.field("fields",{type:"Field"})}}),t.objectType({name:"Field",definition:function(e){e.string("id"),e.string("name"),e.string("title"),e.string("type"),e.boolean("list"),e.boolean("required"),e.boolean("isId"),e.boolean("unique"),e.boolean("create"),e.boolean("update"),e.boolean("read"),e.boolean("filter"),e.boolean("sort"),e.boolean("editor"),e.boolean("upload"),e.boolean("relationField",{nullable:!0}),e.int("order"),e.field("kind",{type:"KindEnum"})}}),t.enumType({name:"KindEnum",members:["object","enum","scalar"]}),t.inputObjectType({name:"UpdateModelInput",definition:function(e){e.string("name"),e.string("idField"),e.list.string("displayFields"),e.boolean("create"),e.boolean("update"),e.boolean("delete"),e.list.field("fields",{type:"UpdateFieldInput"})}}),t.inputObjectType({name:"UpdateFieldInput",definition:function(e){e.string("id"),e.string("name"),e.string("title"),e.string("type"),e.boolean("list"),e.boolean("required"),e.boolean("isId"),e.boolean("unique"),e.boolean("create"),e.boolean("update"),e.boolean("read"),e.boolean("filter"),e.boolean("sort"),e.boolean("editor"),e.boolean("upload"),e.boolean("relationField",{nullable:!0}),e.int("order"),e.field("kind",{type:"KindEnum"})}})]}return[]}(null==e?void 0:e.adminSchemaPath)),{types:d}},onCreateFieldResolver:function(){return function(t,i,l,o,a){try{return l.select=new n.PrismaSelect(o,null==e?void 0:e.prismaSelectOptions).value,Promise.resolve(a(t,i,l,o))}catch(e){return Promise.reject(e)}}}})}; | ||
//# sourceMappingURL=nexus.cjs.production.min.js.map |
@@ -226,3 +226,3 @@ import { getInputType, hasEmptyTypeFields, PrismaSelect } from '@paljs/plugins'; | ||
input.fields.forEach(function (field) { | ||
var inputType = getInputType(field); | ||
var inputType = getInputType(field, settings); | ||
var hasEmptyType = inputType.kind === 'object' && hasEmptyTypeFields(inputType.type); | ||
@@ -229,0 +229,0 @@ |
@@ -14,2 +14,3 @@ import { DMMF } from '@prisma/client/runtime'; | ||
dmmf?: DMMF.Document; | ||
doNotUseFieldUpdateOperationsInput?: boolean; | ||
} |
{ | ||
"name": "@paljs/nexus", | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"main": "dist/index.js", | ||
@@ -24,3 +24,3 @@ "module": "dist/nexus.esm.js", | ||
"dependencies": { | ||
"@paljs/plugins": "^2.6.2", | ||
"@paljs/plugins": "^2.7.0", | ||
"fs-extra": "^9.0.1", | ||
@@ -41,3 +41,3 @@ "lowdb": "^1.0.0" | ||
], | ||
"gitHead": "c319a8d612ef8024bad081ed6f51d66e118f81a7" | ||
"gitHead": "4a0d689f6122d542a5725088cbff5b7b9781b642" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
73417
590
Updated@paljs/plugins@^2.7.0