You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I noticed that while you can use both withAuth and authScopes on the same field, it does not actually combine declarations despite what type declarations lead to think
builder.mutationField('updateUserPropery',(t)=>t.withAuth({user: true}).boolean({authScopes(_,args,context){// Here `context` will be typed according to `AuthContexts`// but `{ user: true }` will be overwritten by this function},resolve(){// ...}}))
Instead, I'd like both { user: true } and authScopes(){} to be merged
The text was updated successfully, but these errors were encountered:
It's probably a little more complex, i think my example works if the new scopes are an object, but not if it's a function. Handling the function case should be pretty easy though by wrapping it to return the merged scopes
GauBen
changed the title
withAuth and authScopes don't dombinewithAuth and authScopes don't combine
Apr 19, 2024
Hey, I noticed that while you can use both
withAuth
andauthScopes
on the same field, it does not actually combine declarations despite what type declarations lead to thinkhttps://github.com/hayes/pothos/blob/3cebfed6f033ee92c2b3492a3fd6d3002906ab08/packages/plugin-scope-auth/src/field-builders.ts#L58C7-L58C26
Example:
Instead, I'd like both
{ user: true }
andauthScopes(){}
to be mergedThe text was updated successfully, but these errors were encountered: