New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@paljs/nexus

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paljs/nexus - npm Package Compare versions

Comparing version 4.0.8 to 4.0.11

27

dist/nexus.cjs.development.js

@@ -14,2 +14,20 @@ 'use strict';

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _unsupportedIterableToArray(o, minLen) {

@@ -339,5 +357,6 @@ if (!o) return;

inputObjectTypes.forEach(function (input) {
if (input.fields.length > 0) {
var inputFields = typeof (settings === null || settings === void 0 ? void 0 : settings.filterInputs) === 'function' ? settings.filterInputs(input) : input.fields;
if (inputFields.length > 0) {
if (!allTypes.includes(input.name)) {
var inputFields = typeof (settings === null || settings === void 0 ? void 0 : settings.filterInputs) === 'function' ? settings.filterInputs(input) : input.fields;
nexusSchemaInputs.push(nexus.inputObjectType({

@@ -430,3 +449,5 @@ nonNullDefaults: {

try {
ctx.select = new plugins.PrismaSelect(info, settings === null || settings === void 0 ? void 0 : settings.prismaSelectOptions).value;
ctx.select = new plugins.PrismaSelect(info, _extends({
dmmf: settings === null || settings === void 0 ? void 0 : settings.dmmf
}, settings === null || settings === void 0 ? void 0 : settings.prismaSelectOptions)).value;
return Promise.resolve(next(root, args, ctx, info));

@@ -433,0 +454,0 @@ } catch (e) {

2

dist/nexus.cjs.production.min.js

@@ -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"),i=e(require("lowdb")),l=e(require("lowdb/adapters/FileSync")),o=require("fs"),a=require("path");function r(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function u(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return r(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var s={Json:t.scalarType({name:"Json",asNexusMethod:"json",description:"Json custom scalar type",serialize:function(e){return e}}),Decimal:t.scalarType({name:"Decimal",asNexusMethod:"decimal",description:"Decimal custom scalar type",serialize:function(e){return parseFloat(e)},parseValue:function(e){return parseFloat(e)}}),BigInt:t.scalarType({name:"BigInt",asNexusMethod:"bigint",description:"BigInt custom scalar type",serialize:function(e){return parseInt(e)},parseValue:function(e){return parseInt(e)}}),DateTime: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}})};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(r){var d=null==e?void 0:e.dmmf;d||(d=[require("@prisma/client").Prisma.dmmf]);for(var p,c,f=[t.objectType({name:"BatchPayload",definition:function(e){e.nonNull.int("count")}})].concat((p=null==e?void 0:e.excludeScalar,Object.keys(s).filter((function(e){return!p||!p.includes(e)})).map((function(e){return s[e]})))),m=[],y=function(){var i=c.value,l=i.schema;if(l){var o=[].concat(l.enumTypes.prisma);l.enumTypes.model&&o.push.apply(o,l.enumTypes.model),o.forEach((function(e){m.includes(e.name)||(f.push(t.enumType({name:e.name,members:e.values})),m.push(e.name))}));var a=[].concat(l.inputObjectTypes.prisma);l.inputObjectTypes.model&&a.push.apply(a,l.inputObjectTypes.model),a.forEach((function(l){if(l.fields.length>0&&!m.includes(l.name)){var o="function"==typeof(null==e?void 0:e.filterInputs)?e.filterInputs(l):l.fields;f.push(t.inputObjectType({nonNullDefaults:{input:!1},name:l.name,definition:function(t){o.filter((function(n){var t;return!(null==e||null===(t=e.excludeFields)||void 0===t?void 0:t.includes(n.name))})).forEach((function(l){var o=n.getInputType(l,e);if("inputObjectTypes"!==o.location||!n.hasEmptyTypeFields(o.type,{dmmf:i})){var a={type:o.type};l.isRequired?t.nonNull.field(l.name,a):o.isList?t.list.field(l.name,a):t.field(l.name,a)}}))}})),m.push(l.name)}})),l.outputObjectTypes.prisma.filter((function(e){return e.name.includes("Aggregate")||e.name.endsWith("CountOutputType")})).forEach((function(n){m.includes(n.name)||(f.push(t.objectType({nonNullDefaults:{output:!0},name:n.name,definition:function(t){n.fields.filter((function(n){var t;return!(null==e||null===(t=e.excludeFields)||void 0===t?void 0:t.includes(n.name))})).forEach((function(e){var n={type:e.outputType.type};e.isNullable?t.nullable.field(e.name,n):e.outputType.isList?t.list.field(e.name,n):t.field(e.name,n)}))}})),m.push(n.name))}))}},b=u(d);!(c=b()).done;)y();(null==e?void 0:e.includeAdmin)&&f.push.apply(f,function(e){if(void 0===e&&(e="adminSettings.json"),o.existsSync(a.join(process.cwd(),e))){var n=new l(e),r=i(n);return[t.extendType({type:"Query",definition:function(e){e.field("getSchema",{type:t.nonNull("Schema"),resolve:function(){try{return Promise.resolve(r.value())}catch(e){return Promise.reject(e)}}})}}),t.extendType({type:"Mutation",definition:function(e){e.field("updateField",{type:t.nonNull("Field"),args:{id:t.nonNull(t.stringArg()),modelId:t.nonNull(t.stringArg()),data:t.nonNull("UpdateFieldInput")},resolve:function(e,n){var t=n.id,i=n.modelId,l=n.data;try{return Promise.resolve(r.get("models").find({id:i}).get("fields").find({id:t}).assign(l).write())}catch(e){return Promise.reject(e)}}}),e.field("updateModel",{type:t.nonNull("Model"),args:{id:t.nonNull(t.stringArg()),data:t.nonNull("UpdateModelInput")},resolve:function(e,n){var t=n.id,i=n.data;try{return Promise.resolve(r.get("models").find({id:t}).assign(i).write())}catch(e){return Promise.reject(e)}}})}}),t.objectType({nonNullDefaults:{output:!0},name:"Enum",definition:function(e){e.string("name"),e.list.string("fields")}}),t.objectType({nonNullDefaults:{output:!0},name:"Schema",definition:function(e){e.list.field("models",{type:"Model"}),e.list.field("enums",{type:"Enum"})}}),t.objectType({nonNullDefaults:{output:!0},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({nonNullDefaults:{output:!0},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.nullable.boolean("relationField"),e.int("order"),e.field("kind",{type:"KindEnum"})}}),t.enumType({name:"KindEnum",members:["object","enum","scalar"]}),t.inputObjectType({nonNullDefaults:{input:!1},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({nonNullDefaults:{input:!1},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.nullable.boolean("relationField"),e.int("order"),e.field("kind",{type:"KindEnum"})}})]}return[]}(null==e?void 0:e.adminSchemaPath));for(var v,g=u(f);!(v=g()).done;)r.addType(v.value)},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"),i=e(require("lowdb")),l=e(require("lowdb/adapters/FileSync")),o=require("fs"),r=require("path");function a(){return(a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function s(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return u(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,void 0):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var d={Json:t.scalarType({name:"Json",asNexusMethod:"json",description:"Json custom scalar type",serialize:function(e){return e}}),Decimal:t.scalarType({name:"Decimal",asNexusMethod:"decimal",description:"Decimal custom scalar type",serialize:function(e){return parseFloat(e)},parseValue:function(e){return parseFloat(e)}}),BigInt:t.scalarType({name:"BigInt",asNexusMethod:"bigint",description:"BigInt custom scalar type",serialize:function(e){return parseInt(e)},parseValue:function(e){return parseInt(e)}}),DateTime: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}})};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(a){var u=null==e?void 0:e.dmmf;u||(u=[require("@prisma/client").Prisma.dmmf]);for(var p,c,f=[t.objectType({name:"BatchPayload",definition:function(e){e.nonNull.int("count")}})].concat((p=null==e?void 0:e.excludeScalar,Object.keys(d).filter((function(e){return!p||!p.includes(e)})).map((function(e){return d[e]})))),m=[],y=function(){var i=c.value,l=i.schema;if(l){var o=[].concat(l.enumTypes.prisma);l.enumTypes.model&&o.push.apply(o,l.enumTypes.model),o.forEach((function(e){m.includes(e.name)||(f.push(t.enumType({name:e.name,members:e.values})),m.push(e.name))}));var r=[].concat(l.inputObjectTypes.prisma);l.inputObjectTypes.model&&r.push.apply(r,l.inputObjectTypes.model),r.forEach((function(l){var o="function"==typeof(null==e?void 0:e.filterInputs)?e.filterInputs(l):l.fields;o.length>0&&(m.includes(l.name)||(f.push(t.inputObjectType({nonNullDefaults:{input:!1},name:l.name,definition:function(t){o.filter((function(n){var t;return!(null==e||null===(t=e.excludeFields)||void 0===t?void 0:t.includes(n.name))})).forEach((function(l){var o=n.getInputType(l,e);if("inputObjectTypes"!==o.location||!n.hasEmptyTypeFields(o.type,{dmmf:i})){var r={type:o.type};l.isRequired?t.nonNull.field(l.name,r):o.isList?t.list.field(l.name,r):t.field(l.name,r)}}))}})),m.push(l.name)))})),l.outputObjectTypes.prisma.filter((function(e){return e.name.includes("Aggregate")||e.name.endsWith("CountOutputType")})).forEach((function(n){m.includes(n.name)||(f.push(t.objectType({nonNullDefaults:{output:!0},name:n.name,definition:function(t){n.fields.filter((function(n){var t;return!(null==e||null===(t=e.excludeFields)||void 0===t?void 0:t.includes(n.name))})).forEach((function(e){var n={type:e.outputType.type};e.isNullable?t.nullable.field(e.name,n):e.outputType.isList?t.list.field(e.name,n):t.field(e.name,n)}))}})),m.push(n.name))}))}},b=s(u);!(c=b()).done;)y();(null==e?void 0:e.includeAdmin)&&f.push.apply(f,function(e){if(void 0===e&&(e="adminSettings.json"),o.existsSync(r.join(process.cwd(),e))){var n=new l(e),a=i(n);return[t.extendType({type:"Query",definition:function(e){e.field("getSchema",{type:t.nonNull("Schema"),resolve:function(){try{return Promise.resolve(a.value())}catch(e){return Promise.reject(e)}}})}}),t.extendType({type:"Mutation",definition:function(e){e.field("updateField",{type:t.nonNull("Field"),args:{id:t.nonNull(t.stringArg()),modelId:t.nonNull(t.stringArg()),data:t.nonNull("UpdateFieldInput")},resolve:function(e,n){var t=n.id,i=n.modelId,l=n.data;try{return Promise.resolve(a.get("models").find({id:i}).get("fields").find({id:t}).assign(l).write())}catch(e){return Promise.reject(e)}}}),e.field("updateModel",{type:t.nonNull("Model"),args:{id:t.nonNull(t.stringArg()),data:t.nonNull("UpdateModelInput")},resolve:function(e,n){var t=n.id,i=n.data;try{return Promise.resolve(a.get("models").find({id:t}).assign(i).write())}catch(e){return Promise.reject(e)}}})}}),t.objectType({nonNullDefaults:{output:!0},name:"Enum",definition:function(e){e.string("name"),e.list.string("fields")}}),t.objectType({nonNullDefaults:{output:!0},name:"Schema",definition:function(e){e.list.field("models",{type:"Model"}),e.list.field("enums",{type:"Enum"})}}),t.objectType({nonNullDefaults:{output:!0},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({nonNullDefaults:{output:!0},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.nullable.boolean("relationField"),e.int("order"),e.field("kind",{type:"KindEnum"})}}),t.enumType({name:"KindEnum",members:["object","enum","scalar"]}),t.inputObjectType({nonNullDefaults:{input:!1},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({nonNullDefaults:{input:!1},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.nullable.boolean("relationField"),e.int("order"),e.field("kind",{type:"KindEnum"})}})]}return[]}(null==e?void 0:e.adminSchemaPath));for(var v,g=s(f);!(v=g()).done;)a.addType(v.value)},onCreateFieldResolver:function(){return function(t,i,l,o,r){try{return l.select=new n.PrismaSelect(o,a({dmmf:null==e?void 0:e.dmmf},null==e?void 0:e.prismaSelectOptions)).value,Promise.resolve(r(t,i,l,o))}catch(e){return Promise.reject(e)}}}})};
//# sourceMappingURL=nexus.cjs.production.min.js.map

@@ -8,2 +8,20 @@ import { PrismaSelect, getInputType, hasEmptyTypeFields } from '@paljs/plugins';

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _unsupportedIterableToArray(o, minLen) {

@@ -333,5 +351,6 @@ if (!o) return;

inputObjectTypes.forEach(function (input) {
if (input.fields.length > 0) {
var inputFields = typeof (settings === null || settings === void 0 ? void 0 : settings.filterInputs) === 'function' ? settings.filterInputs(input) : input.fields;
if (inputFields.length > 0) {
if (!allTypes.includes(input.name)) {
var inputFields = typeof (settings === null || settings === void 0 ? void 0 : settings.filterInputs) === 'function' ? settings.filterInputs(input) : input.fields;
nexusSchemaInputs.push(inputObjectType({

@@ -424,3 +443,5 @@ nonNullDefaults: {

try {
ctx.select = new PrismaSelect(info, settings === null || settings === void 0 ? void 0 : settings.prismaSelectOptions).value;
ctx.select = new PrismaSelect(info, _extends({
dmmf: settings === null || settings === void 0 ? void 0 : settings.dmmf
}, settings === null || settings === void 0 ? void 0 : settings.prismaSelectOptions)).value;
return Promise.resolve(next(root, args, ctx, info));

@@ -427,0 +448,0 @@ } catch (e) {

{
"name": "@paljs/nexus",
"version": "4.0.8",
"version": "4.0.11",
"main": "dist/index.js",

@@ -40,3 +40,3 @@ "module": "dist/nexus.esm.js",

],
"gitHead": "26fa0e9bdaf7fbc3ea9693cc8ca6fda9d4b67fb4"
"gitHead": "292ea46437d9acd77bde670dbde7e0927a11eb74"
}

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

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