2019-11-08 05:39:33 +08:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`fieldAuthorizePlugin always throws an error, even when formatError is wrong 1`] = `
Array [
"Non-Error value undefined returned from custom formatError in authorize plugin",
]
`;
exports[`fieldAuthorizePlugin field-level authorize fails returning a Promise for an error 1`] = `
Array [
"Guarded error Not authorized",
]
`;
exports[`fieldAuthorizePlugin field-level authorize fails returning a Promise for false 1`] = `
Array [
"Guarded error Not authorized",
]
`;
exports[`fieldAuthorizePlugin field-level authorize fails returning an error 1`] = `
Array [
"Guarded error You shall not pass.",
]
`;
exports[`fieldAuthorizePlugin field-level authorize fails returning false 1`] = `
Array [
"Guarded error Not authorized",
]
`;
exports[`fieldAuthorizePlugin field-level authorize fails throwing an error 1`] = `
Array [
"Guarded error You shall not pass.",
]
`;
exports[`fieldAuthorizePlugin field-level authorize fails with any other value 1`] = `
Array [
"Guarded error Nexus authorize for Query.userInvalidValue Expected a boolean or Error, saw 1",
]
`;
exports[`fieldAuthorizePlugin printing the authorize schema: Full Type Output 1`] = `
"/**
2020-04-07 23:19:59 +08:00
* This file was generated by Nexus Schema
2019-11-08 05:39:33 +08:00
* Do not make changes to this file directly
*/
2021-03-28 04:26:13 +08:00
import type { FieldAuthorizeResolver } from \\"nexus/dist/plugins/fieldAuthorizePlugin\\"
2019-11-08 05:39:33 +08:00
declare global {
interface NexusGen extends NexusGenTypes {}
}
export interface NexusGenInputs {
}
export interface NexusGenEnums {
}
2020-08-04 21:50:09 +08:00
export interface NexusGenScalars {
String: string
Int: number
Float: number
Boolean: boolean
ID: string
}
2020-11-18 02:17:22 +08:00
export interface NexusGenObjects {
2019-11-08 05:39:33 +08:00
Query: {};
}
2020-11-18 02:17:22 +08:00
export interface NexusGenInterfaces {
2019-11-08 05:39:33 +08:00
}
2020-11-18 02:17:22 +08:00
export interface NexusGenUnions {
}
export type NexusGenRootTypes = NexusGenObjects
export type NexusGenAllTypes = NexusGenRootTypes & NexusGenScalars
2019-11-08 05:39:33 +08:00
export interface NexusGenFieldTypes {
Query: { // field return type
2020-09-30 21:53:48 +08:00
ok: boolean | null; // Boolean
2019-11-08 05:39:33 +08:00
}
}
2020-10-26 21:24:20 +08:00
export interface NexusGenFieldTypeNames {
Query: { // field return type name
ok: 'Boolean'
}
}
2019-11-08 05:39:33 +08:00
export interface NexusGenArgTypes {
}
2020-11-14 03:19:15 +08:00
export interface NexusGenAbstractTypeMembers {
2019-11-08 05:39:33 +08:00
}
2020-11-19 10:58:14 +08:00
export interface NexusGenTypeInterfaces {
}
2019-11-08 05:39:33 +08:00
2020-11-18 02:17:22 +08:00
export type NexusGenObjectNames = keyof NexusGenObjects;
2019-11-08 05:39:33 +08:00
export type NexusGenInputNames = never;
export type NexusGenEnumNames = never;
export type NexusGenInterfaceNames = never;
2020-11-18 02:17:22 +08:00
export type NexusGenScalarNames = keyof NexusGenScalars;
2019-11-08 05:39:33 +08:00
export type NexusGenUnionNames = never;
2022-05-16 04:59:05 +08:00
export type NexusGenDirectives = never
export interface NexusGenDirectiveArgs {
}
2020-11-14 03:19:15 +08:00
export type NexusGenObjectsUsingAbstractStrategyIsTypeOf = never;
export type NexusGenAbstractsUsingStrategyResolveType = never;
export type NexusGenFeaturesConfig = {
abstractTypeStrategies: {
2020-11-25 00:40:38 +08:00
isTypeOf: false
resolveType: true
2020-11-14 03:19:15 +08:00
__typename: false
}
}
2019-11-08 05:39:33 +08:00
export interface NexusGenTypes {
context: any;
inputTypes: NexusGenInputs;
2022-05-16 04:59:05 +08:00
directives: NexusGenDirectives;
directiveArgs: NexusGenDirectiveArgs;
2019-11-08 05:39:33 +08:00
rootTypes: NexusGenRootTypes;
2020-12-07 07:52:04 +08:00
inputTypeShapes: NexusGenInputs & NexusGenEnums & NexusGenScalars;
2019-11-08 05:39:33 +08:00
argTypes: NexusGenArgTypes;
fieldTypes: NexusGenFieldTypes;
2020-10-26 21:24:20 +08:00
fieldTypeNames: NexusGenFieldTypeNames;
2019-11-08 05:39:33 +08:00
allTypes: NexusGenAllTypes;
2020-11-19 10:58:14 +08:00
typeInterfaces: NexusGenTypeInterfaces;
2019-11-08 05:39:33 +08:00
objectNames: NexusGenObjectNames;
inputNames: NexusGenInputNames;
enumNames: NexusGenEnumNames;
interfaceNames: NexusGenInterfaceNames;
scalarNames: NexusGenScalarNames;
unionNames: NexusGenUnionNames;
allInputTypes: NexusGenTypes['inputNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['scalarNames'];
allOutputTypes: NexusGenTypes['objectNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['unionNames'] | NexusGenTypes['interfaceNames'] | NexusGenTypes['scalarNames'];
allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes']
abstractTypes: NexusGenTypes['interfaceNames'] | NexusGenTypes['unionNames'];
2020-11-14 03:19:15 +08:00
abstractTypeMembers: NexusGenAbstractTypeMembers;
objectsUsingAbstractStrategyIsTypeOf: NexusGenObjectsUsingAbstractStrategyIsTypeOf;
abstractsUsingStrategyResolveType: NexusGenAbstractsUsingStrategyResolveType;
features: NexusGenFeaturesConfig;
2019-11-08 05:39:33 +08:00
}
declare global {
interface NexusGenPluginTypeConfig<TypeName extends string> {
}
2021-02-01 01:32:37 +08:00
interface NexusGenPluginInputTypeConfig<TypeName extends string> {
}
2019-11-08 05:39:33 +08:00
interface NexusGenPluginFieldConfig<TypeName extends string, FieldName extends string> {
/**
* Authorization for an individual field. Returning \\"true\\"
* or \\"Promise<true>\\" means the field can be accessed.
* Returning \\"false\\" or \\"Promise<false>\\" will respond
* with a \\"Not Authorized\\" error for the field.
* Returning or throwing an error will also prevent the
* resolver from executing.
*/
authorize?: FieldAuthorizeResolver<TypeName, FieldName>
}
2020-11-28 01:20:50 +08:00
interface NexusGenPluginInputFieldConfig<TypeName extends string, FieldName extends string> {
}
2019-11-08 05:39:33 +08:00
interface NexusGenPluginSchemaConfig {
}
2020-11-19 18:50:14 +08:00
interface NexusGenPluginArgConfig {
}
2019-11-08 05:39:33 +08:00
}"
`;
exports[`fieldAuthorizePlugin warns and adds the authorize plugin when a schema has an authorize prop but no plugins 1`] = `
Array [
"The GraphQL Nexus \\"authorize\\" feature has been moved to a plugin, add [fieldAuthorizePlugin()] to your makeSchema plugin config to remove this warning.",
]
`;
2020-02-11 07:49:52 +08:00
exports[`fieldAuthorizePlugin warns when a field has a non-function authorize prop 1`] = `
Array [
2020-09-30 21:53:48 +08:00
[Error: The authorize property provided to incorrectFieldConfig with type User should be a function, saw number],
2020-02-11 07:49:52 +08:00
]
`;