@paljs/nexus
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -236,3 +236,3 @@ 'use strict'; | ||
if (!(settings === null || settings === void 0 ? void 0 : settings.excludeAdmin)) { | ||
if (settings === null || settings === void 0 ? void 0 : settings.includeAdmin) { | ||
nexusSchemaInputs.push.apply(nexusSchemaInputs, adminNexusSchemaSettings(settings === null || settings === void 0 ? void 0 : settings.adminSchemaPath)); | ||
@@ -239,0 +239,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")),a=e(require("lowdb/adapters/FileSync")),o=i.dmmf.schema;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 n=[t.objectType({name:"BatchPayload",definition:function(e){e.int("count",{nullable:!1})}})];return(null==e?void 0:e.isNexus)||n.push(t.scalarType({name:"DateTime",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}})),o.enums.forEach((function(e){n.push(t.enumType({name:e.name,members:e.values}))})),o.inputTypes.forEach((function(e){n.push(t.inputObjectType({name:e.name,definition:function(n){e.fields.forEach((function(e){var t,i={type:(t=e.inputType.length>1&&"null"!==e.inputType[1].type&&"not"!==e.name?e.inputType[1]:e.inputType[0]).type};t.isRequired&&(i.nullable=!1),t.isList&&(i.list=!0),n.field(e.name,i)}))}}))})),(null==e?void 0:e.excludeAdmin)||n.push.apply(n,function(e){void 0===e&&(e="prisma/adminSettings.json");var n=new a(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,a=n.data;try{return Promise.resolve(i.get("models").find({id:l}).get("fields").find({id:t}).assign(a).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("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("relationField",{nullable:!0}),e.int("order"),e.field("kind",{type:"KindEnum"})}})]}(null==e?void 0:e.adminSchemaPath)),{types:n}},onCreateFieldResolver:function(){return function(e,t,i,l,a){try{return i.select=new n.PrismaSelect(l).value,Promise.resolve(a(e,t,i,l))}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")),a=e(require("lowdb/adapters/FileSync")),o=i.dmmf.schema;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 n=[t.objectType({name:"BatchPayload",definition:function(e){e.int("count",{nullable:!1})}})];return(null==e?void 0:e.isNexus)||n.push(t.scalarType({name:"DateTime",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}})),o.enums.forEach((function(e){n.push(t.enumType({name:e.name,members:e.values}))})),o.inputTypes.forEach((function(e){n.push(t.inputObjectType({name:e.name,definition:function(n){e.fields.forEach((function(e){var t,i={type:(t=e.inputType.length>1&&"null"!==e.inputType[1].type&&"not"!==e.name?e.inputType[1]:e.inputType[0]).type};t.isRequired&&(i.nullable=!1),t.isList&&(i.list=!0),n.field(e.name,i)}))}}))})),(null==e?void 0:e.includeAdmin)&&n.push.apply(n,function(e){void 0===e&&(e="prisma/adminSettings.json");var n=new a(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,a=n.data;try{return Promise.resolve(i.get("models").find({id:l}).get("fields").find({id:t}).assign(a).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("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("relationField",{nullable:!0}),e.int("order"),e.field("kind",{type:"KindEnum"})}})]}(null==e?void 0:e.adminSchemaPath)),{types:n}},onCreateFieldResolver:function(){return function(e,t,i,l,a){try{return i.select=new n.PrismaSelect(l).value,Promise.resolve(a(e,t,i,l))}catch(e){return Promise.reject(e)}}}})}; | ||
//# sourceMappingURL=nexus.cjs.production.min.js.map |
@@ -230,3 +230,3 @@ import { PrismaSelect } from '@paljs/plugins'; | ||
if (!(settings === null || settings === void 0 ? void 0 : settings.excludeAdmin)) { | ||
if (settings === null || settings === void 0 ? void 0 : settings.includeAdmin) { | ||
nexusSchemaInputs.push.apply(nexusSchemaInputs, adminNexusSchemaSettings(settings === null || settings === void 0 ? void 0 : settings.adminSchemaPath)); | ||
@@ -233,0 +233,0 @@ } |
export interface Settings { | ||
adminSchemaPath?: string; | ||
excludeAdmin?: boolean; | ||
includeAdmin?: boolean; | ||
isNexus?: boolean; | ||
} |
{ | ||
"name": "@paljs/nexus", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "dist/index.js", | ||
@@ -24,3 +24,3 @@ "module": "dist/nexus.esm.js", | ||
"dependencies": { | ||
"@paljs/plugins": "^0.0.3", | ||
"@paljs/plugins": "^0.0.4", | ||
"lowdb": "^1.0.0" | ||
@@ -40,3 +40,3 @@ }, | ||
], | ||
"gitHead": "aebc44f8a0c401a940d91f4ff609321099637fb1" | ||
"gitHead": "0803fd0cab12f7a68391d6d9b09d1d423b03e23a" | ||
} |
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
61151
+ Added@paljs/plugins@0.0.4(transitive)
+ Added@paljs/types@0.0.4(transitive)
- Removed@paljs/plugins@0.0.3(transitive)
- Removed@paljs/types@0.0.3(transitive)
Updated@paljs/plugins@^0.0.4