Awey
10/30/2020, 6:11 PMargs: {
data: {
text: stringArg({ required: true }),
},
},
Oliver Evans
10/30/2020, 7:45 PMschema.prisma
from nexus to programmatically expose my types.
Specifically, if I have the following in `schema.prisma`:
model Person {
name String
age Int
}
I would like to construct the following javascript object:
{
name: "String",
age: "Int"
}
Thanks!Awey
10/30/2020, 9:23 PMnullable: false
and required: false
??? I have two required fields in my schema one of type string the other boolean. But when updating, I want to something like this.
If I only set nullable: false
then when I go to call my update mutation it asks me to pass in the other fields to update. What if I only want to update one field? And if I set required: false
my types become messed up and I'm told I can't update data where the value could possibly be null
Dave
10/31/2020, 11:01 AMgenerator client {
provider = "prisma-client-js"
output = "../db/prisma1"
previewFeatures = ["microsoftSqlServer"]
}
), I then try to run makeSchema like below:
const schema = makeSchema({
types: {
...types,
Query,
Mutation,
},
plugins: [nexusPrisma({})],
outputs: {
schema: __dirname + '/../schema.graphql',
typegen: __dirname + '/generated/nexus.ts'
},
typegenAutoConfig: {
contextType: 'ContextModule.Context',
sources: [
{
source: require.resolve(__dirname + '/../db/prisma1/index.d.ts'),
alias: 'prisma1'
},
{
source: require.resolve(__dirname + '/../db/prisma2/index.d.ts'),
alias: 'prisma2'
},
{
source: require.resolve(__dirname + '/../db/prisma3/index.d.ts'),
alias: 'prisma3'
},
{
source: require.resolve('./context'),
alias: 'ContextModule'
}
]
}
})
However it doesn't seem to be able to resolve any of the prisma clients and I get the following error Error: You most likely forgot to initialize the Prisma Client.
Oliver Evans
11/01/2020, 6:02 PMSwapnull
11/03/2020, 1:29 PMnexus-plugin-shield
with @nexus/schema
? I can only find nexus framework examples with use
.Swapnull
11/03/2020, 5:15 PMt.list.json
with the nexus framework but it doesn't seem to exist now I have switch to @nexus/schema
. Does anybody know what an alternative of this would be?Jonathan
11/03/2020, 7:10 PMnexus/schema
(_shouldGenerateArtifacts_: _true_,
), but I cant be too certain if it is related.
Anyone ever dealt with debugging startup times?Shreyas Sreenivas
11/04/2020, 5:17 AMinterfaceType
? I get Type Error: t.connectionField is not a function
when trying to do soAhmar Suhail
11/04/2020, 2:17 PMSwapnull
11/04/2020, 2:34 PMusers(first: 5) { uuid }
which just has t.crud.users()
can take 3 - 7 seconds.
We are using vercel serverless to deploy an Apollo Server.
What have people done to improve performance as this could end up a huge barrier.Matheus Assis
11/05/2020, 2:38 PMprisma plugin
, why is the "array" queries allow for more filtering instead of only filtering by the indexes, where as the "single" queries do not.
Is there something I can do, a setting, on either nexus schema, plugin prisma or prisma itself to allow that?
Look at how the people query allow for more filtering, where the person does notBen Chen
11/05/2020, 10:38 PMnexus-plugin-prisma
and trying to use IntFilter
and StringFilter
without crud
.Ben Chen
11/05/2020, 10:39 PMprisma generate
it says it can’t find IntFilter
and StringFilter
. This historically has worked when we used crud
. How can I leverage prisma client’s filtering methods?Dan Borstelmann
11/06/2020, 1:35 AMexport const User = objectType({
name: 'User',
definition(t) {
t.model.id();
t.model.email();
t.model.handle();
},
});
export const Follow = objectType({
name: 'Follow',
definition(t) {
t.model.id();
t.model.createdAt();
t.model.follower(); // This is a user
t.model.following(); // This is a user
},
});
export const FollowQuery = extendType({
type: 'Query',
definition(t) {
t.list.field('followers', {
type: 'Follows',
resolve: async (_parent, args, context) => {
const authedId = getUserId(context);
let followers;
try {
followers = await context.prisma.follow.findMany({
where: { following: { id: authedId } },
select: {
id: true,
follower: {
// THIS SELECT IS IGNORED. <-------------
// User model is populated with all fields (including say the email we don't want to expose)
select: {
handle: true
},
},
},
});
} catch {
throw new Error();
}
return followers;
},
});
},
});
query followers {
followers {
id
follower {
handle
# if I ask for email here it will return the email even though it wasn't selected
}
}
}
Darryl
11/06/2020, 9:28 AM@prisma/client
and @prisma/cli
but I’m getting the following warning related to nexus-plugin-prisma
. Should I just abandon the update for now or can somebody tell me what the possible undefined behaviours and bugs could be?
Warning: nexus-plugin-prisma@0.23.1 does not support @prisma/client@2.10.2. The supported range is: `2.10.0`. This could lead to undefined behaviors and bugs.
I noticed that nexus-plugin-prisma
has @prisma/client
as a dependency pinned to the specific 2.1.0
version and since its last release there’ve been two Prisma patches. It also has had PRs bumping this to 2.10.1
and now 2.10.2
but they’ve haven’t been merged.leonardodino
11/08/2020, 6:05 PMnexus
framework to @nexus/schema
. 🙌
I’m working with Relay on the frontend, and I wonder if global identification is still something that we consider implementing at the schema level.
nexus is aware of the types, and already has the t.id
, but it’s only a identity function. I think it could wrap into global id, and unwrap them in the resolvers so we can pass it directly to tools like prisma (or other tools/systems/etc 😄)Adam
11/09/2020, 4:03 AMmakeSchema
when using typescript? All the types aren't generated until you run it, meaning the build will always output errors unless you've built it previouslyPaul Hendrickson
11/09/2020, 6:42 PMtsc
inside my Docker container I get
Cannot find name ‘NexusPrisma’
Any ideas?Peter
11/10/2020, 3:29 PMextendType({
type: 'Query',
definition(t) {
t.list.field('bts', {
type: 'Bts',
args: {
minLat: floatArg({
default: 0,
required: true,
}),
maxLat: floatArg({
default: 0,
required: true,
}),
minLong: floatArg({
default: 0,
required: true,
}),
maxLong: floatArg({
default: 0,
required: true,
}),
},
resolve(_root, { minLat, maxLat, minLong, maxLong }, ctx) {
return ctx.prisma.bts.findMany({
where: {
latitude: {
gte: minLat,
lte: maxLat,
},
longitude: {
gte: minLong,
lte: maxLong,
},
},
})
},
})
But when I delete required I get error
Type 'number | null | undefined' is not assignable to type 'number | undefined'.
Type 'null' is not assignable to type 'number | undefined'
So what is the best way to handle that optional args?Paul Hendrickson
11/11/2020, 4:47 PMconst customer = objectType({
name: “customer”,
definition(t) {
t.model.addressLine1
t.model.addressLine2
t.field(“address”, {
type: “string”,
resolve: (root) => root.addressLine1 + root.addressLine2
}
}
});
and I don’t want the graphql to have “addressLine1” and “addressLine2” because it’s unnecessary.Dan Borstelmann
11/13/2020, 9:41 AMLennard Westerveld
11/16/2020, 6:45 PMobjectType({
name: 'TestQuery',
definition(t) {
t.field('hello', {type: 'String'});
t.field('hello2', {type: 'String'});
},
}),
extendType({
type: 'Query',
definition(t) {
t.field('test', {
type: 'TestQuery',
resolve: () => ({
hello: () => ... function that returns promise<String>,
hello2: () => ... function that returns promise<String>,
}),
});
},
}),
Gives the following Message
Error:(73, 13) TS2322: Type '() => Promise<string>' is not assignable to type 'string'.
Lennard Westerveld
11/16/2020, 8:08 PMjasonkuhrt
andreas
11/18/2020, 12:48 PMPaul Hendrickson
11/24/2020, 2:23 PMAdam
11/24/2020, 3:19 PMnexus-plugin-prisma@0.24.0
and running makeSchema
is now giving me the error
nexus-plugin-prisma/src/dmmf/transformer.ts:55
inputTypes: schema.inputTypes.map((type) => transformInputType(type, globallyComputedInputs, atomicOperations)),
^
TypeError: Cannot read property 'map' of undefined
at transformSchema (node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:55:35)
at transform (node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:30:13)
at Object.exports.getTransformedDmmf (node_modules/nexus-plugin-prisma/src/dmmf/transformer.ts:17:37)
at new SchemaBuilder (node_modules/nexus-plugin-prisma/src/builder.ts:267:7)
at Object.build (node_modules/nexus-plugin-prisma/src/builder.ts:185:19)
at Object.onInstall (node_modules/nexus-plugin-prisma/src/plugin.ts:46:62)
at node_modules/@nexus/schema/src/builder.ts:663:44
at Array.forEach (<anonymous>)
at SchemaBuilder.beforeWalkTypes (node_modules/@nexus/schema/src/builder.ts:657:18)
at SchemaBuilder.getFinalTypeMap (node_modules/@nexus/schema/src/builder.ts:798:10)
huv1k
11/25/2020, 10:26 AMnexus-plugin-prisma
🙂Mikastark
11/25/2020, 3:54 PM@nexus/schema@0.19
is out and a new "list" "nullable "nonNull" API, which way is prefered ?
1. t.nonNull.list.nonNull.field(...)
2. t.field({ type: nonNull(list(nonNull(...))) ... })
I ask this question to prevent new eventual futur breaking changes