204 lines
5.5 KiB
Plaintext
204 lines
5.5 KiB
Plaintext
// 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`] = `
|
|
"/**
|
|
* This file was generated by Nexus Schema
|
|
* Do not make changes to this file directly
|
|
*/
|
|
|
|
|
|
import type { FieldAuthorizeResolver } from \\"nexus/dist/plugins/fieldAuthorizePlugin\\"
|
|
|
|
|
|
|
|
|
|
declare global {
|
|
interface NexusGen extends NexusGenTypes {}
|
|
}
|
|
|
|
export interface NexusGenInputs {
|
|
}
|
|
|
|
export interface NexusGenEnums {
|
|
}
|
|
|
|
export interface NexusGenScalars {
|
|
String: string
|
|
Int: number
|
|
Float: number
|
|
Boolean: boolean
|
|
ID: string
|
|
}
|
|
|
|
export interface NexusGenObjects {
|
|
Query: {};
|
|
}
|
|
|
|
export interface NexusGenInterfaces {
|
|
}
|
|
|
|
export interface NexusGenUnions {
|
|
}
|
|
|
|
export type NexusGenRootTypes = NexusGenObjects
|
|
|
|
export type NexusGenAllTypes = NexusGenRootTypes & NexusGenScalars
|
|
|
|
export interface NexusGenFieldTypes {
|
|
Query: { // field return type
|
|
ok: boolean | null; // Boolean
|
|
}
|
|
}
|
|
|
|
export interface NexusGenFieldTypeNames {
|
|
Query: { // field return type name
|
|
ok: 'Boolean'
|
|
}
|
|
}
|
|
|
|
export interface NexusGenArgTypes {
|
|
}
|
|
|
|
export interface NexusGenAbstractTypeMembers {
|
|
}
|
|
|
|
export interface NexusGenTypeInterfaces {
|
|
}
|
|
|
|
export type NexusGenObjectNames = keyof NexusGenObjects;
|
|
|
|
export type NexusGenInputNames = never;
|
|
|
|
export type NexusGenEnumNames = never;
|
|
|
|
export type NexusGenInterfaceNames = never;
|
|
|
|
export type NexusGenScalarNames = keyof NexusGenScalars;
|
|
|
|
export type NexusGenUnionNames = never;
|
|
|
|
export type NexusGenDirectives = never
|
|
|
|
export interface NexusGenDirectiveArgs {
|
|
}
|
|
|
|
export type NexusGenObjectsUsingAbstractStrategyIsTypeOf = never;
|
|
|
|
export type NexusGenAbstractsUsingStrategyResolveType = never;
|
|
|
|
export type NexusGenFeaturesConfig = {
|
|
abstractTypeStrategies: {
|
|
isTypeOf: false
|
|
resolveType: true
|
|
__typename: false
|
|
}
|
|
}
|
|
|
|
export interface NexusGenTypes {
|
|
context: any;
|
|
inputTypes: NexusGenInputs;
|
|
directives: NexusGenDirectives;
|
|
directiveArgs: NexusGenDirectiveArgs;
|
|
rootTypes: NexusGenRootTypes;
|
|
inputTypeShapes: NexusGenInputs & NexusGenEnums & NexusGenScalars;
|
|
argTypes: NexusGenArgTypes;
|
|
fieldTypes: NexusGenFieldTypes;
|
|
fieldTypeNames: NexusGenFieldTypeNames;
|
|
allTypes: NexusGenAllTypes;
|
|
typeInterfaces: NexusGenTypeInterfaces;
|
|
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'];
|
|
abstractTypeMembers: NexusGenAbstractTypeMembers;
|
|
objectsUsingAbstractStrategyIsTypeOf: NexusGenObjectsUsingAbstractStrategyIsTypeOf;
|
|
abstractsUsingStrategyResolveType: NexusGenAbstractsUsingStrategyResolveType;
|
|
features: NexusGenFeaturesConfig;
|
|
}
|
|
|
|
|
|
declare global {
|
|
interface NexusGenPluginTypeConfig<TypeName extends string> {
|
|
}
|
|
interface NexusGenPluginInputTypeConfig<TypeName extends string> {
|
|
}
|
|
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>
|
|
}
|
|
interface NexusGenPluginInputFieldConfig<TypeName extends string, FieldName extends string> {
|
|
}
|
|
interface NexusGenPluginSchemaConfig {
|
|
}
|
|
interface NexusGenPluginArgConfig {
|
|
}
|
|
}"
|
|
`;
|
|
|
|
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.",
|
|
]
|
|
`;
|
|
|
|
exports[`fieldAuthorizePlugin warns when a field has a non-function authorize prop 1`] = `
|
|
Array [
|
|
[Error: The authorize property provided to incorrectFieldConfig with type User should be a function, saw number],
|
|
]
|
|
`;
|